Wolf wrote:
Daniel Kolbo wrote:
Hello,
I am mostly familiar with php for serving up web pages; however,
recently I have been writing a local command line script on my WinXP
machine. I have spent the better part of this last week and all of
today trying to figure out a way to send a mouse click to a particular
window on the screen.
I first saw w32api.dll on the php.net site. However, I cannot find
this dll, but this searching took me to winbinder and php-gtk2. It
seems that I can only get winbinder to get (not send) mouse
information: event type and x,y positions. I am not too familiar with
php-gtk nor creating dlls.
I want to use my local php command line script on my winXP machine to
send mouse events (click) to a window. I am open to any ideas on how
to do this.
For C++ and VB there seems to be the SendMessage() function. Is there
a way to tap into that function from my php script?
winbinder has a function that wraps the SendMessage() function called
wb_send_message, but after literally 9 hours i quit.
on the MSDN.microsoft site, I saw the functions mouse_event() and
SendInput() of the "user32.dll"
http://msdn2.microsoft.com/en-us/library/ms646310.aspx
http://msdn2.microsoft.com/en-us/library/aa932376.aspx
I copied the "user32.dll" to my php/ext folder and tried loading the
"user32.dll" both as an extension directive in php.ini and by using
the dl() function in my script (dl() is enabled). However, both
methods gave me a PHP warning:
as an extension in php.ini it gives the following error:
PHP Warning: PHP Startup: Invalid library (maybe not a PHP library)
'user32.dll
' in Unknown on line 0
get_loaded_extensions() confirms user32.dll never gets loaded.
invoking dl("user32.dll") yields the warning:
PHP Warning: dl(): Invalid library (maybe not a PHP library)
'user32.dll' in [my script]
Possible ideas:
-Load a dll with the dl() function? (Write the dll with VB or C++)
-use the w32api_register_function() in php somehow to 'tap' into
windows api functions.
-use a project that can assist me in this like php-gtk2 or winbinder
-maybe someone has a copy of w32api.dll
-something about COM objects, though i am really not familiar
It seems as though the C languages and VB languages can do this.
Perhaps I could write and compile a dll in that language, somehow load
it up in php (even though i am having errors doing that currently),
then I can use those functions in my dll to send my mouse clicks
through php.
I am throwing out this question to the community and wondering what
your suggestions would be for how to go about sending a mouse click
event to my windows api from a php script.
I am not interested in writing javascript as this is not a web
application.
Any thoughts, comments, suggestions, about how to do send mouse events
from a php script will be much appreciated.
Thanks in advance,
Trying to send one TO a screen? Good luck with that. But you really
should wait at least for a few days for a response from the list before
reposting the same question with no further information...
What code have you tried? What code works to a point but fails?
Wolf
Thanks for your response Wolf.
Sorry for the double email, i had just signed up, and I thought the
original didn't go through, b/c i hadn't completed all the verification
steps.
What is TO? You referenced it in your reply.
In addition to the function i mentioned from winbinder wb_send_message()
I have tried:
I tried loading in the user32.dll extension from within the php.ini,
this failed.
I tried loading in the user32.dll from within the script, this failed.
dl("user32.dll")
I tried loading in the php_w32api.dll from within the script (i copied
the php_w32api.dll from php4 into my ext/ folder in php5.
dl("php_w32api.dll");
this worked; however, when I tried registering the functions from within
the script it failed on me.
w32api_register_function("User32.dll",
"mouse_event",
"void");
I really am at a lose of how to even begin. How would I execute a mouse
click from a php script on a console application?
Thanks,
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php