Click here to Skip to main content
15,909,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WINDOWPLACEMENT Pin
Jeremy Falcon11-Apr-02 10:11
professionalJeremy Falcon11-Apr-02 10:11 
QuestionA nice CGI class for... GCI apps??? Pin
LukeV11-Apr-02 3:29
LukeV11-Apr-02 3:29 
AnswerRe: A nice CGI class for... GCI apps??? Pin
Niklas L11-Apr-02 6:03
Niklas L11-Apr-02 6:03 
GeneralPowerpoint Slideshow implementation Pin
Deleted11-Apr-02 1:48
Deleted11-Apr-02 1:48 
GeneralUrgent: Combo Box Pin
syedhassan411-Apr-02 1:01
syedhassan411-Apr-02 1:01 
GeneralRe: Urgent: Combo Box Pin
Prem Kumar11-Apr-02 1:31
Prem Kumar11-Apr-02 1:31 
GeneralRe: Urgent: Combo Box Pin
syedhassan411-Apr-02 3:52
syedhassan411-Apr-02 3:52 
GeneralSuper Big Problem with SetWindowsHookEx function!!! Pin
10-Apr-02 22:11
suss10-Apr-02 22:11 
SKeung (Visitor) Apr 11, 2002
I have writen a program with GUI in C++. It is used to get the many kinds of system message by using SetWindowsHookEx.
I have two functions.

The first is:

void createHook()
{
hMouseHook = SetWindowsHookEx( WH_MOUSE, (HOOKPROC) MouseHookProc, hInst, 0L );
}

The second is:

LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam )
{
LPMOUSEHOOKSTRUCT MouseHookParam;
if ( nCode >= 0 )
if ( wParam == WM_MOUSEMOVE )
{
if ( nCode == HC_NOREMOVE )
strcpy(szType, "NOT Removed from Queue");
else
strcpy(szType, "REMOVED from Queue");
MouseHookParam = (MOUSEHOOKSTRUCT *) lParam;
printf("Mouse at X = %d, Y = %d is %s\n\n", MouseHookParam->pt.x, MouseHookParam->pt.y, szType );
/// write to file to show result
f1=fopen("c:\\report.txt","a+");
fprintf(f1, "Mosue Location At ( %d, %d )\n", MouseHookParam->pt.x, MouseHookParam->pt.y);
fclose(f1);
///
}
return ( CallNextHookEx(hMouseHook, nCode, wParam, lParam) );
}

The problem is that if the mouse moves inside the GUI frame, the data can be saved in a text file and printed out on the screen, but the mouse moves outside the GUI frame, the mouse data can be only saved in a text file, but it cannot be printed on the console screen.

The printf seems not to run and by-pass this statement.

Why? plz help me, Hero!!! Thz a lot!!!

GeneralRe: Super Big Problem with SetWindowsHookEx function!!! Pin
Lakitu11-Apr-02 23:26
Lakitu11-Apr-02 23:26 
GeneralSelf-Destructing Executable Pin
Serge Baltic10-Apr-02 21:16
Serge Baltic10-Apr-02 21:16 
GeneralRe: Self-Destructing Executable Pin
Rickard Andersson2010-Apr-02 22:14
Rickard Andersson2010-Apr-02 22:14 
GeneralRe: Self-Destructing Executable Pin
Alexandru Savescu10-Apr-02 22:18
Alexandru Savescu10-Apr-02 22:18 
GeneralRe: Self-Destructing Executable Pin
Prem Kumar11-Apr-02 1:03
Prem Kumar11-Apr-02 1:03 
GeneralAccessing CEdit Member Functions Inside CEditView ::MFC Pin
valikac10-Apr-02 16:49
valikac10-Apr-02 16:49 
GeneralRe: Accessing CEdit Member Functions Inside CEditView ::MFC Pin
Alex Cramer10-Apr-02 17:49
Alex Cramer10-Apr-02 17:49 
GeneralRe: Accessing CEdit Member Functions Inside CEditView ::MFC Pin
valikac10-Apr-02 17:50
valikac10-Apr-02 17:50 
GeneralRe: Accessing CEdit Member Functions Inside CEditView ::MFC Pin
Alex Cramer10-Apr-02 18:25
Alex Cramer10-Apr-02 18:25 
GeneralClasses in DLL Pin
10-Apr-02 16:44
suss10-Apr-02 16:44 
GeneralRe: Classes in DLL Pin
10-Apr-02 17:36
suss10-Apr-02 17:36 
GeneralRe: Classes in DLL Pin
Gunnar Bolle10-Apr-02 23:44
Gunnar Bolle10-Apr-02 23:44 
GeneralRe: Classes in DLL Pin
jan larsen11-Apr-02 2:17
jan larsen11-Apr-02 2:17 
GeneralRe: Classes in DLL Pin
Jack Hui11-Apr-02 5:30
Jack Hui11-Apr-02 5:30 
Generalheap, stack Pin
NicholasCougar10-Apr-02 16:25
NicholasCougar10-Apr-02 16:25 
GeneralRe: heap, stack Pin
Paul M Watt10-Apr-02 16:35
mentorPaul M Watt10-Apr-02 16:35 
GeneralRe: heap, stack Pin
James R. Twine12-Apr-02 10:12
James R. Twine12-Apr-02 10:12 

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.