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 4007158
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:35:58+00:00 2026-05-20T08:35:58+00:00

I am having trouble using CreateWindowEx . If I set the final parameter (LPVOID

  • 0

I am having trouble using CreateWindowEx. If I set the final parameter (LPVOID lpParam) to NULL and use the returned window handle in a call to ShowWindow, the window displays everything fine. However, I need to pass in a pointer to the class that I will be modifying based off of some of the operating system messages that I intercept. When I try to do that, by specifying the lpParam as this, my returned handle is apparently garbage because passing it into ShowWindow causes: “An unhandled exception was encountered during a user callback.”

I have no idea how to debug this, so I am stuck.

The address that is pointed to remains the same between passing it in and pulling it back out.

I did not define a WM_PAINT case.

WM_CREATE handler:

case WM_CREATE:
{

            // get screen resolution
            HWND desktop = GetDesktopWindow();
            RECT R;
            GetWindowRect(desktop, &R);
            int width = R.right - R.left;
            int height = R.bottom - R.top;

            HWND loading_image;
            loading_image = CreateWindowEx(0,L"Static",L"Image", SS_CENTERIMAGE | SS_BITMAP | WS_CHILD | WS_VISIBLE,0,0,width,height,hwnd,(HMENU)ID_IMAGE3,g_hInst,NULL); 
            SetClassLong(loading_image,GCL_STYLE,CS_HREDRAW | CS_VREDRAW);
            HBITMAP bitmap = (HBITMAP)LoadImage(NULL,L"loadingscreen.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
            SendMessage(loading_image,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)bitmap);

            progressbar = CreateWindowEx(0, PROGRESS_CLASS, (LPTSTR)NULL, WS_CHILD | PBS_SMOOTH | WS_VISIBLE, width/2-400,100,800,20,hwnd,(HMENU)0,g_hInst,NULL);
            SendMessage(progressbar,PBM_SETSTEP,20,NULL);

            CREATESTRUCT* cs = (CREATESTRUCT*)lParam;
            app = (D3DApp*)cs->lpCreateParams;
            return 0;
}

The WindowProc call goes bad on a 70 msg (WM_WINDOWPOSCHANGING). It doesn’t go bad on prior messages: WM_NCCALCSIZE, WM_CREATE, WM_PARENTNOTIFY, WM_SIZE, WM_SIZE, or WM_SHOWWINDOW, although WM_SHOWWINDOW is handled just before WM_WINDOWPOSCHANGING, so I’m guessing WM_WINDOWPOSCHANGING is just a result of WM_SHOWWINDOW getting passed.

  • 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-20T08:35:58+00:00Added an answer on May 20, 2026 at 8:35 am

    Put a breakpoint on CreateWindowEx. Write down the pointer you’re passing in.

    Put a breakpoint on your WindowProc function. Check that the pointer it extracts from your private window data (that’s where you’re storing the pointer, right?) is the same one passed in. You are using SetProp and GetProp (see topic Window Properties on MSDN) instead of SetWindowLongPtr, right?

    On entry to your WindowProc, print out the message number so you can see which message is being processed when it crashes (you can use a tracepoint for this if your debugger supports them, or add a printf call to your code and recompile.

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

Sidebar

Related Questions

I'm having trouble using os.utime to correctly set the modification time on the mac
I having trouble using a rowtemplate with a detail grid. Basically when I use
I'm having trouble using a select statement to set a return value in a
I am having trouble using the Cloud9 IDE to run files which use bonescript
Anybody having trouble using AVFoundation with GC ON??? What I am experiencing is that
I am having trouble using the //TODO flag. When I put the //TODO comment
I'm having trouble using jQuery.ajax() to post a gist to Github. The gist is
I am having trouble using the ABPersonViewController with RubyMotion. The error I'm getting is
I'm having trouble using Short2 for the (x,y) positions in my vertex data. This
I'm having trouble using python to write strings into a file: (what I'm trying

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.