Thread: What you should know about WM_CREATE

  1. #1
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318

    What you should know about WM_CREATE

    Handling some things in WM_CREATE can cause undesirable results. Because if you pass the window handle to somewhere, it may fail because the window is not created yet. One good example, what can happen is there:
    http://cboard.cprogramming.com/showthread.php?t=79130
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    No. You used a global HWND, and tried to use it in createtask before createwindow returned to assign that window handle. That's your fault. If you used the hwnd passed to the window procedure, it would work.

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Maybe yes, uninitialized too...

    Once I had a problem with WM_CREATE when I was comparing some window handles when CreateWindowEx hadn't returned yet...
    http://cboard.cprogramming.com/showthread.php?p=501964
    Last edited by maxorator; 09-25-2006 at 05:26 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    That still doesn't justify your assertion. Most people are aware that WM_CREATE is one of a small number of messages issued during system processing of CreateWindowEx but the window handle passed to the window procedure is nonetheless valid for that window and for all other messages for that window.

    Any problems you may have encountered with the use of such handles is almost certainly of your own making.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    From a system design perspective, what point would there be in calling a window procedure function when no window instance exists?

    I can practically guarantee that at no time will Windows call a window procedure without supplying a window handle to use it with.

Popular pages Recent additions subscribe to a feed