Jump to content
  • Advertisement
Sign in to follow this  
anonuser

Visual Studio 2005 Oddities.

This topic is 4487 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well I was starting a new project and its just a typical win32 project. I always go empty on settings with no links to MFC or ATL, I set those up by hand if I need them. Well out of laziness I was going to use a Dialog as my window and I had it all designed out and I do the wrap my win32 stuff inside the class thing. so it look something like this // note static is only in the prototype its just her to let you know NOTE: lParam should be a pointer to this. and DlgProc is the internal proc that has full access to a class. I like this method it gives me the entire class inside of all the win32 stuff. Which is great.
static BOOL CALLBACK CWindow::stDlgProc(...) {
    //assume msg is the proper variable
    //assume lParam is the proper variable
    //assume hwnd is the proper variable
    CWindow* pwinThis = NULL;

    if(msg == WM_INITDIALOG) {
         SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG)lParam);
         return TRUE;
    }

   pwinThis = GetWindowLongPtr(hwnd, GWLP_USERDATA);
  
   return pwinThis->DlgProc();
}


Now I didn't think much of this at first cause it did call DlgProc but only out of coincidence. pwinThis is actually NULL, visual studio can dereference it somehow, honestly I have no idea how. It should be throwing unhandled exceptions on dereferencing null but it doesn't until I try to acess this inside of DlgProc which is a private method in the class. The Debugger proved this was null but somehow I was inside of the right method. This was done from memory and should be accurate, but the problem is that the first message is not WM_INITDIALOG, or at least its not being passed to me. It's 48 in decimal but no idea which message that is in hex. Any ideas why or how I wouldn't be getting the WM_INITDIALOG message. My plan is to go back and just do a sandbox child window of my layout and place as a control on a regular window.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!