Sendkeys to any windows application
I need to write an application to send keys to any Windows program.
I've used to code that you can find in the following link;
The problem ? It work fine to any application but when the platform is Windows XP.
Question; How do I make this code to work also in Windows 98.
I'm on XP, but my friend who need the routine is on W98 and cannot upgrade to XP because of other program that are not compatible.
Did you create a setup package?
Also, the APIs used in the code are all suppported on windows 95+ and NT4+ so the os shouldnt be an issue.
Is your friend trying to send unicode chars? If so then you need to add additional support fir this.
no I didn't create a setup package.
So I guess there are some files missing.
Do you know the ones missing.
If you use the VB P&D Wizard to create your package it should pickup the dependancies. Only thing is that if you package on an
XP system and install on a 98 system you may end up corrupting the system since 98 is a different kernal base. Inno Setup coupled
with InnoScript are perhaps better at distributing system files. Give them a look.
I do not think that the setup package can help with using API, because they are not part of the project dependecies.
The problem here is more complex: the code posted on vb2themax probably was tested only in NT (or XP). The thing to do is to go through the code line by line (as I suggest to always do when using dowloaded code) and read the MSDN of every single API, to see if they are compatible with 98 and if not how to substitute them.
Originally Posted by mstraf
Originally Posted by VBOfficeGuru
Thanks a lot.
I looked in msdn for the function like mstraf said and I found this regarding one of my procedure ;
Windows 95/98/Me: MapVirtualKeyW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
So I'm gonna add those files and I let you know next week, I'll see my friend to do a test only Monday
Thanks again for your help
The program works fine for me on a Windows 98 PC that has VB6 installed.
Perhaps the VB runtime- MSVBVM60.DLL -is not present on the target Win98 PC? Either the PDW, or the free Visual Studio Installer - http://msdn.microsoft.com/vstudio/do.../download.aspx - will install this file for you. But you have to be careful building an install on an XP PC then running it on a Win98 PC. You should tell the installer not to install any files EXCEPT your compiled .EXE and the MSVBVM60.DLL file. I'm assuming your program is small and doesn't use any special controls- maybe just a textbox and commandbutton? If that's the case, then you won't need any files other than your compiled .EXE and the MSVBVM60.DLL file, and you should be able to safely do the install.
Of course, the other option is to manually copy the MSVBVM60.DLL file to the target PC, then register it using Regsvr32.exe like so: Regsvr32.exe MSVBVM60.DLL - you type that at the command prompt (DOS prompt window) after changing the Directory to the one you copied the MSVBVM60.DLL file into. Again assuming you haven't used any fancy controls, you should then be able to just copy your .EXE file to the PC and it should work.
Last edited by Andrew Cushen; 03-29-2005 at 10:48 AM.
Only the wide characters API (the ones ending with W) need MSLU in 98, but the API defined in the article are ANSI (they end with A) so you should be fine with those.
Originally Posted by Go_Diamond
What kind of problem do you have in 98? Maybe the problem is not in the API, as Andrew suggested.
The problem is the following;
I wrote an application that display a form like a calculator, and want to click on let say the #1 button so it result in input #1 in an another Win application.
Now, this is working fine on my computer (XP) but is not working on the computer that I want it to work(W98). The W98 computer is equipped with a touchscreen. That's the reason of the project.
Re Regsvr32.exe (not .dll) - another way to register - set up a shortcut to Regsvr32.exe (on the desktop or wherever), and then just drag a file onto it, and 'voila!', or set up a shortcut to Regsvr32.exe in the SendTo folder and 'R-Mouse - Send To' on the appropriate file. (Obviously only of use if you wish to use more than once, otherwise use the Command line registration ....)
Last edited by gupex; 03-29-2005 at 06:56 AM.
Oops! You're right, Gupex, thanks for the catch! I was in a hurry yesterday...
Originally Posted by gupex
I've edited the post to fix it.
Go_Diamond - did you follow my suggestion and check whether the VB runtime is on the target PC?
What happens when you try to run your app? Any error messages? The more info you give us, the better the chance that we can help you.
I wonder if the problem is related to the touchscreen. Perhaps the APIs are different for computers with a touchscreen?
Anybody out there have experience with Win98 touchscreen PCs?
Last edited by Andrew Cushen; 03-29-2005 at 10:52 AM.
Yes I did follow your suggestion and yes MSVBVM60.DLL was on the target Pc.
Ok, what happens is 1. The VB6 program start correctly
2. The launcher, the buttom that start the program were I want vbsendkeys to work on, is starting. So far, so good
3. Any keys pressed, don't go to the target application.
no error message, only nothing happens
Again, Thanks for your help.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center