Sign in to follow this  
mike74

DialogBox

Recommended Posts

i'm making a game. it's at http://www.coolgroups.com/rr2beta/. when someone runs the game and hits M, it's supposed to pop up a mouse config dialog. it does so on my home PC but not at the library. both systems are windows xp. any ideas why this would be? here's some code: BOOL CALLBACK MouseSensitivityProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { HWND sliderhwnd = GetDlgItem(hwndDlg, 203); SendMessage( // returns LRESULT in lResult (HWND) sliderhwnd, // handle to destination control (UINT) TBM_SETRANGE, // message ID (WPARAM) TRUE, // = (WPARAM) (BOOL) fRedraw (LPARAM)MAKELONG (1, 11) // = (LPARAM) MAKELONG (lMinimum, lMaximum) ); SendMessage( (HWND) sliderhwnd, (UINT) TBM_SETTICFREQ, (WPARAM) 1, (LPARAM) 0 ); SendMessage((HWND) sliderhwnd, (UINT) TBM_SETPOS, (WPARAM) TRUE, (LPARAM) mousesensitivity ); return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: case 207: { HWND sliderhwnd = GetDlgItem(hwndDlg, 203); mousesensitivity = SendMessage((HWND) sliderhwnd, (UINT) TBM_GETPOS, 0, 0); EndDialog(hwndDlg, 10); } return TRUE; case 210: EndDialog(hwndDlg, 2); return TRUE; } } return FALSE; } ... case 'M': { themouse->unacquire(); gamestatetype oldgamestate = gamestate; gamestate = MOUSECONFIG; ShowCursor(TRUE); DialogBox( GetModuleHandle(NULL), MAKEINTRESOURCE(200), hWnd, MouseSensitivityProc); ShowCursor(FALSE); gamestate = oldgamestate; themouse->acquire(); return 0; }

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
older versions of Windows do not register all of the common controls, of which the slider control is one. so make sure to call InitCommonControls or InitCommonControlsEx prior to the DialogBox call

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this