This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Strange CreateWindow behaviour in emulator


Strange CreateWindow behaviour in emulator

Postby superman » Mar 13, 2003 @ 8:21am

I was having some trouble testing some code in the emulator that worked well on my E-200, so I decided to track down the problem. After an hour or so of hunting, I finally got it down to a problem registering the window class.

Here is the scenario: I have a class wrapper for a window. In that class wrapper are funtions to register and create the window, as well as a static wndproc. On creation, I use setwindowlong to put a pointer to the specific class in its windows GWL_USERDATA. Then, in the wndproc, I get the GWL_USERDATA, cast it as a pointer to my class, and send the messages through to another function in the class that isn't shared.

I had two separate projects that I was using to play around with this. The first time I tried it, it worked great on both the emulator and the PPC. The second time I tried it, I found that I had to register the window class with a NULL wndproc and then use setwindowlong to set the GWL_WNDPROC to point to my static wndproc after I had created the window.

Every time I tried to create a window with the wndproc set when I registered the class, the program would kill itself when I called createwindow. It doesn't do this in the first project.

I have no idea what could be happening. Thoughts?
"Kittens give Morbo gas." - Morbo the News Monster
User avatar
superman
pm Member
 
Posts: 99
Joined: Nov 3, 2001 @ 1:09am


Postby Orpe » Mar 13, 2003 @ 8:14pm

User avatar
Orpe
pm Member
 
Posts: 78
Joined: Sep 16, 2001 @ 6:51pm
Location: Stockholm, Sweden


Postby superman » Mar 13, 2003 @ 10:28pm

Thanks, that works perfectly. I don't know why I didn't realize that CreateWindow would send WM_CREATE to my wndproc. Thanks again.
"Kittens give Morbo gas." - Morbo the News Monster
User avatar
superman
pm Member
 
Posts: 99
Joined: Nov 3, 2001 @ 1:09am


Postby Orpe » Mar 13, 2003 @ 11:34pm

User avatar
Orpe
pm Member
 
Posts: 78
Joined: Sep 16, 2001 @ 6:51pm
Location: Stockholm, Sweden


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron