it finds the window, print my message of the MessageBox function but the security window is still active.
I done something wrong?
Mike Harnad
November 27th, 2006, 09:36 AM
Try encoding a BN_CLICKED message through a WM_COMMAND.
golanshahar
November 27th, 2006, 09:45 AM
Maybe this FAQ (http://www.codeguru.com/forum/showthread.php?t=377394) can help you.
Cheers
gabirata
November 27th, 2006, 11:19 AM
I made some modifications so that I could use BN_CLICKED, but the problem still remain.
I don't know why but both codes works fine to click que cancel button, but the other button don't works.
Use SendInput() instead. Here's an article that explains how to send keyboard keys. It should be straightforward to modify the code to send mouse clicks instead, or of course, you can send the accelerator key-combo: http://msdn.microsoft.com/msdnmag/issues/05/01/CQA/
gabirata
November 28th, 2006, 10:45 PM
But, in this way, how can I know the exactly position of the button that I want to click. the window may assume other position, and SendInput send a event for the active window or I'm wrong?
I want to be sure that the button of the window will be clicked!
Krishnaa
November 29th, 2006, 01:16 AM
The LPARAM of WM_LBUTTONDOWN has the coordinates of event, your code shows you are sending 0,0 in there, that would make a click on topmost-leftmost part of the window, which doesn't look like what you want.
So try finding the x,y coordinates of the button.
gabirata
November 29th, 2006, 04:38 AM
Accordingly to the code above I'm sending a message to a button, after I find the handle to parent window I get the to the button. So the (0,0) coordinates really address the button, but it just happen when the window that have the button is above all other.
using the spy++ to monitor the events I clicked in the (0,0) coordinates of the button and it works fine.
in the code above where is hwndParent should be hwndChild, once what I want is the handle of the button. But the work is the same!
Krishnaa
November 29th, 2006, 05:13 AM
So your problem is that window is not on top of all windows now?
Try using SetForeGroundWindow, SetActiveWindow API's.
gabirata
November 29th, 2006, 06:37 AM
I already tried this API's function but it don't bring the window to the top. I don't know why. It's like if the security window had some protection about receive window messages, because I already used those functions to send message to other windows, and so far everything works fine. But with the security window it gets wrong.
Let me explain:
I'm trying to install a program on a machine using an installer that is located on other machine, then my aplication receive the path of the installer e execute the program. In this moment a security window is show alerting the user of the risk. It's this window that I want send a message. the window have 3 buttons, execute, save(disabled) and cancel. curiously when I send a message to the cancel button it can be behind all other that it cancel the installation, but when I want the execute button it just works if the window is above all other.
So, I think that is something about privileges, security, or something like that.
If someone know I will appreciate so much!
thanks in advance...
Krishnaa
November 29th, 2006, 06:46 AM
Okay, microsoft must have added that kind of security then, now my question is why dont you let user do the authorisation work ?
gabirata
November 29th, 2006, 07:04 AM
Because is a Network Management System, in which the administrator can choice in which machines it would like to install one application. So, the installation process canno't be interactive.
Using WMI I made the installation function to .msi packages, but for other applications this is not possible. Or maybe I don't know how. In this type, just applications that receive parameters to install silently can be installed without interaction. But I'm stoping in that security window.
Thanks by your attention!
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.