Skip to main content
gamedev.net
🔒 Locked

Program without default WinProc?

Started by streamer 3 replies 750+ views
Original Post
streamer
streamer
Hello all. Is it possible to create a window in win32 without windowprocedure?

    winClass.lpszClassName = "MY_WINDOWS_CLASS";
    winClass.cbSize        = sizeof(WNDCLASSEX);
    winClass.style         = CS_HREDRAW | CS_VREDRAW;
 
// I don't need this   
winClass.lpfnWndProc   = MsgProc;

    winClass.hInstance     = g_hInstance;
    winClass.hIcon         = LoadIcon(g_hInstance, (LPCTSTR)IDI_ICON);
    winClass.hIconSm       = LoadIcon(g_hInstance, (LPCTSTR)IDI_ICON);
    winClass.hCursor       = LoadCursor(NULL, IDC_ARROW);
    winClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
    winClass.lpszMenuName  = NULL;
    winClass.cbClsExtra    = 0;
    winClass.cbWndExtra    = 0;

    if( !RegisterClassEx(&winClass) )
        return false;

    g_hWnd = CreateWindowEx( NULL, "MY_WINDOWS_CLASS", 
                             "Myprg",
                             WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                             0, 0, 640, scrHe480ight, NULL, NULL, g_hInstance, NULL );



Everything works fine, and there is a empty winproc in program, but I'm just curious is it possible (and it is a little bit anoying that there is a procedure in program that do nothing [smile]). I tried to pass 0 parameter, but program report error. Any idea?
ApochPiQ
ApochPiQ
No, it is not possible to totally remove window procedures. At the very, very least, you need to have a short WndProc that passes everything to DefWindowProc.
streamer
streamer
Quote:
Original post by ApochPiQ
No, it is not possible to totally remove window procedures. At the very, very least, you need to have a short WndProc that passes everything to DefWindowProc.


Thank you. I have a 'short WndProc that passes everything to DefWindowProc.' already so this seems to be the only way [sad]
streamer
streamer
That sounds reasnoable. I'll try that.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.