How does the draggable crosshair in Process Explorer work? - c++

There is a feature in Sysinternal's Process Explorer that allows a crosshair to be dragged from the application to a control in any other application you are running and highlights said control.
Does anyone know how this was achieved or if there is a .NET/C++ library out there that can be reused?

Using Win32 API
GetCursorPos: to get the cursor position (maybe .NET has its own function to do that)
WindowFromPoint: to get the handle of the window from a specific point in the screen
more info

Related

Getting a control position of a Java GUI application

Having a Java GUI application, I need to get the location of one of its buttons, so I'll be able to simulate a mouse click.
What is the most straightforward way of doing this from a C++/WinAPI application?
I need to embed this solution into a downloadable application, so preferably it should not require using a multimegabyte library.
For example, having an app similar to this (screenshot from Wikipedia):
How can I get the RECT of the button?

Is there a way to get the mouse cursor icon in a C/C++ application on Mac OSX?

Let me detail what I'm trying to accomplish: I have a C/C++ (no Objective-C) application that captures the screen (using methods from Quartz Display Services such as CGImageRef and CGWindowListCreateImage).
However, these methods do not also capture the mouse cursor icon, so could you please let me know if there is any way of capturing this using only C/C++ (and no Objective-C or Cocoa)?
Thank you,
Mihnea
P.S. I know that there is a similar post ( Not displaying Mouse cursor ), but the only valid answer on that thread uses Objective-C code, and I cannot use that in my application.

Can i use Global System Hooks to capture which file was clicked on?

I am new to Windows programming, mostly done Java(Java SE, Java ME, Android, Java EE), so be detailed and gentle.
I want to capture "the name of the file/path that was clicked in windows, like clicking a file on the desktop"?
Further research http://www.codeproject.com/Articles/6362/Global-System-Hooks-in-NET, which is a small c#/c++ nice app that uses Global System Hooks, to capture mouse events such as coordinates,clicks,etc.
So what is the right API or Global System Hook that captures events on file icons?
There is no single API that provides that level of detail.
The WH_MOUSE and WH_MOUSE_LL hooks of SetWindowsHookEx(), or the WM_INPUT message delivered by RegisterRawInputDevices(), can tell when the mouse is being intereacted with, and the GetCursorPos() function can tell you where the mouse cursor is located onscreen at the time of a click, but it cannot tell you what it is clicking on. You have to figure that out manually.
For instance, the Desktop is implemented as a ListView control, so you can use the WindowFromPoint() and GetDesktopWindow() functions to check if the mouse is located at coordinates corresponding to the desktop window itself instead of an application window, and if so then use the LVM_HITTEST and LVM_GETITEM messages to determine which icon onthe desktop is being clicked on and extract its display text. Then use the SHGetDesktopFolder() function and the IShellFolder interface, or the SHParseDisplayName() function, to parse that text and see if it returns a PIDL that represents a path/file, and if so then use SHGetPathFromIDList() to get the actual path/file name.
If you want to do the same thing with the Windows Explorer app, it gets a bit more complicated. Use WindowFromPoint(), GetWindowThreadProcessId(), OpenProcess(), and EnumProcessModules() to determine if the mouse is over the Windows Explorer app. However, its UI changes from on Windows version to the next, but the jist is that you have to manually locate the focused control via AttachThreadInput() and GetActiveWindow(), check if it is a TreeView/ListView control, and if so then use control-specific messages to get information about the item/icon underneath the mouse cursor coordinates, and use IShellFolder again to figure out what the text of that item/icon actually represents.
Shell programming is very complex system and not for the feint of heart to interact with. So you need to ask yourself, why do you need this information in the first place?

Stick Window to Other Window

I want to develop Windows program who can stick into other
window.
I searching fastest-way to do this. I can get by WinAPI all
information about target window and move my window into good location
and after it Sniffing Windows Messages of target window to searching resize or move window and after this doing move my window again. But i don't know what is a simplest good working way (maybe somewhat on .NET? But i don't preffer answers in .NET i like free framework's).
I want to stick on the top, bottom, left, right of the target window, but this maybe never mind.
Can anyone help me something with this problem?
Thanks.
I used DLLInjection to get into target windows process, created some hooks using winapi calls and by XML over Message Pipe transporting this values to other application who stick to this windows.
You basically need to do two things:
Get a list of all windows to which your app is supposed to stick, and their locations/dimensions.
Listen to your application's main window's move event and if at any point your window gets close enough to any of the relevant windows from #1 you move it yourself so that they align.
You can do both in Win32 API or with .Net. You just need a good criterion for #1. Like, for example, all top level visible windows that are within the desktop's boundaries.
Might want to include the desktop itself in the list above, so that your app sticks to the edges of the desktop as well.

Qt question to fullscreen flash application

I am using Qt to develop an application and inside we have access to select flash streaming videos like youtube. Is there a way to programmaticly full screen the flash application without requiring interaction from the user?
I am using a "QWebView" control.
try calling showFullScreen for the window where your QWebView control is hosted.
void QWidget::showFullScreen ()
Shows the widget in full-screen
mode.
Calling this function only affects
windows.
To return from full-screen mode, call
showNormal().
I would say: locate the button for the fullscreen application on the page, and send a click using QEVent. Tricky, but might work.
If the button is inside the flash application, you will have difficulties to locate it but if you succeed, you can probably send the click to the flash application area.
You can always inject javascript from Qt into your QWebPage. If there is a javascript API for forcing the flash viewer to full screen, I do not know.