i'm creating the form class. the form us showed and the window procedure works. the problem is that some messages(like WM_CREATE) aren't working. so how can i connect, correctly the form to window procedure?
cambalinho
125
Practically a Posting Shark
Recommended Answers
Jump to Postuse your debugger and put a breakpoint on WM_CREATE. Since the window hasn't been created yet there can be no message box to show you.
Jump to PostBad code here?
SetProp(hwnd, formpropname, (HANDLE)FormClass.lpfnWndProc); hwnd = CreateWindowEx(0, classname, "The title of my window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, parent, NULL, mod, (LPVOID) this);
HWND isn't assigned when you call
SetProp
. You probably want to create the window before callingSetProp
.The real …
Jump to Post@Cambalinho..
Your errors were:
case WM_NCCREATE: { CREATESTRUCT *p = (CREATESTRUCT *)lParam; inst = (form *)p->lpCreateParams; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)form); //error.. hwnd should be: HandleWindow parameter. (LONG_PTR)form should be: (LONG_PTR)inst.. //The line above should be: SetWindowLongPtr(HandleWindow, GWLP_USERDATA, (LONG_PTR)inst); inst->hwnd = hwnd; //should be: inst->hwnd = HandleWindow; if (inst …
Jump to PostHere is your code.. I modified it to work.. The window will show for 5 seconds and then disappear.
http://pastie.org/private/8aspaldrbai204h8yvpew
And these are the changes made: http://www.diffchecker.com/lm9l4m3y
Jump to Post@Cambalinho: What you did wrong was to not make the changes I told you to make earlier. Might have missed it by accident.
You needed to have:
if (inst->Create != NULL)
.. You should be testing your function pointers forNULL
before calling them. That was the reason for your access …
All 31 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
cambalinho
125
Practically a Posting Shark
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
cambalinho
commented:
thanks
+2
cambalinho
125
Practically a Posting Shark
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
cambalinho
commented:
thanks
+2
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
cambalinho
commented:
thanks
+0
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
cambalinho
125
Practically a Posting Shark
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
triumphost
120
Posting Whiz
cambalinho
commented:
thank you very much
+0
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
cambalinho
commented:
thanks for all... really thanks
+0
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
cambalinho
commented:
thank you very much
+2
cambalinho
125
Practically a Posting Shark
cambalinho
125
Practically a Posting Shark
triumphost
120
Posting Whiz
cambalinho
125
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.