Thread: Really activate window on Win98

  1. #1
    Registered User vn1's Avatar
    Join Date
    Jun 2002
    Posts
    13

    Really activate window on Win98

    I inserted all known commands for activating dialog box, but it appears greyed (non-activated) on Win98 - user still must click the mouse to reach window. Therefore on W2K dialog behaves OK.
    Code:
    <Resource script:>
    DIALOG DISCARDABLE  STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
    ...
    <WINAPI WinMain:>
    DialogBox( GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_START), NULL, StartProc);
    ...
    BOOL CALLBACK StartProc(HWND hstart, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    	switch(Message)
    	{
    	case WM_INITDIALOG:
    		SetWindowPos((struct HWND__ *)hstart, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
    		SetActiveWindow(hstart);
    		SetForegroundWindow(hstart);
    	break;
    ...
    Is this problem related with my actions before DialogBox? But I really have no owner window - need to start with DialogBox. Anyone uses this technique?
    Vaidotas.Vilnius.lt

  2. #2
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    Have you tried to use just setactivewindow? Try combinations of either one, both, or both in diff orders...I'm at school and can't compile anything to check, but as far as I know that code is correct.
    PHP and XML
    Let's talk about SAX

  3. #3
    Registered User vn1's Avatar
    Join Date
    Jun 2002
    Posts
    13

    refresh desktop

    To Waldo2k2: thnkx, you helped.
    Yes, it's not necessary to use so many functions.

    Another back issue on Win98SE: desktop / background window after closing dialog remains not refreshed. What I should add to my ending code?
    Code:
    switch(Message)
    {
    	case WM_COMMAND:
    		switch(LOWORD(wParam))
    		{
    			case IDCANCEL:
    				EndDialog(hinfo, IDCANCEL);
    			break;
    		}
    	break;
    	return TRUE;
    	default:
    		return FALSE;
    }
    return TRUE;
    Vaidotas.Vilnius.lt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM