MoveWindow Exception in x64 but not in x86

I have a program that builds and runs fine under Visual Studio 2010 on Windows Server 2008 (32 bit). However, when I compile it for 64 bit, it fails on MoveWindow(). Here's a snippet of the code:

      // Set the size
      if(iWinTop < 0)
   = 0;
   = iWinTop;

      if(iWinLeft < 0)
            rectWindow.left = 0;
            rectWindow.left = iWinLeft;

      if(iWinBottom < 0)
            rectWindow.bottom += iWinTop;
            rectWindow.bottom = iWinBottom;

      if(iWinRight < 0)
            rectWindow.right  += iWinLeft;
            rectWindow.right = iWinRight;

      // Place the window
      MoveWindow(&rectWindow, TRUE);

The error that is returned is:
"Unhandled exception at 0x3fac6760 in Myprog.exe 0xC000041D: An unhandled exception was encountered during a user callback."
Who is Participating?
Somewhere I read that, "adding the linker setting: /SECTION:.rsrc,rw" will resolve the problem.
Can you also try it and see if that solves your problem?
If your problem is not solved with the above suggestions, try to disable hardware acceleration in Visual Studio. You can look at this page regarding how to do that:

Also, somebody has seen that the problem occurs when Aero effects are turned on. Try to turn off Aero effects and check.
goondoo27Author Commented:
ssnkumar, thanks for all of the suggestions. It turns out that the problem was in a call back function:


In this function I was using the routine PtrToLong(SizingProc) which was stripping the upper 32 bits from the 64 bit handle. Instead of that routine I used: reinterpret_cast<LONG_PTR>(SizigProc), and it works great on both 32 bit and 64 bit OSs.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.