Thread: Forcing a window as selected

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    100

    Forcing a window as selected

    Code:
    ShowWindow(hWnd, SW_SHOW);
    				SetForegroundWindow(GetConsoleWindow()); 
    				
    				keybd_event(VK_MENU, 0x38,  0, 0);
    				keybd_event(VK_RETURN, 0x1c,0,0);
    				keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
    				keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
    In my code you can see that my window was hidden and not slected as the main window, but I need it to go fullscreen... soI set it as the forground window and for an alt-enter.

    But when the window is in the forground, it doesnt mean it is actualy selected.

    How can I make it selected so t can go fullscreen?

    Thanks

  2. #2
    Registered User
    Join Date
    May 2002
    Posts
    100
    I figured it out myself... if anyone else runs into this from the search function or whatever, the way I did it was.

    Code:
    SetForegroundWindow(GetConsoleWindow()); 
    
    				HANDLE hOut;
    				CONSOLE_SCREEN_BUFFER_INFO SBInfo;
    				SMALL_RECT DisplayArea = {0, 0, 0, 0};
    
    				hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    
    				GetConsoleScreenBufferInfo(hOut,
    					&SBInfo);
    
    				int x = SBInfo.srWindow.Right;
    				int y = SBInfo.srWindow.Bottom;
    
    				mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, NULL);
    				keybd_event(VK_MENU, 0x38,  0, 0);
    				keybd_event(VK_RETURN, 0x1c,0,0);
    				keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
    				keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);


    I basicly just got the coords of the bottom right, set the window in forground, and moved the mouse pos to the botom right of the console and forced a click... then forced an alt+enter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM