Click here to Skip to main content
16,016,814 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: user login path Pin
fd012900216-May-07 19:18
fd012900216-May-07 19:18 
QuestionWhat is purpose of padding of 2-2 bytes in debug build?? Pin
SandipG 16-May-07 18:14
SandipG 16-May-07 18:14 
AnswerRe: What is purpose of padding of 2-2 bytes in debug build?? Pin
Stephen Hewitt16-May-07 18:33
Stephen Hewitt16-May-07 18:33 
AnswerRe: What is purpose of padding of 2-2 bytes in debug build?? Pin
John R. Shaw16-May-07 22:08
John R. Shaw16-May-07 22:08 
GeneralRe: What is purpose of padding of 2-2 bytes in debug build?? Pin
SandipG 17-May-07 1:01
SandipG 17-May-07 1:01 
GeneralRe: What is purpose of padding of 2-2 bytes in debug build?? Pin
John R. Shaw17-May-07 1:53
John R. Shaw17-May-07 1:53 
Questionhow to control parallel pins using window xp visual C++ ?? HELP PLZZ Pin
*Roxanna*16-May-07 18:12
*Roxanna*16-May-07 18:12 
QuestionAbout PostQuitMessage Function Pin
fd012900216-May-07 16:24
fd012900216-May-07 16:24 
Someone said that PostQuitMessage function does not really send a WM_QUIT message to the message queue of the calling thread. I wonder what does this function exactly do.

//Here is a simple test code
/*If PostQuitMessage function sends a WM_QUIT message to the message queue of the calling thread, GetMessage(..., hwnd, ..., ...) can't get the WM_QUIT message, the application won't leave the message loop.
But in this example:
1.compile the source ;
2.Ctrl+F5 to run it;
3.D&D to move the window;
4.press the corss to close window;
5.found that the application process disappear from the "task manager "
It seems that GetMessage(..., hwnd, ..., ...) got the WM_QUIT message.
Someone said it's because of that PostQuitMessage is called before DestroyWindow.
But I can't get the same result when debugging by F5.
Sorry for my poor English......thanks for your attention.
*/
#include <windows.h>
#include <stdio.h>

LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);

int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
BOOL bRet = FALSE;
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);
wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndcls.hInstance=hInstance;
wndcls.lpfnWndProc=WinSunProc;
wndcls.lpszClassName="Weixin2003";
wndcls.lpszMenuName=NULL;
wndcls.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndcls);

HWND hwnd;
hwnd=CreateWindow("Weixin2003","CreateWindow",WS_OVERLAPPEDWINDOW,
0,0,600,400,NULL,NULL,hInstance,NULL);

ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);

MSG msg;
while((bRet = GetMessage(&msg,hwnd,0,0)) != FALSE)
{
/*if(bRet == -1)
{
break;
}*/
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}

LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
DWORD dwCurThreadID = GetCurrentThreadId();
switch(uMsg)
{
case WM_CHAR:
break;
case WM_LBUTTONDOWN:
break;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
hDC=BeginPaint(hwnd,&ps);
TextOut(hDC,0,0,"WM_PAINT",strlen("WM_PAINT"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
PostQuitMessage(0);
//DestroyWindow(hwnd);
break;
case WM_DESTROY:
//PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
AnswerRe: About PostQuitMessage Function Pin
Stephen Hewitt16-May-07 17:04
Stephen Hewitt16-May-07 17:04 
QuestionRe: About PostQuitMessage Function Pin
fd012900216-May-07 19:02
fd012900216-May-07 19:02 
AnswerRe: About PostQuitMessage Function Pin
Arman S.16-May-07 20:01
Arman S.16-May-07 20:01 
GeneralRe: About PostQuitMessage Function Pin
Moak16-May-07 22:17
Moak16-May-07 22:17 
GeneralRe: About PostQuitMessage Function Pin
Arman S.17-May-07 0:41
Arman S.17-May-07 0:41 
GeneralRe: About PostQuitMessage Function Pin
fd012900217-May-07 1:36
fd012900217-May-07 1:36 
GeneralRe: About PostQuitMessage Function Pin
Moak17-May-07 2:10
Moak17-May-07 2:10 
Questionconsuming a webservice from a Win32 DLL Pin
rluckwell16-May-07 13:54
rluckwell16-May-07 13:54 
AnswerRe: consuming a webservice from a Win32 DLL Pin
led mike16-May-07 16:08
led mike16-May-07 16:08 
Question32bit app calling NtOpenKey fails on x64 Pin
JeffRoz16-May-07 13:37
JeffRoz16-May-07 13:37 
QuestionWindows Toolbar and... Pin
Chirieac16-May-07 12:09
Chirieac16-May-07 12:09 
QuestionCode Pin
Joseph_B16-May-07 11:52
Joseph_B16-May-07 11:52 
AnswerRe: Code Pin
toxcct16-May-07 12:06
toxcct16-May-07 12:06 
AnswerRe: Code Pin
Christian Graus16-May-07 15:31
protectorChristian Graus16-May-07 15:31 
AnswerRe: Code Pin
vijay_aroli16-May-07 19:27
vijay_aroli16-May-07 19:27 
AnswerRe: Code Pin
John R. Shaw16-May-07 22:19
John R. Shaw16-May-07 22:19 
GeneralRe: Code Pin
Hamid_RT16-May-07 22:37
Hamid_RT16-May-07 22:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.