Thread: WM_PAINT through DefWindowProc

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    161

    WM_PAINT through DefWindowProc

    When the WM_PAINT messages is passed through the DefWindowProc of my child window, The child window closes. I can't draw on the window my self! Any Idea's what the problem could be?

    Thanx in advance!

  2. #2
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    after using some messageboxes I have found out that my child window resieves infinite number of WM_PAINT messages.

    I don't know if I created the window correctly but I think I did. I have a window at the top lwith the minimize etc.. And it has a child window in that child window there is another childwindow. This childwindow is the one that gets infinit of wm_PAINT messages.

    Any Idea's will be greatly apreciated.

    Thanx in advance!

  3. #3
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Post some code.

  4. #4
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    I created a dll. If I create windows from the dll it doesn't work. But I took all of it and transfered it all to an exe project. Now it works.

    Can a dll create a window? If so what changes should I make?

    Thanx in advance!

  5. #5
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    ok heres code
    This is for the first child window:
    .classex is the wndclassex which gets registered after and class.dwstyle and class.exstyle are for the createwindowex parameters. I spend a while clearing only the inrevelent:

    Code:
    Class.ClassEx.cbSize              = sizeof(WNDCLASSEX);
    Class.ClassEx.hInstance           = g_ins; 
    #ifdef _UNICODE
    Class.ClassEx.lpszClassName       = L"CodeCTRLBASE";
    #else
    Class.ClassEx.lpszClassName       = "CodeCTRLBASE";
    #endif
    Class.ClassEx.hbrBackground       = NULL;
    Class.ExStyle                     = 0;
    Class.dwStyle                     = WS_BORDER|WS_CHILD |WS_VISIBLE|WS_CLIPCHILDREN;
    Class.ClassEx.cbWndExtra          = 0;
    Class.ClassEx.cbClsExtra          = 0;
    Class.ClassEx.hIconSm             = 0;
    Class.ClassEx.lpszMenuName        = NULL;
    Class.ClassEx.style               = CS_DBLCLKS;
    Class.ClassEx.lpfnWndProc         = &BasicProc;
    Class.ClassEx.hIcon               = NULL;
    Class.ClassEx.hCursor             = 0;
    This next piece is for the child window inside the child window above.

    Code:
    memset(&Class,0, sizeof(CodeClass));
    Class.ClassEx.cbSize              = sizeof(WNDCLASSEX);
    Class.ClassEx.hInstance           = g_ins;
    Class.ClassEx.hbrBackground       = 0; 
    Class.ExStyle                     = 0;
    Class.ClassEx.hCursor             = LoadCursor(NULL, RESOURCE(IDC_ARROW)); 
    Class.ClassEx.cbWndExtra          = 0;
    Class.ClassEx.cbClsExtra          = 0;
    Class.ClassEx.hIconSm             = 0;
    Class.ClassEx.lpszMenuName        = NULL;
    Class.ClassEx.style               = CS_DBLCLKS;
    Class.ClassEx.lpfnWndProc         = &BasicProc;
    Class.ClassEx.hIcon               = NULL;
    Class.ClassEx.lpfnWndProc	  = CodePROC;
    Class.ClassEx.hbrBackground       = 0;
    #ifdef _UNICODE
    Class.ClassEx.lpszClassName	  = L"CodeCTRLFRONT";
    #else
    Class.ClassEx.lpszClassName	  = "CodeCTRLFRONT";
    #endif
    Class.dwStyle                     = WS_CHILD| WS_VISIBLE | WS_VSCROLL | WS_HSCROLL;
    Class.ClassEx.cbSize = sizeof(WNDCLASSEX);
    I did my best in clearing whats not relevent to the creation of the window. Any help would be greatly apreciated.
    EDIT:
    I found out that bitblt or setpixel or other image api's don't work. But the only api that works is TextOut.

    Thanx in advance!
    Last edited by Benzakhar; 03-07-2004 at 09:15 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DefWindowProc
    By kidburla in forum Windows Programming
    Replies: 12
    Last Post: 09-19-2006, 12:13 PM