Thread: Windows Using Win32 API With M$ VC++

  1. #1
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80

    Windows Using Win32 API With M$ VC++

    Is There any special DWORDS missing from the MSDN library that would enable me to display a maximised window that has no titlebar and overlaps the start bar, I have found nothing as to date that i can use in the DWEXSTYLE bit of the CreateWindowEX API call any help would be great;
    THanx

  2. #2
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    Don't think there's anything missing. Try the following params:

    dwStyle : WS_MAXIMIZE & WS_VISIBLE
    (Do not include WS_SYSMENU or WX_CAPTION)

    Include
    dwStyleEx : WS_EX_TOPMOST

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Do you mean to cover the whole screen?

    Code:
    #include <windows.h>
    
    LRESULT CALLBACK WndProc(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam);
    
    int WINAPI WinMain( HINSTANCE hInst,
    					HINSTANCE hPreInst,
    					LPSTR lpszCmdLine,
    					int nCmdShow )
    {
    	HWND    hwnd;    
    	MSG     Msg;   
    	TCHAR   *szClassName = TEXT("SIMPLEWND");
    	WNDCLASSEX wcx = {0};    
    	
    	wcx.cbSize			 = sizeof(WNDCLASSEX);
    	wcx.style            = CS_HREDRAW | CS_VREDRAW;          
    	wcx.lpfnWndProc      = (WNDPROC)WndProc;               
    	wcx.hInstance        = hInst;                      
    	wcx.hIcon            = LoadIcon(NULL,IDI_APPLICATION);                         
    	wcx.hCursor          = LoadCursor(NULL,IDC_ARROW);                         
    	wcx.hbrBackground    = (HBRUSH)GetStockObject(BLACK_BRUSH);      
    	wcx.lpszClassName    = szClassName;                    
                             
    	if (!RegisterClassEx(&wcx)){
        	return 1;
        }
    
    	hwnd=CreateWindowEx(WS_EX_TOPMOST,                               
    	                    szClassName,                      
    	                    TEXT(""),            
    	                    WS_POPUP | WS_VISIBLE,                
    	                    0,   
    	                    0,   
    	                    GetSystemMetrics(SM_CXSCREEN),   
    	                    GetSystemMetrics(SM_CYSCREEN),    
    	                    NULL,                               
    	                    NULL,                               
    	                    hInst,                       
    	                    NULL);                              
    	
    	ShowWindow(hwnd,nCmdShow);
    	UpdateWindow(hwnd);
    	
    	while (GetMessage(&Msg,NULL,0,0)>0){
    	    TranslateMessage(&Msg);
    	    DispatchMessage(&Msg);
        }
    	return Msg.wParam;
    }
    
    LRESULT CALLBACK WndProc(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam)
    {
    	switch (Message){
    		case WM_KEYDOWN:
    			if(wParam != VK_ESCAPE){//Press escpae to quit
    				PostQuitMessage(0);  
    				return 0;
    			}
    	    case WM_DESTROY:
    	        PostQuitMessage(0);  
    	        return 0;
    	    default:
    	        return DefWindowProc(hwnd,Message,wParam,lParam); 
        }
    }

  4. #4
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80
    thanx for the help the one i needed was the EX style topmost i checked the MSDN library and its thr aswell i must have overlooked it lol. neway thanx!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 01-01-2007, 07:36 AM
  2. Win32 API , Windows XP Button styles
    By Rare177 in forum Windows Programming
    Replies: 12
    Last Post: 06-28-2006, 05:28 PM
  3. Programming Windows API in C++
    By JoshR in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2005, 05:40 AM
  4. Does C++ knowledge come into Win32 API?
    By Flucas in forum Windows Programming
    Replies: 10
    Last Post: 10-26-2001, 10:17 AM
  5. Learn Win32 API or C++Builder?
    By Flucas in forum Windows Programming
    Replies: 1
    Last Post: 10-18-2001, 01:49 AM