Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win32 & MFC window handles again

Status
Not open for further replies.

BM

Programmer
Apr 26, 2000
27
GB
Hi Pete,
My piece of global code is using the HWND normally passed to WinProc; it uses it to perform a SetWindowLong for a structure.
When I pass the result of AfxGetMainWnd to the code it crashes, am I using the wrong routine to get the HWND?
The application is SDI.

Thanks

Barry
 
> My piece of global code is using

global code

That is likely your problem. I personally despise global code. That said, it is very likely your 'global' code is running before any of the window creation routines have run and therefore the HWND and CWnd's are invalid (un-initialized or zero memory).

Of course without seeing the neccassary code this is just a guess.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top