Click here to Skip to main content
15,921,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DirectX HELP!!! Pin
Anonymous8-Feb-03 23:03
Anonymous8-Feb-03 23:03 
QuestionWhat means cout.precision (4)? Pin
George28-Feb-03 22:09
George28-Feb-03 22:09 
AnswerRe: What means cout.precision (4)? Pin
Mike Nordell9-Feb-03 2:07
Mike Nordell9-Feb-03 2:07 
QuestionHow to replace the system clock? Pin
dennisV8-Feb-03 21:06
dennisV8-Feb-03 21:06 
AnswerA soldering iron and quite some luck! Pin
Mike Nordell9-Feb-03 15:08
Mike Nordell9-Feb-03 15:08 
AnswerRe: How to replace the system clock? Pin
ELY M.21-Aug-04 5:13
ELY M.21-Aug-04 5:13 
GeneralRe: How to replace the system clock? Pin
dennisV21-Aug-04 14:15
dennisV21-Aug-04 14:15 
Generala global mouse hook Pin
king_of_the_world8-Feb-03 17:30
king_of_the_world8-Feb-03 17:30 
hi guys, I'm trying to get a global mouse hook and listen to mouse clicks clicked on the windows desktop, however, I only succeeded in getting mouse clicks on a client window, but can't getting mouse clicks on the desktop, the following is my code(in trying to hook the desktop): any help and pointers are appreciated



#include <iostream.h>
#include<fstream.h>
#include <windows.h>

#include <stdlib.h>
#include<stdio.h>
#define WIN32_LEAN_AND_MEAN // Quicker build times;

#define WINDOWNAME "Simple Sample Application"



/*----------------------------------------------------------------*\
Global Variables - to vanish in the C++ version;
\*----------------------------------------------------------------*/

HWND hWnd; // Main window handle;
int screenHeight,screenWidth;

ofstream errstream("mouseLog.txt");


#pragma data_seg(".shared") // you must define as SHARED in .def
HHOOK mouseHook,keyboardHook;
HINSTANCE g_hinstance;
//DWORD g_dwLastTick = 0; // tick time of last input event
//LONG g_mouseLocX = -1; // x-location of mouse position
//LONG g_mouseLocY = -1; // y-location of mouse position
#pragma data_seg()
//#pragma comment(linker, "/section:.IdleTrac,rws")

LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lparam){
switch(wParam){
case 27:
UnhookWindowsHookEx(mouseHook);
UnhookWindowsHookEx(keyboardHook);
errstream.close();
PostQuitMessage(0);
}
return 0;
}

LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lparam){

MessageBox(hWnd,"in mouse proc ","",MB_OK);
MOUSEHOOKSTRUCT* mousehook=(MOUSEHOOKSTRUCT*)lparam;
POINT p=mousehook->pt;
switch(wParam){
case WM_RBUTTONDOWN:
MessageBox(hWnd,"right button down","",MB_OK);
// errstream<<"mouse position is "<
GeneralRe: a global mouse hook Pin
Paul M Watt8-Feb-03 20:13
mentorPaul M Watt8-Feb-03 20:13 
GeneralRe: a global mouse hook Pin
king_of_the_world8-Feb-03 20:26
king_of_the_world8-Feb-03 20:26 
GeneralRecursive CFtpFileFind Pin
User 127828-Feb-03 16:47
User 127828-Feb-03 16:47 
Generaltrying to shut down windows Pin
king_of_the_world8-Feb-03 15:53
king_of_the_world8-Feb-03 15:53 
GeneralRe: trying to shut down windows Pin
Abbas_Riazi8-Feb-03 17:39
professionalAbbas_Riazi8-Feb-03 17:39 
GeneralRe: trying to shut down windows Pin
king_of_the_world8-Feb-03 17:51
king_of_the_world8-Feb-03 17:51 
GeneralRe: trying to shut down windows Pin
Abbas_Riazi9-Feb-03 5:38
professionalAbbas_Riazi9-Feb-03 5:38 
QuestionHow do i use the overload operator= in a CObject? Pin
Anonymous8-Feb-03 15:49
Anonymous8-Feb-03 15:49 
AnswerRe: How do i use the overload operator= in a CObject? Pin
includeh109-Feb-03 2:39
includeh109-Feb-03 2:39 
GeneralMultiple document templates Pin
Perseus8-Feb-03 14:55
Perseus8-Feb-03 14:55 
GeneralRe: Multiple document templates Pin
Roger Allen10-Feb-03 6:40
Roger Allen10-Feb-03 6:40 
GeneralRe: Multiple document templates Pin
Perseus11-Feb-03 12:48
Perseus11-Feb-03 12:48 
GeneralSave File Dialog Creation Pin
orcblood8-Feb-03 14:01
orcblood8-Feb-03 14:01 
GeneralRe: Save File Dialog Creation Pin
Michael Dunn8-Feb-03 14:39
sitebuilderMichael Dunn8-Feb-03 14:39 
GeneralRe: Save File Dialog Creation Pin
orcblood9-Feb-03 7:01
orcblood9-Feb-03 7:01 
QuestionHow to get Key name from Vitrual-Key code? Pin
Aidman8-Feb-03 13:40
Aidman8-Feb-03 13:40 
AnswerRe: How to get Key name from Vitrual-Key code? Pin
KaЯl9-Feb-03 21:40
KaЯl9-Feb-03 21:40 

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.