]> granicus.if.org Git - nethack/commitdiff
Start trying to clean up the Windows x64 build (trunk only)
authornethack.allison <nethack.allison>
Wed, 11 Jan 2012 01:15:37 +0000 (01:15 +0000)
committernethack.allison <nethack.allison>
Wed, 11 Jan 2012 01:15:37 +0000 (01:15 +0000)
win/win32/mhdlg.c
win/win32/mhdlg.h
win/win32/mhmain.c
win/win32/mhmap.c
win/win32/mhmenu.c
win/win32/mhmsgwnd.c
win/win32/mhrip.c
win/win32/mhsplash.c
win/win32/mhstatus.c
win/win32/mhtext.c
win/win32/mswproc.c

index 0434f758a61abe0ae49045807738b13ade2afdac..ff84dadedaa4b34eeeee2cab8aa62fee5cec3351 100644 (file)
@@ -1,5 +1,4 @@
 /* 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. */
 
@@ -19,15 +18,20 @@ struct getlin_data {
        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 */
@@ -49,7 +53,12 @@ int mswin_getlin_window (
        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;
@@ -69,7 +78,7 @@ BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
        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);
@@ -143,7 +152,7 @@ BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
         { 
                        /* 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);
 
@@ -167,11 +176,16 @@ struct extcmd_data {
        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 */
@@ -191,7 +205,13 @@ int mswin_ext_cmd_window (int* selection)
        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;
@@ -204,7 +224,7 @@ BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
        {
        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);
@@ -236,12 +256,12 @@ BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
        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. */
@@ -263,7 +283,7 @@ BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
                                         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); 
@@ -281,14 +301,19 @@ struct plsel_data {
        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 */
@@ -308,7 +333,12 @@ int mswin_player_selection_window ( int* selection )
        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;
@@ -318,7 +348,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
        {
        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);
@@ -348,7 +378,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
        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 */
@@ -442,7 +472,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
 
 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++) {
@@ -531,7 +561,7 @@ void  plselAdjustLists(HWND hWnd, int changed_sel)
        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];
 
@@ -543,16 +573,16 @@ void  plselAdjustLists(HWND hWnd, int changed_sel)
 
        /* 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 ) {
@@ -672,35 +702,35 @@ void  plselAdjustLists(HWND hWnd, int changed_sel)
 /* 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);
        }
        
 
index 1a272c6747fce00dae434417f87e2f771242b051..608810bc0f5ef10b6f56302309c8f447f49658af 100644 (file)
@@ -1,5 +1,4 @@
 /* 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. */
 
@@ -10,9 +9,9 @@
 #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 */
 
index 1f7f2e6cbb42596241b3deac4e2d0712435105f9..ccd97a428669dd87490668428fa1a2e69840dd82 100644 (file)
@@ -25,7 +25,7 @@ static TCHAR szMainWindowClass[] = TEXT("MSNHMainWndClass");
 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);
@@ -175,7 +175,7 @@ static const char scanmap[] = {     /* ... */
 //
 //  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;
 
@@ -187,7 +187,7 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
                        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(
@@ -213,7 +213,7 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
 
         case WM_KEYDOWN: 
                {
-                       data = (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA);
+                       data = (PNHMainWindow)GetWindowLong(hWnd, GWLP_USERDATA);
 
                        /* translate arrow keys into nethack commands */
             switch (wParam) 
@@ -524,8 +524,8 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
                           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); 
@@ -584,7 +584,7 @@ void mswin_layout_main_window(HWND changed_child)
 
        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);
@@ -754,7 +754,7 @@ LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
        int wmId, wmEvent;
        PNHMainWindow  data;
 
-       data = (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMainWindow)GetWindowLong(hWnd, GWLP_USERDATA);
        wmId    = LOWORD(wParam); 
        wmEvent = HIWORD(wParam); 
 
@@ -1039,7 +1039,7 @@ void mswin_select_map_mode(int mode)
        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
@@ -1133,7 +1133,7 @@ void nhlock_windows( BOOL lock )
                        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, 
index aa1e5ba962cd432f93f7da209caade331e8b1a27..94e3d850166f49789abb59172c53bbf920640d4d 100644 (file)
@@ -1,5 +1,4 @@
 /* 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. */
 
@@ -107,7 +106,7 @@ void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw)
        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 = 
@@ -201,7 +200,7 @@ int mswin_map_mode(HWND hWnd, int mode)
        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;
@@ -334,7 +333,7 @@ LRESULT CALLBACK MapWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
 {
        PNHMapWindow data;
        
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLong(hWnd, GWLP_USERDATA);
        switch (message) 
        {
        case WM_CREATE:
@@ -413,7 +412,7 @@ LRESULT CALLBACK MapWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
        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:
@@ -428,7 +427,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
        PNHMapWindow data;
        RECT rt;
 
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLong(hWnd, GWLP_USERDATA);
        switch(wParam) {
        case MSNH_MSG_PRINT_GLYPH: 
        {
@@ -576,7 +575,7 @@ void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
        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 */
@@ -591,7 +590,7 @@ void onPaint(HWND hWnd)
        int i, j;
 
        /* get window data */
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLong(hWnd, GWLP_USERDATA);
 
        hDC = BeginPaint(hWnd, &ps);
 
@@ -751,7 +750,7 @@ void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
        int yDelta;
  
        /* get window data */
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLong(hWnd, GWLP_USERDATA);
 
     switch(LOWORD (wParam)) 
     { 
@@ -809,7 +808,7 @@ void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
        int xDelta;
  
        /* get window data */
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLong(hWnd, GWLP_USERDATA);
        
     switch(LOWORD (wParam)) 
     { 
index cf9ad32430d17bf74dda8a429f5a9313270da575..089d590907d73f3981772ae1f15a13d01ac4e958 100644 (file)
@@ -1,5 +1,4 @@
 /* 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. */
 
@@ -75,7 +74,7 @@ static WNDPROC editControlWndProc = NULL;
 #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);
@@ -124,7 +123,7 @@ HWND mswin_init_menu_window (int type) {
                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);
        }
 
@@ -144,7 +143,7 @@ int mswin_menu_window_select_menu (HWND hWnd, int how, MENU_ITEM_P ** _selected,
        *_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 &&
@@ -247,7 +246,7 @@ int mswin_menu_window_select_menu (HWND hWnd, int how, MENU_ITEM_P ** _selected,
        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;
@@ -255,7 +254,7 @@ BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     TCHAR title[MAX_LOADSTRING];
 
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLong(hWnd, GWLP_USERDATA);
        switch (message) 
        {
        case WM_INITDIALOG:
@@ -269,7 +268,7 @@ BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                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);
@@ -278,8 +277,8 @@ BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                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 */
@@ -491,7 +490,7 @@ BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                                if( data->text.text ) free(data->text.text);
                        }
                        free(data);
-                       SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+                       SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG)0);
                }
                return TRUE;
        }
@@ -502,7 +501,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
        PNHMenuWindow data;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLong(hWnd, GWLP_USERDATA);
        switch( wParam ) {
        case MSNH_MSG_PUTSTR: 
        {
@@ -660,7 +659,7 @@ void LayoutMenu(HWND hWnd)
        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);
 
@@ -730,7 +729,7 @@ void SetMenuType(HWND hWnd, int type)
        PNHMenuWindow data;
        HWND list, text;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLong(hWnd, GWLP_USERDATA);
 
        data->type = type;
        
@@ -765,7 +764,7 @@ void SetMenuListType(HWND hWnd, int how)
        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;
@@ -808,8 +807,8 @@ void SetMenuListType(HWND hWnd, int 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, 
@@ -842,7 +841,7 @@ void SetMenuListType(HWND hWnd, int how)
                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");
                }
@@ -854,7 +853,7 @@ HWND GetMenuControl(HWND hWnd)
 {
        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);
@@ -874,7 +873,7 @@ BOOL onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
        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));
@@ -922,7 +921,7 @@ BOOL onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
     /* 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];
 
@@ -1119,7 +1118,7 @@ BOOL onListChar(HWND hWnd, HWND hwndList, WORD ch)
        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:
@@ -1436,7 +1435,7 @@ void mswin_menu_window_size (HWND hWnd, LPSIZE sz)
        RECT rt, wrt;
        int extra_cx;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLong(hWnd, GWLP_USERDATA);
        if(data) {
                control = GetMenuControl(hWnd);
 
index 3aa9bd302914856c02cbb4a4955c47da04a340a5..4bae67fbd8316144350e12c7d71e810aef18658c 100644 (file)
@@ -1,5 +1,4 @@
 /* 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. */
 
@@ -161,9 +160,9 @@ LRESULT CALLBACK NHMessageWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
        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: 
@@ -174,7 +173,7 @@ LRESULT CALLBACK NHMessageWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
                PNHMessageWindow data;
                RECT    rt;
        
-               data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+               data = (PNHMessageWindow)GetWindowLong(hWnd, GWLP_USERDATA);
  
         xNewSize = LOWORD(lParam); 
         yNewSize = HIWORD(lParam); 
@@ -239,7 +238,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
        PNHMessageWindow data;
        
-       data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMessageWindow)GetWindowLong(hWnd, GWLP_USERDATA);
        switch( wParam ) {
        case MSNH_MSG_PUTSTR: 
        {
@@ -383,7 +382,7 @@ void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
        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);
@@ -460,7 +459,7 @@ void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
        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);
@@ -571,7 +570,7 @@ void onPaint(HWND hWnd)
        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);
 
@@ -660,7 +659,7 @@ void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
        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);
@@ -674,7 +673,7 @@ void mswin_message_window_size (HWND hWnd, LPSIZE sz)
        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 -- */
@@ -715,7 +714,7 @@ BOOL can_append_text(HWND hWnd, int attr, const char* text )
        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;
@@ -766,7 +765,7 @@ BOOL more_prompt_check(HWND hWnd)
        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 */
index 95c97de3fe5b3fe15d6e983bda358242ab44a8c6..2955aaa60c92523bf248b2c53d66ca969c6afef8 100644 (file)
@@ -1,5 +1,4 @@
 /* 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. */
 
@@ -28,7 +27,7 @@ typedef struct mswin_nethack_text_window {
        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 () {
@@ -47,7 +46,7 @@ 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;
 }
 
@@ -63,7 +62,7 @@ void mswin_display_RIP_window (HWND hWnd)
        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);
@@ -118,12 +117,12 @@ void mswin_display_RIP_window (HWND hWnd)
        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:
@@ -218,7 +217,7 @@ BOOL CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
                        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;
 
@@ -230,7 +229,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
        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;
index 1acab82ebc7907cd17d1fdce82ac3c0a16954549..63ec10d889a20d9666dbaf07a92abb822f4e808b 100644 (file)
@@ -15,7 +15,7 @@
 
 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
@@ -176,7 +176,7 @@ void mswin_display_splash_window (BOOL show_ver)
        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)
index 1d03431f545ae1a7061abf81a23434519f854e43..2398808c54efc5a64082f5dc530e2057429b417f 100644 (file)
@@ -1,5 +1,4 @@
 /* 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. */
 
@@ -64,7 +63,7 @@ HWND mswin_init_status_window () {
        if( !data ) panic("out of memory");
 
        ZeroMemory(data, sizeof(NHStatusWindow));
-       SetWindowLong(ret, GWL_USERDATA, (LONG)data);
+       SetWindowLongPtr(ret, GWLP_USERDATA, (LONG)data);
        return ret;
 }
 
@@ -96,7 +95,7 @@ LRESULT CALLBACK StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
        HDC hdc;
        PNHStatusWindow data;
        
-       data = (PNHStatusWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHStatusWindow)GetWindowLong(hWnd, GWLP_USERDATA);
        switch (message) 
        {
        case WM_MSNH_COMMAND: {
@@ -174,7 +173,7 @@ LRESULT CALLBACK StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
 
        case WM_DESTROY:
                free(data);
-               SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+               SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG)0);
                break;
 
        case WM_SETFOCUS:
@@ -198,7 +197,7 @@ void mswin_status_window_size (HWND hWnd, LPSIZE sz)
        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));
index f7cbf1b50f68ea346d836ef6d5b01d5bd9872c24..e3b60140fcf7bc8d1bf81a1aad47f1d968480d4e 100644 (file)
@@ -1,5 +1,4 @@
 /* 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. */
 
@@ -19,7 +18,7 @@ static WNDPROC  editControlWndProc = 0;
 #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);
@@ -56,7 +55,7 @@ HWND mswin_init_text_window () {
                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);
        }
 
@@ -64,7 +63,7 @@ HWND mswin_init_text_window () {
        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;
 }
 
@@ -72,7 +71,7 @@ void mswin_display_text_window (HWND hWnd)
 {
        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);
@@ -84,14 +83,14 @@ void mswin_display_text_window (HWND hWnd)
        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:
@@ -106,8 +105,8 @@ BOOL CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
                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);
 
@@ -180,7 +179,7 @@ BOOL CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
                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;
 
@@ -192,7 +191,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
        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;
index d88d34015c9962f9de132d97b596473fc3c84493..11929ac208bea0cf539317320be7b252e27de383 100644 (file)
@@ -2487,17 +2487,17 @@ static void mswin_color_from_string(char *colorstring, HBRUSH* brushptr, COLORRE
        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 {