|
-
January 26th, 2013, 01:36 AM
#2
Re: starter app not responding
 Originally Posted by pavankn18
The following code results in simple window which stops responding as soon as it is executed.
i really have no idea what is happening, i am just starting visual c++
1) Please use code tags when posting code. The code you posted is almost unreadable.
2) You should take working examples before trying to code a Windows application yourself.
Code:
LRESULT CALLBACK windowprocess (HWND hwindow, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwindow, &ps);
FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW+1));
EndPaint(hwindow, &ps);
}
break;
//??? So what does WM_PAINT return??
}
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
Return value
An application returns zero if it processes this message.
You are returning an unknown value back to the OS.
In general, whenever you process a message, you must return what is documented that you return for the particular message. Don't guess, don't leave the return empty, etc. You are to return 0 if you process the WM_PAINT message.
3)
Code:
#ifndef UNICODE
#define UNICODE
#endif
Why are you doing this? The build settings already have these preprocessor constants defined for you.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; January 26th, 2013 at 01:42 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|