Thread: Problems processing WM_NCCREATE

  1. #1
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630

    Problems processing WM_NCCREATE

    Ok, im not really having problems processing the WM_NCCREATE message, but if i trap it instead of WM_CREATE my window is created without a title. Is there some reason for it? I didnt change anything but WM_NCCREATE to WM_CREATE and now the window has a title again, but if i change it back to WM_NCCREATE there is no title. Any suggestions?
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    If you let the WM_NCCREATE handler fall through to DefWindowProc() you should get the title back.

  3. #3
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Well isnt that a bad idea? Because according to MSDN you should return TRUE if your application handles the WM_NCCREATE message, so wouldnt letting it fall through to DefWindowProc be bad?
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    >>because according to MSDN you should return TRUE if your application handles the WM_NCCREATE message, so wouldnt letting it fall through to DefWindowProc be bad?

    I would say that you are not handling the default actions of the handler for WM_NCCREATE.......

    Code:
    case WM_NCCREATE: 
    	lpCreateStruct = (LPCREATESTRUCT) lParam;
                SetWindowText(hwnd,lpCreateStruct->lpszName);
    	return TRUE;
    I see your problem and so tried coding the above.....

    Now with this code, the window name will appear...I must warn you though that I am not sure if any other tasks are performed by the default handler for this message......therefore it may develop a few bugs.....try it though

  5. #5
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    So, should I just do what Sorensen suggested and just let it go to the DefWndProc after I get what I need done?
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  6. #6
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Unless you're trapping it to specifically stop it from being handled by DefWndProc() because you want to change the default behavior, I don't see any problem with letting it fall through. If you hadn't included a handler it'd be sent there anyway.

  7. #7
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    No, im just stopping it to grap my this pointer and throw it into the window's user data using SetWindowLong(hWnd, GWL_USERDATA, (LONG)lpcs->lpCreateParams). nothing less nothing more, so I just returned defwindowproc and now it works, thanx guys.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reentrant Message Processing (WndProc)
    By phantomotap in forum Windows Programming
    Replies: 7
    Last Post: 04-28-2009, 10:44 AM
  2. Replies: 7
    Last Post: 04-27-2009, 05:56 PM
  3. What types of files can C++ file processing handle?
    By darsunt in forum C++ Programming
    Replies: 9
    Last Post: 10-28-2008, 11:33 AM
  4. Sub Array Processing
    By GCNDoug in forum C++ Programming
    Replies: 8
    Last Post: 11-28-2007, 04:41 PM
  5. file writing crashes
    By test in forum C Programming
    Replies: 25
    Last Post: 08-13-2002, 08:44 AM