/* NetHack 3.5 mhdlg.c $Date$ $Revision$ */
-/* SCCS Id: @(#)mhdlg.c 3.5 2005/01/23 */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
size_t result_size;
};
-BOOL CALLBACK GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
+#ifdef _M_X64
+INT_PTR
+#else
+BOOL
+#endif
+CALLBACK GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
-int mswin_getlin_window (
+INT_PTR mswin_getlin_window (
const char *question,
char *result,
size_t result_size
)
{
- int ret;
+ INT_PTR ret;
struct getlin_data data;
/* initilize dialog data */
return ret;
}
-BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+#ifdef _M_X64
+INT_PTR
+#else
+BOOL
+#endif
+CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LONG_PTR 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, lParam);
/* 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*)GetWindowLong(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);
+#ifdef _M_X64
+INT_PTR
+#else
+BOOL
+#endif
+CALLBACK ExtCmdDlgProc(HWND, UINT, WPARAM, LPARAM);
-int mswin_ext_cmd_window (int* selection)
+INT_PTR mswin_ext_cmd_window (int* selection)
{
- int ret;
+ INT_PTR ret;
struct extcmd_data data;
/* init dialog data */
return ret;
}
-BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+
+#ifdef _M_X64
+INT_PTR
+#else
+BOOL
+#endif
+CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LONG_PTR lParam)
{
struct extcmd_data* data;
RECT main_rt, dlg_rt;
{
case WM_INITDIALOG:
data = (struct extcmd_data*)lParam;
- SetWindowLong(hWnd, GWL_USERDATA, lParam);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam);
/* center dialog in the main window */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
break;
case WM_COMMAND:
- data = (struct extcmd_data*)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (struct extcmd_data*)GetWindowLong(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);
+#ifdef _M_X64
+INT_PTR
+#else
+BOOL
+#endif
+CALLBACK PlayerSelectorDlgProc(HWND, UINT, WPARAM, LONG_PTR);
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_PTR mswin_player_selection_window ( int* selection )
{
- int ret;
+ INT_PTR ret;
struct plsel_data data;
/* init dialog data */
return ret;
}
-BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+#ifdef _M_X64
+INT_PTR
+#else
+BOOL
+#endif
+CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LONG_PTR 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, lParam);
/* 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*)GetWindowLong(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;
+ 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);
}
/* NetHack 3.5 mhdlg.h $Date$ $Revision$ */
-/* SCCS Id: @(#)mhdlg.h 3.5 2005/01/23 */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#include "config.h"
#include "global.h"
-int mswin_getlin_window (const char *question, char *result, size_t result_size);
-int mswin_ext_cmd_window (int* selection);
-int mswin_player_selection_window(int* selection);
+INT_PTR mswin_getlin_window (const char *question, char *result, size_t result_size);
+INT_PTR mswin_ext_cmd_window (int* selection);
+INT_PTR mswin_player_selection_window(int* selection);
#endif /* MSWINDlgWindow_h */
static TCHAR szTitle[MAX_LOADSTRING];
extern void mswin_display_splash_window(BOOL);
-LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK MainWndProc(HWND, UINT, UINT, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
static LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
//
// PURPOSE: Processes messages for the main window.
*/
-LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, UINT wParam, LPARAM lParam)
{
PNHMainWindow data;
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)data);
/* update menu items */
CheckMenuItem(
case WM_KEYDOWN:
{
- data = (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMainWindow)GetWindowLong(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)GetWindowLong(hWnd, GWLP_USERDATA) );
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG)0);
// PostQuitMessage(0);
exit(1);
if( GetNHApp()->bAutoLayout ) {
GetClientRect(GetNHApp()->hMainWnd, &client_rt);
- data = (PNHMainWindow)GetWindowLong(GetNHApp()->hMainWnd, GWL_USERDATA);
+ data = (PNHMainWindow)GetWindowLong(GetNHApp()->hMainWnd, GWLP_USERDATA);
/* get sizes of child windows */
wnd_status = mswin_hwnd_from_winid(WIN_STATUS);
int wmId, wmEvent;
PNHMainWindow data;
- data = (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMainWindow)GetWindowLong(hWnd, GWLP_USERDATA);
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
winid map_id;
map_id = WIN_MAP;
- data = (PNHMainWindow)GetWindowLong(GetNHApp()->hMainWnd, GWL_USERDATA);
+ data = (PNHMainWindow)GetWindowLong(GetNHApp()->hMainWnd, GWLP_USERDATA);
/* override for Rogue level */
#ifdef REINCARNATION
style = GetWindowLong(GetNHApp()->windowlist[i].win, GWL_STYLE);
if( lock ) style &= ~WS_CAPTION;
else style |= WS_CAPTION;
- SetWindowLong(GetNHApp()->windowlist[i].win, GWL_STYLE, style);
+ SetWindowLongPtr(GetNHApp()->windowlist[i].win, GWL_STYLE, style);
SetWindowPos(
GetNHApp()->windowlist[i].win,
NULL,
/* NetHack 3.5 mhmap.c $Date$ $Revision$ */
-/* SCCS Id: @(#)mhmap.c 3.5 2005/01/23 */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
wnd_size.cy = client_rt.bottom - client_rt.top;
/* set new screen tile size */
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLong(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)GetWindowLong(hWnd, GWLP_USERDATA);
if( mode == data->mapMode ) return mode;
oldMode = data->mapMode;
{
PNHMapWindow data;
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLong(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)0);
break;
default:
PNHMapWindow data;
RECT rt;
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLong(hWnd, GWLP_USERDATA);
switch(wParam) {
case MSNH_MSG_PRINT_GLYPH:
{
data->xScrTile = GetNHApp()->mapTile_X;
data->yScrTile = GetNHApp()->mapTile_Y;
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG)data);
}
/* on WM_PAINT */
int i, j;
/* get window data */
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLong(hWnd, GWLP_USERDATA);
hDC = BeginPaint(hWnd, &ps);
int yDelta;
/* get window data */
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLong(hWnd, GWLP_USERDATA);
switch(LOWORD (wParam))
{
int xDelta;
/* get window data */
- data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMapWindow)GetWindowLong(hWnd, GWLP_USERDATA);
switch(LOWORD (wParam))
{
/* NetHack 3.5 mhmenu.c $Date$ $Revision$ */
-/* SCCS Id: @(#)mhmenu.c 3.5 2002/03/06 */
/* Copyright (c) Alex Kompel, 2002 */
/* NetHack may be freely redistributed. See license for details. */
#define NHMENU_IS_SELECTED(item) ((item).count!=0)
#define NHMENU_HAS_GLYPH(item) ((item).glyph!=NO_GLYPH)
-BOOL CALLBACK MenuWndProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT 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);
DWORD style;
style = GetWindowLong(ret, GWL_STYLE);
style |= WS_CAPTION;
- SetWindowLong(ret, GWL_STYLE, style);
+ SetWindowLongPtr(ret, GWL_STYLE, style);
SetWindowPos(ret, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
*_selected = NULL;
ret_val = -1;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLong(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)
+LRESULT 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)GetWindowLong(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)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)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)0);
}
return TRUE;
}
{
PNHMenuWindow data;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLong(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)GetWindowLong(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)GetWindowLong(hWnd, GWLP_USERDATA);
data->type = type;
LVCOLUMN lvcol;
LRESULT fnt;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLong(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)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)GetWindowLong(hWnd, GWLP_USERDATA);
if(data->type==MENU_TYPE_TEXT) {
return GetDlgItem(hWnd, IDC_MENU_TEXT);
int i;
lpmis = (LPMEASUREITEMSTRUCT) lParam;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLong(hWnd, GWLP_USERDATA);
GetClientRect(GetMenuControl(hWnd), &list_rect);
hdc = GetDC(GetMenuControl(hWnd));
/* If there are no list box items, skip this message. */
if (lpdis->itemID == -1) return FALSE;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLong(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)GetWindowLong(hWnd, GWLP_USERDATA);
switch( ch ) {
case MENU_FIRST_PAGE:
RECT rt, wrt;
int extra_cx;
- data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMenuWindow)GetWindowLong(hWnd, GWLP_USERDATA);
if(data) {
control = GetMenuControl(hWnd);
/* NetHack 3.5 mhmsgwnd.c $Date$ $Revision$ */
-/* SCCS Id: @(#)mhmsgwnd.c 3.5 2005/01/23 */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
case WM_DESTROY:
{
PNHMessageWindow data;
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLong(hWnd, GWLP_USERDATA);
free(data);
- SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG)0);
} break;
case WM_SIZE:
PNHMessageWindow data;
RECT rt;
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLong(hWnd, GWLP_USERDATA);
xNewSize = LOWORD(lParam);
yNewSize = HIWORD(lParam);
{
PNHMessageWindow data;
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLong(hWnd, GWLP_USERDATA);
switch( wParam ) {
case MSNH_MSG_PUTSTR:
{
int yInc;
/* get window data */
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLong(hWnd, GWLP_USERDATA);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
int xInc;
/* get window data */
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLong(hWnd, GWLP_USERDATA);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
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)GetWindowLong(hWnd, GWLP_USERDATA);
GetClientRect(hWnd, &client_rt);
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)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)GetWindowLong(hWnd, GWLP_USERDATA);
if( !data ) return;
/* -- Calculate the font size -- */
RECT draw_rt;
BOOL retval = FALSE;
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLong(hWnd, GWLP_USERDATA);
/* cannot append if lines_not_seen is 0 (beginning of the new turn */
if( data->lines_not_seen==0 ) return FALSE;
int remaining_height;
char tmptext[MAXWINDOWTEXT+1];
- data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHMessageWindow)GetWindowLong(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 */
/* NetHack 3.5 mhrip.c $Date$ $Revision$ */
-/* SCCS Id: @(#)mhrip.c 3.5 2005/01/23 */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
TCHAR* rip_text;
} NHRIPWindow, *PNHRIPWindow;
-BOOL CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT 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)data);
return ret;
}
HDC hdc;
HFONT OldFont;
- data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHRIPWindow)GetWindowLong(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)
+LRESULT CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PNHRIPWindow data;
- data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHRIPWindow)GetWindowLong(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)0);
}
break;
{
PNHRIPWindow data;
static int InRipText = 1;
- data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHRIPWindow)GetWindowLong(hWnd, GWLP_USERDATA);
switch( wParam ) {
case MSNH_MSG_PUTSTR: {
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
PNHWinApp GetNHApp(void);
-BOOL CALLBACK NHSplashWndProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT 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)
+LRESULT CALLBACK NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
switch (message)
/* NetHack 3.5 mhstatus.c $Date$ $Revision$ */
-/* SCCS Id: @(#)mhstatus.c 3.5 2005/01/23 */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHStatusWindow));
- SetWindowLong(ret, GWL_USERDATA, (LONG)data);
+ SetWindowLongPtr(ret, GWLP_USERDATA, (LONG)data);
return ret;
}
HDC hdc;
PNHStatusWindow data;
- data = (PNHStatusWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHStatusWindow)GetWindowLong(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)0);
break;
case WM_SETFOCUS:
sz->cx = rt.right - rt.left;
sz->cy = rt.bottom - rt.top;
- data = (PNHStatusWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHStatusWindow)GetWindowLong(hWnd, GWLP_USERDATA);
if(data) {
hdc = GetDC(hWnd);
saveFont = SelectObject(hdc, mswin_get_font(NHW_STATUS, ATR_NONE, hdc, FALSE));
/* NetHack 3.5 mhtext.c $Date$ $Revision$ */
-/* SCCS Id: @(#)mhtext.c 3.5 2005/01/23 */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#define DEFAULT_COLOR_BG_TEXT COLOR_WINDOW
#define DEFAULT_COLOR_FG_TEXT COLOR_WINDOWTEXT
-BOOL CALLBACK NHTextWndProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT 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);
DWORD style;
style = GetWindowLong(ret, GWL_STYLE);
style |= WS_CAPTION;
- SetWindowLong(ret, GWL_STYLE, style);
+ SetWindowLongPtr(ret, GWL_STYLE, style);
SetWindowPos(ret, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
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)data);
return ret;
}
{
PNHTextWindow data;
- data = (PNHTextWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHTextWindow)GetWindowLong(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)
+LRESULT 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)GetWindowLong(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)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)0);
}
break;
{
PNHTextWindow data;
- data = (PNHTextWindow)GetWindowLong(hWnd, GWL_USERDATA);
+ data = (PNHTextWindow)GetWindowLong(hWnd, GWLP_USERDATA);
switch( wParam ) {
case MSNH_MSG_PUTSTR: {
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
if (*colorstring == '#') {
if (strlen(++colorstring) != 6) return;
- red_value = index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
+ red_value = (int)(index(hexadecimals, tolower(*colorstring++)) - hexadecimals);
red_value *= 16;
- red_value += index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
+ red_value += (int)(index(hexadecimals, tolower(*colorstring++)) - hexadecimals);
- green_value = index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
+ green_value = (int)(index(hexadecimals, tolower(*colorstring++)) - hexadecimals);
green_value *= 16;
- green_value += index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
+ green_value += (int)(index(hexadecimals, tolower(*colorstring++)) - hexadecimals);
- blue_value = index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
+ blue_value = (int)(index(hexadecimals, tolower(*colorstring++)) - hexadecimals);
blue_value *= 16;
- blue_value += index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
+ blue_value += (int)(index(hexadecimals, tolower(*colorstring++)) - hexadecimals);
*colorptr = RGB(red_value, green_value, blue_value);
} else {