Click here to Skip to main content
15,908,444 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Leaning C++, annoying compile/link error Pin
David Crow9-Apr-08 5:24
David Crow9-Apr-08 5:24 
GeneralRe: Leaning C++, annoying compile/link error Pin
Jan Sommer9-Apr-08 5:39
Jan Sommer9-Apr-08 5:39 
GeneralRe: Leaning C++, annoying compile/link error Pin
CPallini9-Apr-08 5:39
mveCPallini9-Apr-08 5:39 
GeneralRe: Leaning C++, annoying compile/link error Pin
Rajesh R Subramanian9-Apr-08 5:44
professionalRajesh R Subramanian9-Apr-08 5:44 
GeneralRe: Leaning C++, annoying compile/link error Pin
CPallini9-Apr-08 5:48
mveCPallini9-Apr-08 5:48 
GeneralMicrosoft Sam Pin
codeinelogic9-Apr-08 4:40
codeinelogic9-Apr-08 4:40 
QuestionRe: Microsoft Sam Pin
David Crow9-Apr-08 4:48
David Crow9-Apr-08 4:48 
GeneralPlease verify the function Pin
bibhakar9-Apr-08 2:53
bibhakar9-Apr-08 2:53 
Problem Description:- I want to show a message when any windows is closing, but only when user clicks on the right most X symbol of the window, not with ALT-F4 key press and any other method like for example file->exit.
I have one working solution with me but just wanted to know whether the function which i am using is correct or not. Basically wanted to know about the GetAsyncKeyState because i read this in MSDN
-------
Although the least significant bit of the return value indicates whether the key has been pressed since the last query, due to the pre-emptive multitasking nature of Windows, another application can call GetAsyncKeyState and receive the "recently pressed" bit instead of your application. The behavior of the least significant bit of the return value is retained strictly for compatibility with 16-bit Windows applications (which are non-preemptive) and should not be relied upon.
--------
can anybody suggest me that GetAsyncKeyState is fine or any other function on which we can rely upon

Here is the code snippet:

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,WPARAM wParam, LPARAM lParam)
{
LRESULT result=0L;
int k=0;
switch(Msg)
{
case WM_NCLBUTTONDOWN:
if (wParam!=HTCLOSE) // allow clicks on system menu to continue and proceed
{
DefWindowProc(hWnd, Msg, wParam, lParam);
return 0;
}
GetAsyncKeyState(VK_LBUTTON);
break;

case WM_NCLBUTTONUP:
if ((int)wParam ==HTCLOSE && !(GetAsyncKeyState(VK_LBUTTON)))
{
k=MessageBoxA(NULL, "Do u wish to close ", "getasynckeystate", MB_YESNO);
if (k==IDYES)
{
PostMessage(hWnd, WM_CLOSE, 0, 0L);
return 0;
}
else
{
DefWindowProc(hWnd, Msg, wParam, lParam);
}

}
DefWindowProc(hWnd, Msg, wParam, lParam);
break;

case WM_DESTROY:PostQuitMessage(WM_QUIT);// then close it
break;
default : return DefWindowProc(hWnd, Msg, wParam, lParam);// Process the left-over messages
}
return result;
}

Bibhakar Ranjan

GeneralRe: Please verify the function Pin
Iain Clarke, Warrior Programmer10-Apr-08 0:08
Iain Clarke, Warrior Programmer10-Apr-08 0:08 
GeneralBitmap not getting loaded Pin
sheetal_069-Apr-08 2:24
sheetal_069-Apr-08 2:24 
GeneralRe: Bitmap not getting loaded Pin
Sarath C9-Apr-08 4:01
Sarath C9-Apr-08 4:01 
GeneralRe: Bitmap not getting loaded Pin
sheetal_069-Apr-08 18:18
sheetal_069-Apr-08 18:18 
GeneralRe: Bitmap not getting loaded Pin
Hamid_RT11-Apr-08 0:23
Hamid_RT11-Apr-08 0:23 
GeneralRe: Bitmap not getting loaded Pin
sheetal_0613-Apr-08 18:47
sheetal_0613-Apr-08 18:47 
GeneralRe: Bitmap not getting loaded Pin
Hamid_RT13-Apr-08 19:45
Hamid_RT13-Apr-08 19:45 
GeneralRe: Bitmap not getting loaded Pin
sheetal_0613-Apr-08 20:06
sheetal_0613-Apr-08 20:06 
GeneralRe: Bitmap not getting loaded Pin
Hamid_RT14-Apr-08 21:42
Hamid_RT14-Apr-08 21:42 
GeneralRe: Bitmap not getting loaded Pin
sheetal_0615-Apr-08 0:03
sheetal_0615-Apr-08 0:03 
GeneralRe: Bitmap not getting loaded Pin
Hamid_RT15-Apr-08 0:14
Hamid_RT15-Apr-08 0:14 
QuestionWhat is the correct use of namespaces in ANSI C++? Pin
davidgsteadman9-Apr-08 2:07
davidgsteadman9-Apr-08 2:07 
AnswerRe: What is the correct use of namespaces in ANSI C++? Pin
jhwurmbach9-Apr-08 3:00
jhwurmbach9-Apr-08 3:00 
GeneralNeed to convert DWORD to Date Time Pin
yaminisridaran9-Apr-08 2:05
yaminisridaran9-Apr-08 2:05 
QuestionRe: Need to convert DWORD to Date Time Pin
CPallini9-Apr-08 2:09
mveCPallini9-Apr-08 2:09 
GeneralRe: Need to convert DWORD to Date Time Pin
yaminisridaran9-Apr-08 2:15
yaminisridaran9-Apr-08 2:15 
QuestionRe: Need to convert DWORD to Date Time Pin
CPallini9-Apr-08 2:24
mveCPallini9-Apr-08 2:24 

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.