Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3996396
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:16:28+00:00 2026-05-20T07:16:28+00:00

I created win32 wrapper before but I lost the files… So I’m gonna creating

  • 0

I created win32 wrapper before but I lost the files… So I’m gonna creating them again. The problem is with my router(static window processor).
Here is my code

CFramework *wnd = 0; 

// retrieve associated Window instance 
wnd = reinterpret_cast<CFramework *>(::GetWindowLongPtr(hWnd, GWL_USERDATA)); 

// call the windows message handler 
wnd->WndProc(hWnd, msg, wParam, lParam);

return true;

When I call GetWindowLongPtr it won’t retrieves the user data.
UPDATE:
I also tired this code that uses SetWindowLongPtr

if ( msg == WM_CREATE ) 
   { 
       SetWindowLongPtr( hWnd, GWLP_USERDATA, (LONG)((CREATESTRUCT *)lParam)->lpCreateParams ); 
   } 

   Window *targetApp = (Window*)GetWindowLongPtr( hWnd, GWLP_USERDATA ); 

   if ( targetApp ) 
   { 
       return targetApp->WndProc( hWnd, msg, wParam, lParam ); 
   } 

   return DefWindowProc( hWnd, msg, wParam, lParam ); 

I used my second code.^^^^
I put break point at SetWindow…
It seems it never Get called!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:16:28+00:00Added an answer on May 20, 2026 at 7:16 am

    Your window may receive some messages before WM_CREATE. I did something like this a while ago, and there were sizing and positioning messages, along with WM_NCCREATE, that arrived before the WM_CREATE. So you shouldn’t expect to see the value there on those messages.

    Are you compiling for 32-bit or 64-bit? If 64-bit, then the cast to LONG may be whacking your pointer.

    And, as Rup said in the comments, you have to be really certain that nobody else is using WM_USERDATA.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting out with win32 programming. I created my first dialog but I can't
i have created a win32 window it work fine but im tryin to get
I am working on an application/GUI created with Win32/ATL . So there is UI
there'are these lines in the sample Win32 app created default by VS. Can you
Using Visual Studio 2008, I created a C++ Win32 project. To release the program,
I have created a minidump using win32 api [DllImport(DbgHelp.dll, SetLastError = true)] private static
I created win32 console application in vs2010 (without select the option of precompiled header).
I have a value created by the win32 api function ChooseColor and I want
I have a dynamically created toolbar on a plain Win32 dialog. My buttons are
I am building a Win32 C++ project on VS2008 SP1. In created .manifest file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.