Results 1 to 7 of 7

Thread: &^%$@@!&%$@, fik dich, help [resolved thanks]

Threaded View

  1. #1

    Thread Starter
    Addicted Member ZanM's Avatar
    Join Date
    Oct 1999
    Location
    The here and now.
    Posts
    191

    Red face &^%$@@!&%$@, fik dich, help [resolved thanks]

    ok win32

    i am trying to make a window with no title bar and maximize it so i can draw on it and bitblt with the gdi but i can't get rid of the title bar also i want to leave the application if the window is dblclked and that doesn't seem to want to work

    i have read and reread the msdn on WM_KEYDOWN & WM_SYSKEYDOWN & WM_*BUTTON* .... help

    Code:
    #include <string.h>
    #include <windows.h>
    
    /* ---------------------------	 *** Function Prototypes ***   -------------------------------- */
    
    int WINAPI WinMain(
      HINSTANCE hInstance,      // handle to current instance
      HINSTANCE hPrevInstance,  // handle to previous instance
      LPSTR lpCmdLine,          // command line
      int nCmdShow              // show state
    );
    
    BOOL initBoard(
    	HINSTANCE hInstance		// hInstance of the application
    );
    
    BOOL createBoard(
    	HINSTANCE hInstance,	// hInstance of the application
    	int nCmdShow			// show state
    );
    
    LRESULT CALLBACK wndProc(
      HWND hwnd,      // handle to window
      UINT uMsg,      // message identifier
      WPARAM wParam,  // first message parameter
      LPARAM lParam   // second message parameter
    );
    
    /* ------------------------------------------------------------------------------------------ */
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    				   LPSTR lpCmdLine, int nCmdShow){
    
    	MSG wMsg;
    	BOOL bRet;
    
    	bRet = initBoard(hInstance);	// intialize rBoard001 class
    	
    	/* Check to see that class intialized properly */
    	if(bRet == false){
    		return 0;		// if it did not end application
    	}else{				
    		bRet = createBoard(hInstance, nCmdShow);	/* if class intialized attempt to create an instance
    			if the lass fails to create exit application */
    		if(bRet == false){
    			return 0;
    		}
    	}
    	
    	// Setup Msg loop
    	while(GetMessage(&wMsg, NULL, 0, 0)){
    		TranslateMessage(&wMsg);
    		DispatchMessage( &wMsg );
    	}
    
    	return wMsg.wParam;
    	
    } // End WinMain(); 
    
    
    
    
    BOOL initBoard(HINSTANCE hInstance){
        
    	WNDCLASSEX mCls; 
    	HBRUSH hBrush;
    
    	hBrush = CreateSolidBrush(RGB(0,0,0));
    
        // Fill in the window class structure with parameters 
        // that describe the main window. 
    	mCls.cbSize = sizeof(mCls);
        mCls.style = NULL;								// redraw if size changes 
        mCls.lpfnWndProc = wndProc;											// points to window procedure 
        mCls.cbClsExtra = 0;												// no extra class memory 
        mCls.cbWndExtra = 0;												// no extra window memory 
        mCls.hInstance = hInstance;											// handle to instance 
        mCls.hIcon = NULL;				// predefined app. icon 
        mCls.hCursor = NULL;							// predefined arrow 
        mCls.hbrBackground = hBrush;										// default background color 
        mCls.lpszMenuName =  0;												// no menu resource 
        mCls.lpszClassName = "rBoard001";									// name of window class 
    	mCls.hIconSm = NULL;			// load the title bar icon
        // Register the window class. 
     
        return RegisterClassEx(&mCls); 
    } // End initBoard(); 
    
    
    
    
    
    BOOL createBoard(HINSTANCE hInstance, int nCmdShow){
    	
    	HWND hWnd; 
        // Create the main window. 
     
        hWnd = CreateWindowEx(
    		WS_EX_TOPMOST| WS_EX_LEFT,
            "rBoard001",														// name of window class 
            NULL,            // title-bar string 
            WS_DLGFRAME  ,												// top-level window 
            CW_USEDEFAULT,														// default horizontal position 
            CW_USEDEFAULT,														// default vertical position 
            CW_USEDEFAULT,																// default width 
            CW_USEDEFAULT,															// default height 
            (HWND) NULL,														// no owner window 
            (HMENU) NULL,														// use class menu 
            hInstance,															// handle to application instance 
            (LPVOID) NULL);														// no window-creation data 
     
        if (!hWnd) 
            return false; 
    
        // Show the window and send a WM_PAINT message to the window 
        // procedure. 
        ShowWindow(hWnd, SW_SHOW|SW_MAXIMIZE);
    	UpdateWindow(hWnd); 
        return true;
    } // End createBoard();
    
    
    
    
    
    
    LRESULT CALLBACK wndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
    
    	switch(uMsg){
    	case WM_KEYDOWN:
    	case WM_SYSKEYDOWN:
    		return 0;
    	case WM_RBUTTONDBLCLK:
    		DestroyWindow(hwnd);
    	case WM_DESTROY:
             PostQuitMessage(0);
             break;
    	default:	// If I don't use it let windows handle it
    		return DefWindowProc(hwnd,uMsg,wParam,lParam);
    	}
    	return 0;
    }
    Last edited by ZanM; Dec 5th, 2001 at 12:41 PM.
    Magiaus
    Visual Basic 6.0 SP5
    Visual C++ 6.0 SP5


    The only sovereign you can allow to rule you is reason.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width