I've got a Windows 7 VM which runs my mandatory corporate communication systems (Lync and Outlook). What I'd like to do is run a process on this Windows machine which monitors the system tray and sends notifications to my host machine (Xubuntu 13.04) so I'm informed when I get an email or IM (I've already tried seamless RDP to do this but it's an ineffective solution).
Anything Linux or network oriented I can handle with relative ease, what I do not know how to do is to how to query the state of the Windows system tray (or attach an event listener for state changes). I'm comfortable with C++ and Python but I'll give any viable solution a go.
Detailed state information would be preferable but at the very minimum I need to be able to detect changes in the number of icons in the tray.
On Windows, if you install Visual Studio, among Visual Studio Tools there is a useful tool, named "Spy++", basically it's a tool that shows you all the windows and gives ability to see what messages particular window receives.
Using this tool, you can see that whole panel, that contains "Start button", shortcuts, tray, clock, etc. is "Shell_TrayWnd". You can use "Find" menu to search for a particular window just dragging an "aim" on any window.
The tray window itself is "SysPager" (000100D2 on attached image), you can log messages for this window and see what type of message this window receives when you receive mail in Outlook.
After that you can write a code that will listen to all messages that this window receives, and basing on what you have seen in "Spy++" determine what happened.
This is just for start. Writing a code that will get a window handle and listen to messages that window receives is another part, but I think it's already covered at MSDN or even at StackOverflow.
Searching for a particular window handle is done by FindWindowEx function and in order to listen to message you have to set a "hook" that is done by SetWindowsHookEx function. Hooking is described pretty good on MSDN.
may be you need Outlook inspector (http://msdn.microsoft.com/en-us/library/office/ff869356(v=office.15).aspx). As i understand it helps to watch events outlook processes.
Related
I have recently migrated a project of mine to WebView2 and the last part I can't figure out is how to intercept the Windows Messages for the webview. My code is very similar to webview/webview but I was unable to find help on their GitHub.
Previously, I was able to find the hWnd for the webview and use SetWindowSubclass to add my own wndproc to the webview. However, I've used Spy++ and tried SetWindowSubclass on all the windows that showed up there (see below) but none of them had any windows messages in my wndproc other than some window management ones I did not think were useful - The best I got was WM_PARENTYNOTIFY, but I am interested in WM_MOUSEMOVE and WM_NCHITTEST - neither of which I could find.
My goal is to create a borderless, draggable, resizeable WebView2 based app.
The problem is, that the real window that controls and gets all this input is in another process. You just see a window that shows the output in your process.
Look into Spy++. Everything below Chrome_WidgetWin_0 belongs to a new process (MSEDGEWEBVIEW2) and is not part of your process. So you can't subclass such a window with the normal techniques.
So if you want to subclass this window. You need to inject a new DLL into this new process. This DLL might subclass the real window. And this DLL might communicate with you hosting program via any IPC.
I'm trying to work around this issue: https://bugs.launchpad.net/unity/+bug/998073
According to the gtk documentation, and application should receive a window-state-event notification when the main window is minimized. The window's state should also indicate that it is now iconified. Unity does not deliver this notification to the application or change the window's state to indicate that it has happened.
As the bug report describes, Unity is not generating GDK_WINDOW_STATE_ICONIFIED when a window is minimized via the GUI.
Basically, I've got a master window and a slave window (which has no title bar). I need the slave window to minimize and unminimize itself along with the master. In other window managers, the code I have works fine because as it's written it depends on the iconify signal, which other window managers are so kind as to deliver to my application when the user attempts to minimize them.
I've searched all over the interwebs and have not found any workarounds. Does anyone have relevant hints, tips, experience, or workarounds?
I am having an app with a dialog. I would like to know when an extended monitor is unpluged so I can move the app window to the primary monitor, if the app was in the extended one.
I would also want to know when the user is making changes with the extended monitor position.
Is there a WM message that is posted to the window when this happens.
I'm building my app in Visual Studio C++, using the standard WINAPI.
According to this;
The WM_DISPLAYCHANGE message is sent to all windows when the display
resolution has changed.
I'm not familiar enough with this to tell you how to use it though.
I try to send a mouse click event to a game application. First, i use Spy++ to find what message the application receive. I see something like : WM_MOUSEACTIVATE, WM_WINDOWPOSCHANGING, WM_ACTIVATEAPP, WM_ACTIVATE, WM_SETFOCUS, ...
i try to send the same as i see on Spy++ but it doesn't work. How to send mouse click to a game application without give it focus? . it's run in window mode. Thanks in advance.
You want WM_LMOUSEDOWN. You can always check MSDN for the documentation on which messages mean what.
The best way to automate applications and games is via SendInput. While in theory it should be possible to drive an application via WM_LUBTTONDOWN etc, many applications read the key state directly via lower level APIs (such as GetAsyncKeyState) which don't change their state to reflect the messages processed from the message queue.
Using SendInput requires actually setting the game to the foreground as the input events are synthesized at a low level and are thus delivered to the active/focused window.
Short version:
How can I receive input messages in Windows with C++/C when the window is not active?
Background information:
I'm currently working on an Input System that should not depend on any window, so it can e.g. be used in the console as well.
My idea is to create an invisible window only receiving messages, which is possible using HWND_MESSAGE as hWndParent. It only receives input messages when it's active though, and I don't want this. It should always receive input (unless the application requests it no longer does so, e.g. because it lost focus).
I know this is possible somehow, many applications support global shortcuts (e.g. media players (playback control) or instant messengers (opening the contact list)), I just don't know how. Do you know?
Options:
RegisterHotKey if you need to register just one or a few hotkeys
SetWindowsHookEx with WH_KEYBOARD / WH_KEYBOARD_LL. Use when you need to filter many or all keyboard events. However, the hook code needs to be implemented in a DLL (which is loaded into other processes). You need separate 32 bit and 64 bit versions of the DLL
You need to setup windows keyboard input hook. Here is an example how to do it; it is even easier to do in C++