Thats what I said I did and but it doesn't work. If I just filter out mousemove, lbuttonup and lbuttondown and postmessage those, VC spy says the destination paint is getting them but nothing draws on the paint area. If I send all mouse events then the detination paint just hangs up. I'm stuck. Regards, Zee Man
Zee man
Posts
-
Alternative to SetCursorPos? -
Alternative to SetCursorPos?I have 2 MS paintbrush applications side by side. I want to duplicate the brush strokes of one paintbrush on the other. I do this by installing a dll WH_GETMESSAGE hook on the 1st paintbrush and detect WM_MOUSEMOVE and LBUTTONUP/DOWN events. But how to duplicate it on the 2nd paint app? If i do setCursorPos the mouse moves away from the control of the artist. And sending a PostMessage(WM_MOUSEMOVE,x,y) to the 2nd paint doesn't seem to work. Is there any way to simulate a mouse move without taking the mouse away from the user? Need Help. thanks.:confused: Regards, Zee man
-
Legacy VC 6 libraries compatable with .NET??I switched from Visual C++ 6 to a C# .NET solution. In my original VC 6 project I was linking a .lib file to my code. The .lib was providing me some functions to a CORBA orb. This .lib file doesn't seem to be working with my new .NET project. Does anyone know if you can use libraries coded in legacy VC++ 6 with the new .net framework or do I have to rewrite the libraries in C# .net as well? Thanks, Zahid Regards, Zahid
-
Copying an automation object?Thanks for suggestion So I can't do it? Thats depressing since I not only needed the documents but also what buttons like BOLD, ITALIC were pressed or was the word in Print Preview mode or normal mode etc. Actually my actual goal is that I want to transfer the word to another machine with its state intact. I figured that if I could do it on one machine then doing it on multiple would be easy. So there is no other method available other than saving the document in a file and reloading it??? We can't copy the object's attributes and paste them to another object somehow? Thanks. Regards, Zahid
-
Copying an automation object?Hi All, I am new to office automation and I need to perform a simple task. Basically I have to duplicate an Ms word application. What I do is instantiate ms word through a dialog based application using _Application app if(!app.CreateDispatch("word.Application")) { AfxMessageBox("Couldn't start Word and get Application object."); return; } Now I create another instance of word _Application newapp and copy the old instance to the new one. newapp = app; But how do I make the new instance refect the changes? Like show the old word's documents and stuff. Kind of basic question but I have been stuck for hours. Thanks for help Regards, Zahid
-
Getting process address info in windowsHi all, I want to migrate a windows application from one machine to another with its state intact. I was thinking of doing this by saving the process address space (code, stack, heap etc) into a file taking it to the other machine and copying it onto the space of an identical application just started on machine 2. Ofcourse I am assuming that the application does not have external dependencies like open network connections and file I/O happening. e.g word/notepad. I am familiar with how to get the process table in Linux but need help badly for working with windows. How do you get the addresses of the process image? Any references... help would be greatly appreciated. Regards, Zahid
-
weird behaviour of HCBT_ACTIVATE event with WH_GETMESSAGEHi All, I was trying to detect a File Open/save Dialog box event of any generic windows application using windows hook. I got a very good suggestion from this forum of installing a WH_CBT hook and check the classname of every window created , if it matches the FileOpen Dialog's classname do my stuff. This actually works very nicely but now I have a slightly different problem. I need to use WH_GETMESSAGE hook for mouse/keyboard events detection as well. So I am trying to get away with installing just a WH_GETMESSAGE for HCBT_ACTIVATE event. I actually do get this event just like I get one if I had installed a WH_CBT hook. However I do not get a pointer to the HWND like a get from the wParam parameter if I had installed a WH_CBT. I checked both the ((Message)lParam)->wParam as well as wParam but I do not get the valid HWND pointer. Need help. Thanks in advance. Regards, Zahid Regards, Zahid
-
Need Help (detecting file open dialog popup)I want to detect if an application on the desktop (other than my application) has fired up a file open or file save dialog? In other words I want my application to receive an event when any application on the desktop causes a file open/save dialog to pop up. Is this possible using hooks? If so then how? Any suggestion would be greatly appreciated. Thanks in Advance. Regards, Zahid
-
Mouse Hook ProblemHi All, I am getting this weird problem for the past 4 days. Anyone seen this before? I am trying to monitor mouse events on a specific application (Windows XP calculator calc.exe). I have set a hook on the Hwnd pointer of calc using hook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)msghook, hInst, GetWindowThreadProcessId(hWnd, NULL)); and then I use the following to detect messages static LRESULT CALLBACK msghook(UINT nCode, WPARAM wParam, LPARAM lParam) { char text[10]; if(nCode < 0) { /* pass it on */ CallNextHookEx(hook, nCode, wParam, lParam); return 0; } /* pass it on */ LPMSG msg = (LPMSG)lParam; switch(msg->message) { case WM_LBUTTONDOWN: case WM_NCLBUTTONDOWN: PostMessage(hWndServer, UWM_LBUTTONDOWN, WM_LBUTTONDOWN, msg->lParam); break; case WM_LBUTTONUP: case WM_NCLBUTTONUP: PostMessage(hWndServer, UWM_LBUTTONUP, WM_LBUTTONUP, msg->lParam); break; case WM_MOUSEMOVE: case WM_NCMOUSEMOVE: PostMessage(hWndServer, UWM_MOUSEMOVE, WM_MOUSEMOVE, msg->lParam); break; } return CallNextHookEx(hook, nCode, wParam, lParam); } What happens is that WM_LBUTTONDOWN comes in fine but the WM_LBUTTONUP never comes in, instead a mousemove message shows up (EVEN WHEN THE MOUSE IS NOT MOVING). Its very erratic. Sometimes the WM_LBUTTONUP case does execute but very rarely. Am I doing something wrong? If I use WH_MOUSE or WH_CBT instead of WH_GETMESSAGE, none of the cases gets called. Has anyone had this kind of problem before. By the way my mouse is not faulty. I tried this code on a number of PCs with the same result. Thanks in advance. Regards, Zahid
-
Sending Windows Events from one app to anotherThanks for detailed reply Antti. It worked!! I had to implement the whole thing in WIN32 API since the SendMessage took only 3 parameters in MFC and not the window pointer. Also I used WM_LBUTTONDOWN followed by WM_LBUTTONUP to simulate a mouse click. Regards, Zahid
-
Sending Windows Events from one app to anotherI liked your idea very much but the problem is that I want it work for other buttons on the Dialog as well that I don't know the ID for. Infact I don't have access to the source code of the target application whose buttons I want to press. So I can't write any handlers in there. Secondly I tried simulating a mouse click by doing mouse_event(MOUSEEVENTF_LEFTDOWN, 50, 50, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 50, 50, 0, 0); which kind of works but sends messages to the self application and not the target one (since the x,y coordinates are relative to the current window). Back to the send WM_COMMAND message you talked about? What kind of message do I need to send inorder to simulate a mouse click. Since I don't know what the names of the Messages the target application handles in its code I probably can't send it Button_Click messages, so it has to be mouse_click and also how do I determine the 1st hWnd argument....right now I am doing a broadcast? Thanks. Regards, Zahid
-
Sending Windows Events from one app to anotherIs it possible to send windows events from one application to another? To be more specific I want one application to make the other application believe that the user just clicked its "ok" or "cancel" button eventhough the mouse didn't move at all. The problem is that the two applications can't communicate with each other via any IPC etc. Can we make use of windows hooks here? If so how? Any ideas or comments would be greatly appreciated. Thanks Regards, Zahid
-
Detecting mouse/KB events on another ApplicationHi All, I need to detect the mouse/keyboard clicks on one windows application so that I can send the same to another identical application running on another pc and have it do the same stuff. I am having trouble figuring out how to monitor events on an application externally from another application (meaning I can't modify the code of the application whose events I want to monitor). Any ideas or advice. Need HELP!! Thanks. Regards, Zahid