int mswin_yes_no_dialog( const char *question, const char *choices, int def)
{
+ UNREFERENCED_PARAMETER(question);
+ UNREFERENCED_PARAMETER(choices);
+ UNREFERENCED_PARAMETER(def);
return '\032';
}
size_t result_size;
};
-BOOL CALLBACK GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
int mswin_getlin_window (
const char *question,
size_t result_size
)
{
- int ret;
+ INT_PTR ret;
struct getlin_data data;
/* initilize dialog data */
);
if( ret==-1 ) panic("Cannot create getlin window");
- return ret;
+ return (int)ret;
}
-BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct getlin_data* data;
RECT main_rt, dlg_rt;
case WM_INITDIALOG:
data = (struct getlin_data*)lParam;
SetWindowText(hWnd, NH_A2W(data->question, wbuf, sizeof(wbuf)));
- SetWindowLong(hWnd, GWL_USERDATA, lParam);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
/* center dialog in the main window */
GetWindowRect(hWnd, &dlg_rt);
{
/* OK button was pressed */
case IDOK:
- data = (struct getlin_data*)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (struct getlin_data*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
SendDlgItemMessage(hWnd, IDC_GETLIN_EDIT, WM_GETTEXT, (WPARAM)sizeof(wbuf), (LPARAM)wbuf );
NH_W2A(wbuf, data->result, data->result_size);
int* selection;
};
-BOOL CALLBACK ExtCmdDlgProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK ExtCmdDlgProc(HWND, UINT, WPARAM, LPARAM);
int mswin_ext_cmd_window (int* selection)
{
- int ret;
+ INT_PTR ret;
struct extcmd_data data;
/* init dialog data */
(LPARAM)&data
);
if( ret==-1 ) panic("Cannot create extcmd window");
- return ret;
+ return (int)ret;
}
-BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct extcmd_data* data;
RECT main_rt, dlg_rt;
SIZE dlg_sz;
int i;
- const char *ptr;
TCHAR wbuf[255];
switch (message)
{
case WM_INITDIALOG:
data = (struct extcmd_data*)lParam;
- SetWindowLong(hWnd, GWL_USERDATA, lParam);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
/* center dialog in the main window */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
TRUE );
/* fill combobox with extended commands */
- for(i=0; (ptr=extcmdlist[i].ef_txt); i++) {
- SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(ptr, wbuf, sizeof(wbuf)) );
+ for(i=0; extcmdlist[i].ef_txt; i++) {
+ SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(extcmdlist[i].ef_txt, wbuf, sizeof(wbuf)) );
}
/* set focus to the list control */
break;
case WM_COMMAND:
- data = (struct extcmd_data*)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (struct extcmd_data*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch (LOWORD(wParam))
{
/* OK button ws clicked */
case IDOK:
- *data->selection = SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0 );
+ *data->selection = (int)SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0 );
if( *data->selection==LB_ERR )
*data->selection = -1;
/* Fall through. */
lParam
Handle to the list box
*/
- *data->selection = SendMessage((HWND)lParam, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
+ *data->selection = (int)SendMessage((HWND)lParam, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
if( *data->selection==LB_ERR )
*data->selection = -1;
EndDialog(hWnd, IDOK);
int* selection;
};
-BOOL CALLBACK PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM);
static void plselInitDialog(HWND hWnd);
static void plselAdjustLists(HWND hWnd, int changed_opt);
static int plselFinalSelection(HWND hWnd, int* selection);
int mswin_player_selection_window ( int* selection )
{
- int ret;
+ INT_PTR ret;
struct plsel_data data;
/* init dialog data */
);
if( ret==-1 ) panic("Cannot create getlin window");
- return ret;
+ return (int)ret;
}
-BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct plsel_data* data;
RECT main_rt, dlg_rt;
{
case WM_INITDIALOG:
data = (struct plsel_data*)lParam;
- SetWindowLong(hWnd, GWL_USERDATA, lParam);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
/* center dialog in the main window */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
break;
case WM_COMMAND:
- data = (struct plsel_data*)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (struct plsel_data*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch (LOWORD(wParam)) {
/* OK button was clicked */
void setComboBoxValue(HWND hWnd, int combo_box, int value)
{
- int index_max = SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
+ int index_max = (int)SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
int index;
int value_to_set = LB_ERR;
for (index = 0; index < index_max; index++) {
HWND control_role, control_race, control_gender, control_align;
int initrole, initrace, initgend, initalign;
int i;
- int ind;
+ LRESULT ind;
int valid_opt;
TCHAR wbuf[255];
/* get current selections */
ind = SendMessage(control_role, CB_GETCURSEL, 0, 0);
- initrole = (ind==LB_ERR)? flags.initrole : SendMessage(control_role, CB_GETITEMDATA, ind, 0);
+ initrole = (ind==LB_ERR)? flags.initrole : (int)SendMessage(control_role, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_race, CB_GETCURSEL, 0, 0);
- initrace = (ind==LB_ERR)? flags.initrace : SendMessage(control_race, CB_GETITEMDATA, ind, 0);
+ initrace = (ind==LB_ERR)? flags.initrace : (int)SendMessage(control_race, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_gender, CB_GETCURSEL, 0, 0);
- initgend = (ind==LB_ERR)? flags.initgend : SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
+ initgend = (ind==LB_ERR)? flags.initgend : (int)SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_align, CB_GETCURSEL, 0, 0);
- initalign = (ind==LB_ERR)? flags.initalign : SendMessage(control_align, CB_GETITEMDATA, ind, 0);
+ initalign = (ind==LB_ERR)? flags.initalign : (int)SendMessage(control_align, CB_GETITEMDATA, ind, 0);
/* intialize roles list */
if( changed_sel==-1 ) {
/* player made up his mind - get final selection here */
int plselFinalSelection(HWND hWnd, int* selection)
{
- int ind;
+ UNREFERENCED_PARAMETER(selection);
+
+ LRESULT ind;
/* get current selections */
if( SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
flags.initrole = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETCURSEL, 0, 0);
- flags.initrole = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETITEMDATA, ind, 0);
+ flags.initrole = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETITEMDATA, ind, 0);
}
if( SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
flags.initrace = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETCURSEL, 0, 0);
- flags.initrace = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETITEMDATA, ind, 0);
+ flags.initrace = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETITEMDATA, ind, 0);
}
if( SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
flags.initgend = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETCURSEL, 0, 0);
- flags.initgend = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETITEMDATA, ind, 0);
+ flags.initgend = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETITEMDATA, ind, 0);
}
if( SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
flags.initalign = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETCURSEL, 0, 0);
- flags.initalign = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETITEMDATA, ind, 0);
+ flags.initalign = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETITEMDATA, ind, 0);
}
void mswin_init_splashfonts(HWND hWnd)
{
HDC hdc = GetDC(hWnd);
- HFONT fnt = NULL;
LOGFONT lgfnt;
ZeroMemory( &lgfnt, sizeof(lgfnt) );
lgfnt.lfHeight = -80; // height of font
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHMainWindow));
data->mapAcsiiModeSave = MAP_MODE_ASCII12x16;
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
/* update menu items */
CheckMenuItem(
case WM_KEYDOWN:
{
- data = (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMainWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
/* translate arrow keys into nethack commands */
switch (wParam)
WM_QUIT somehow */
/* clean up */
- free( (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA) );
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+ free( (PNHMainWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA) );
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
// PostQuitMessage(0);
exit(1);
void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(hWnd);
+ UNREFERENCED_PARAMETER(wParam);
+ UNREFERENCED_PARAMETER(lParam);
+
switch(wParam) {
/* new window was just added */
if( GetNHApp()->bAutoLayout ) {
GetClientRect(GetNHApp()->hMainWnd, &client_rt);
- data = (PNHMainWindow)GetWindowLong(GetNHApp()->hMainWnd, GWL_USERDATA);
+ data = (PNHMainWindow)GetWindowLongPtr(GetNHApp()->hMainWnd, GWLP_USERDATA);
/* get sizes of child windows */
wnd_status = mswin_hwnd_from_winid(WIN_STATUS);
LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(lParam);
+
int wmId, wmEvent;
PNHMainWindow data;
- data = (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMainWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Mesage handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(lParam);
+
char buf[BUFSZ];
TCHAR wbuf[BUFSZ];
RECT main_rt, dlg_rt;
winid map_id;
map_id = WIN_MAP;
- data = (PNHMainWindow)GetWindowLong(GetNHApp()->hMainWnd, GWL_USERDATA);
+ data = (PNHMainWindow)GetWindowLongPtr(GetNHApp()->hMainWnd, GWLP_USERDATA);
/* override for Rogue level */
if( Is_rogue_level(&u.uz) && !IS_MAP_ASCII(mode) ) return;
wnd_size.cy = client_rt.bottom - client_rt.top;
/* set new screen tile size */
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
data->xScrTile =
max(1, (data->bFitToScreenMode? wnd_size.cx : lpsz->cx) / COLNO);
data->yScrTile =
int oldMode;
SIZE mapSize;
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if( mode == data->mapMode ) return mode;
oldMode = data->mapMode;
{
PNHMapWindow data;
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch (message)
{
case WM_CREATE:
case WM_DESTROY:
if( data->hMapFont ) DeleteObject(data->hMapFont);
free(data);
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
break;
default:
PNHMapWindow data;
RECT rt;
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch(wParam) {
case MSNH_MSG_PRINT_GLYPH:
{
/* on WM_CREATE */
void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(wParam);
+ UNREFERENCED_PARAMETER(lParam);
+
PNHMapWindow data;
int i,j;
data->xScrTile = GetNHApp()->mapTile_X;
data->yScrTile = GetNHApp()->mapTile_Y;
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
}
/* on WM_PAINT */
int i, j;
/* get window data */
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
hDC = BeginPaint(hWnd, &ps);
/* on WM_VSCROLL */
void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(lParam);
+
PNHMapWindow data;
SCROLLINFO si;
int yNewPos;
int yDelta;
/* get window data */
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch(LOWORD (wParam))
{
/* on WM_HSCROLL */
void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(lParam);
+
PNHMapWindow data;
SCROLLINFO si;
int xNewPos;
int xDelta;
/* get window data */
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch(LOWORD (wParam))
{
#define NHMENU_IS_SELECTED(item) ((item).count!=0)
#define NHMENU_HAS_GLYPH(item) ((item).glyph!=NO_GLYPH)
-BOOL CALLBACK MenuWndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK MenuWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK NHMenuListWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK NHMenuTextWndProc(HWND, UINT, WPARAM, LPARAM);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
*_selected = NULL;
ret_val = -1;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
/* force activate for certain menu types */
if( data->type == MENU_TYPE_MENU &&
return ret_val;
}
/*-----------------------------------------------------------------------------*/
-BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PNHMenuWindow data;
HWND control;
TCHAR title[MAX_LOADSTRING];
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch (message)
{
case WM_INITDIALOG:
data->bmpCheckedCount = LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_SEL_COUNT));
data->bmpNotChecked = LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_UNSEL));
data->is_active = FALSE;
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
/* set font for the text cotrol */
control = GetDlgItem(hWnd, IDC_MENU_TEXT);
ReleaseDC(control, hdc);
/* subclass edit control */
- editControlWndProc = (WNDPROC)GetWindowLong(control, GWL_WNDPROC);
- SetWindowLong(control, GWL_WNDPROC, (LONG)NHMenuTextWndProc);
+ editControlWndProc = (WNDPROC)GetWindowLongPtr(control, GWLP_WNDPROC);
+ SetWindowLongPtr(control, GWLP_WNDPROC, (LONG_PTR)NHMenuTextWndProc);
/* Even though the dialog has no caption, you can still set the title
which shows on Alt-Tab */
if( data->text.text ) free(data->text.text);
}
free(data);
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
}
return TRUE;
}
{
PNHMenuWindow data;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch( wParam ) {
case MSNH_MSG_PUTSTR:
{
POINT pt_elem, pt_ok, pt_cancel;
SIZE sz_elem, sz_ok, sz_cancel;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
menu_ok = GetDlgItem(hWnd, IDOK);
menu_cancel = GetDlgItem(hWnd, IDCANCEL);
PNHMenuWindow data;
HWND list, text;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
data->type = type;
LVCOLUMN lvcol;
LRESULT fnt;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if( data->type != MENU_TYPE_MENU ) return;
data->how = how;
if( !control ) panic( "cannot create menu control" );
/* install the hook for the control window procedure */
- wndProcListViewOrig = (WNDPROC)GetWindowLong(control, GWL_WNDPROC);
- SetWindowLong(control, GWL_WNDPROC, (LONG)NHMenuListWndProc);
+ wndProcListViewOrig = (WNDPROC)GetWindowLongPtr(control, GWLP_WNDPROC);
+ SetWindowLongPtr(control, GWLP_WNDPROC, (LONG_PTR)NHMenuListWndProc);
/* set control colors */
ListView_SetBkColor(control,
lvitem.state = data->menu.items[i].presel? LVIS_SELECTED : 0;
lvitem.pszText = NH_A2W(buf, wbuf, BUFSZ);
lvitem.lParam = (LPARAM)&data->menu.items[i];
- nItem = SendMessage(control, LB_ADDSTRING, (WPARAM)0, (LPARAM) buf);
+ nItem = (int)SendMessage(control, LB_ADDSTRING, (WPARAM)0, (LPARAM) buf);
if( ListView_InsertItem(control, &lvitem)==-1 ) {
panic("cannot insert menu item");
}
{
PNHMenuWindow data;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if(data->type==MENU_TYPE_TEXT) {
return GetDlgItem(hWnd, IDC_MENU_TEXT);
/*-----------------------------------------------------------------------------*/
BOOL onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(wParam);
+
LPMEASUREITEMSTRUCT lpmis;
TEXTMETRIC tm;
HGDIOBJ saveFont;
int i;
lpmis = (LPMEASUREITEMSTRUCT) lParam;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
GetClientRect(GetMenuControl(hWnd), &list_rect);
hdc = GetDC(GetMenuControl(hWnd));
/*-----------------------------------------------------------------------------*/
BOOL onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(wParam);
+
LPDRAWITEMSTRUCT lpdis;
PNHMenuItem item;
PNHMenuWindow data;
/* If there are no list box items, skip this message. */
if (lpdis->itemID == -1) return FALSE;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
item = &data->menu.items[lpdis->itemID];
int curIndex, topIndex, pageSize;
boolean is_accelerator = FALSE;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch( ch ) {
case MENU_FIRST_PAGE:
RECT rt, wrt;
int extra_cx;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if(data) {
control = GetMenuControl(hWnd);
case WM_DESTROY:
{
PNHMessageWindow data;
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
free(data);
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
} break;
case WM_SIZE:
PNHMessageWindow data;
RECT rt;
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
xNewSize = LOWORD(lParam);
yNewSize = HIWORD(lParam);
{
PNHMessageWindow data;
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch( wParam ) {
case MSNH_MSG_PUTSTR:
{
/* get the input */
while (!okkey) {
- char c = mswin_nhgetch();
+ int c = mswin_nhgetch();
switch (c)
{
void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(lParam);
+
PNHMessageWindow data;
SCROLLINFO si;
int yInc;
/* get window data */
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
int xInc;
/* get window data */
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
TCHAR wbuf[MAXWINDOWTEXT+2];
size_t wlen;
COLORREF OldBg, OldFg;
- int do_more = 0;
hdc = BeginPaint(hWnd, &ps);
OldBg = SetBkColor(hdc, message_bg_brush ? message_bg_color : (COLORREF)GetSysColor(DEFAULT_COLOR_BG_MSG));
OldFg = setMsgTextColor(hdc, 0);
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
GetClientRect(hWnd, &client_rt);
void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(wParam);
+ UNREFERENCED_PARAMETER(lParam);
+
PNHMessageWindow data;
SIZE dummy;
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHMessageWindow));
data->max_text = MAXWINDOWTEXT;
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
/* re-calculate window size (+ font size) */
mswin_message_window_size(hWnd, &dummy);
PNHMessageWindow data;
RECT rt, client_rt;
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if( !data ) return;
/* -- Calculate the font size -- */
RECT draw_rt;
BOOL retval = FALSE;
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
/* cannot append if lines_not_seen is 0 (beginning of the new turn */
if( data->lines_not_seen==0 ) return FALSE;
HDC hdc;
HGDIOBJ saveFont;
RECT client_rt, draw_rt;
- BOOL retval = FALSE;
- int visible_lines = 0;
int i;
int remaining_height;
char tmptext[MAXWINDOWTEXT+1];
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if( data->lines_not_seen==0 ) return FALSE; /* don't bother checking - nothig to "more" */
if( data->lines_not_seen>=MSG_LINES ) return TRUE; /* history size exceeded - always more */
TCHAR* rip_text;
} NHRIPWindow, *PNHRIPWindow;
-BOOL CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
HWND mswin_init_RIP_window () {
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHRIPWindow));
- SetWindowLong(ret, GWL_USERDATA, (LONG)data);
+ SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR)data);
return ret;
}
HDC hdc;
HFONT OldFont;
- data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHRIPWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
GetNHApp()->hPopupWnd = hWnd;
mapWnd = mswin_hwnd_from_winid(WIN_MAP);
GetNHApp()->hPopupWnd = NULL;
}
-BOOL CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PNHRIPWindow data;
- data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHRIPWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch (message)
{
case WM_INITDIALOG:
if( data->rip_text ) free(data->rip_text);
if (data->rip_bmp != NULL) DeleteObject(data->rip_bmp);
free(data);
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
}
break;
{
PNHRIPWindow data;
static int InRipText = 1;
- data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHRIPWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch( wParam ) {
case MSNH_MSG_PUTSTR: {
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
PNHWinApp GetNHApp(void);
-BOOL CALLBACK NHSplashWndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK NHSplashWndProc(HWND, UINT, WPARAM, LPARAM);
#define SPLASH_WIDTH 440
#define SPLASH_HEIGHT 322
mswin_destroy_splashfonts();
}
-BOOL CALLBACK NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
+ UNREFERENCED_PARAMETER(lParam);
+
HDC hdc;
switch (message)
{
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHStatusWindow));
- SetWindowLong(ret, GWL_USERDATA, (LONG)data);
+ SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR)data);
return ret;
}
HDC hdc;
PNHStatusWindow data;
- data = (PNHStatusWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHStatusWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch (message)
{
case WM_MSNH_COMMAND: {
case WM_DESTROY:
free(data);
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
break;
case WM_SETFOCUS:
GetClientRect(hWnd, &rt);
- data = (PNHStatusWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHStatusWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if(data) {
hdc = GetDC(hWnd);
saveFont = SelectObject(hdc, mswin_get_font(NHW_STATUS, ATR_NONE, hdc, FALSE));
#define DEFAULT_COLOR_BG_TEXT COLOR_WINDOW
#define DEFAULT_COLOR_FG_TEXT COLOR_WINDOWTEXT
-BOOL CALLBACK NHTextWndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK NHTextWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK NHEditHookWndProc(HWND, UINT, WPARAM, LPARAM);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void LayoutText(HWND hwnd);
data = (PNHTextWindow)malloc(sizeof(NHTextWindow));
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHTextWindow));
- SetWindowLong(ret, GWL_USERDATA, (LONG)data);
+ SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR)data);
return ret;
}
{
PNHTextWindow data;
- data = (PNHTextWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHTextWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if( data && data->window_text ) {
HWND control;
control = GetDlgItem(hWnd, IDC_TEXT_CONTROL);
mswin_popup_destroy(hWnd);
}
-BOOL CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND control;
HDC hdc;
PNHTextWindow data;
TCHAR title[MAX_LOADSTRING];
- data = (PNHTextWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHTextWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch (message)
{
case WM_INITDIALOG:
ReleaseDC(control, hdc);
/* subclass edit control */
- editControlWndProc = (WNDPROC)GetWindowLong(control, GWL_WNDPROC);
- SetWindowLong(control, GWL_WNDPROC, (LONG)NHEditHookWndProc);
+ editControlWndProc = (WNDPROC)GetWindowLongPtr(control, GWLP_WNDPROC);
+ SetWindowLongPtr(control, GWLP_WNDPROC, (LONG_PTR)NHEditHookWndProc);
SetFocus(control);
if( data ) {
if( data->window_text ) free(data->window_text);
free(data);
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
}
break;
{
PNHTextWindow data;
- data = (PNHTextWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHTextWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch( wParam ) {
case MSNH_MSG_PUTSTR: {
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
*/
void mswin_init_nhwindows(int* argc, char** argv)
{
+ UNREFERENCED_PARAMETER(argc);
+ UNREFERENCED_PARAMETER(argv);
+
logDebug("mswin_init_nhwindows()\n");
#ifdef _DEBUG
ZeroMemory(&data, sizeof(data));
data.attr = attr;
data.text = text;
- data.append = app;
+ data.append = !!app;
SendMessage(
GetNHApp()->windowlist[wid].win,
WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_PUTSTR, (LPARAM)&data );
void mswin_putmsghistory(const char * msg, BOOLEAN_P restoring)
{
+ UNREFERENCED_PARAMETER(restoring);
+
BOOL save_sound_opt;
if (!msg) return; /* end of message history restore */
LPSTR lpCmdLine,
int nCmdShow)
{
+ UNREFERENCED_PARAMETER(hPrevInstance);
+ UNREFERENCED_PARAMETER(lpCmdLine);
+ UNREFERENCED_PARAMETER(nCmdShow);
+
INITCOMMONCONTROLSEX InitCtrls;
int argc;
char* argv[MAX_CMDLINE_PARAM];