Click here to Skip to main content
15,913,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Separete the file extension from a filename Pin
Fredrik Skog19-Dec-02 20:36
Fredrik Skog19-Dec-02 20:36 
GeneralRe: Separete the file extension from a filename Pin
Jörgen Sigvardsson21-Dec-02 10:15
Jörgen Sigvardsson21-Dec-02 10:15 
GeneralRe: Separete the file extension from a filename Pin
Al_Pennyworth23-Dec-02 2:50
Al_Pennyworth23-Dec-02 2:50 
Generaldetect mouse click Pin
king_of_the_world19-Dec-02 18:37
king_of_the_world19-Dec-02 18:37 
GeneralRe: detect mouse click Pin
Taka Muraoka19-Dec-02 18:51
Taka Muraoka19-Dec-02 18:51 
GeneralRe: detect mouse click Pin
king_of_the_world19-Dec-02 19:08
king_of_the_world19-Dec-02 19:08 
GeneralRe: detect mouse click Pin
Taka Muraoka19-Dec-02 19:12
Taka Muraoka19-Dec-02 19:12 
GeneralRe: detect mouse click Pin
king_of_the_world20-Dec-02 1:15
king_of_the_world20-Dec-02 1:15 
thanks for the pointer, now I still have some problem of getting it to work,
I have the following callback procedure that tries to show the mouse position

LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lparam){
MOUSEHOOKSTRUCT* mousehook=(MOUSEHOOKSTRUCT*)lparam;
POINT p=mousehook->pt;
char temp[20];
sprintf(temp,"mouse position is %d %d",p.x,p.y);
MessageBox(hWnd,temp,"",MB_OK);
return 0;
}

and I did SetWindowsHookEx(WH_MOUSE, 0,hInstance,0); but MouseProc was never been called for some reason, what did I do wrong, the following is my code in detail:


int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrev, LPSTR lpCmdLine, int Cmd) {

MSG msg;

// Setup and register the window class;

WNDCLASS wClass;
wClass.style =CS_HREDRAW|CS_VREDRAW;
wClass.lpfnWndProc =WindowProcedure; // callback-function;
wClass.cbClsExtra =0;
wClass.cbWndExtra =0;
wClass.hInstance =hInstance;
wClass.hIcon =LoadIcon(hInstance,IDI_APPLICATION);
wClass.hCursor =LoadCursor(NULL,IDC_ARROW);
wClass.hbrBackground =(HBRUSH)(COLOR_WINDOW+3);
wClass.lpszMenuName =NULL;
wClass.lpszClassName =WINDOWNAME;

RegisterClass(&wClass);


// Create the window and store the handle;

hWnd = CreateWindow(WINDOWNAME, // class name;
WINDOWNAME, // window name;
WS_OVERLAPPEDWINDOW, // window style;
CW_USEDEFAULT, CW_USEDEFAULT, // starting position (x,y);
320, 240, // width and height;
NULL, // parent handle;
NULL, // menu handle;
hInstance, // instance handle;
NULL); // other parameters;


// Check if window creation failed; otherwise show and update;

if(hWnd==NULL) return FALSE;
else {

ShowWindow (hWnd, Cmd);
UpdateWindow(hWnd);
}


HOOKPROC hookproc;
//static HINSTANCE hinstDLL;
static HHOOK hhook;

SetWindowsHookEx(WH_MOUSE, 0,hInstance,0);

// Message loop;

while(GetMessage(&msg,NULL,0,0)) {
TranslateMessage(&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}

GeneralRe: detect mouse click Pin
Taka Muraoka20-Dec-02 1:28
Taka Muraoka20-Dec-02 1:28 
GeneralRe: detect mouse click Pin
king_of_the_world20-Dec-02 1:38
king_of_the_world20-Dec-02 1:38 
GeneralRe: detect mouse click Pin
king_of_the_world20-Dec-02 1:40
king_of_the_world20-Dec-02 1:40 
GeneralRe: detect mouse click Pin
Taka Muraoka20-Dec-02 1:50
Taka Muraoka20-Dec-02 1:50 
GeneralRe: detect mouse click Pin
king_of_the_world20-Dec-02 1:55
king_of_the_world20-Dec-02 1:55 
GeneralRe: detect mouse click Pin
Taka Muraoka20-Dec-02 2:08
Taka Muraoka20-Dec-02 2:08 
GeneralRe: detect mouse click Pin
king_of_the_world20-Dec-02 2:14
king_of_the_world20-Dec-02 2:14 
GeneralRe: detect mouse click Pin
Christian Graus19-Dec-02 18:52
protectorChristian Graus19-Dec-02 18:52 
GeneralComboBox Pin
Exceter19-Dec-02 17:28
Exceter19-Dec-02 17:28 
GeneralRe: ComboBox Pin
KaЯl19-Dec-02 23:37
KaЯl19-Dec-02 23:37 
GeneralNeed help using SafeArray/VARIANT from ASP/VBScript client Pin
bahruddina19-Dec-02 16:22
bahruddina19-Dec-02 16:22 
GeneralRe: Need help using SafeArray/VARIANT from ASP/VBScript client Pin
Jeff J19-Dec-02 21:56
Jeff J19-Dec-02 21:56 
GeneralRe: Need help using SafeArray/VARIANT from ASP/VBScript client Pin
Anonymous20-Dec-02 3:41
Anonymous20-Dec-02 3:41 
GeneralRe: Need help using SafeArray/VARIANT from ASP/VBScript client Pin
Jeff J20-Dec-02 10:55
Jeff J20-Dec-02 10:55 
GeneralNeed Suggestion on "Timing Out" GetDiskFreeSpaceEx Pin
wdafon19-Dec-02 16:07
wdafon19-Dec-02 16:07 
Generalwindows 2000 power management Pin
dejavu19-Dec-02 15:48
dejavu19-Dec-02 15:48 
GeneralRe: windows 2000 power management Pin
roboo19-Dec-02 18:14
roboo19-Dec-02 18:14 

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.