Sendkeys to any windows application


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 13 of 13

Thread: Sendkeys to any windows application

  1. #1
    Join Date
    Mar 2005
    Posts
    5

    Sendkeys to any windows application

    Hi,
    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;
    http://www.devx.com/vb2themax/tip/19094

    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.

    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

  3. #3
    Join Date
    Mar 2005
    Posts
    5
    no I didn't create a setup package.
    So I guess there are some files missing.
    Do you know the ones missing.

  4. #4
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

  5. #5
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    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.

    Marco

  6. #6
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    Quote Originally Posted by mstraf
    ...and read the MSDN of every single API, to see if they are compatible with 98 and if not how to substitute them.
    Quote Originally Posted by VBOfficeGuru
    ...Also, the APIs used in the code are all suppported on windows 95+ and NT4+ so the os shouldnt be an issue. ...
    Already done.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

  7. #7
    Join Date
    Mar 2005
    Posts
    5
    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

    )

  8. #8
    Join Date
    Apr 2004
    Location
    New York City
    Posts
    538
    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.

    HTH,

    -Andrew
    Last edited by Andrew Cushen; 03-29-2005 at 10:48 AM.

  9. #9
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    Quote Originally Posted by Go_Diamond
    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.
    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.
    What kind of problem do you have in 98? Maybe the problem is not in the API, as Andrew suggested.
    Marco

  10. #10
    Join Date
    Mar 2005
    Posts
    5
    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.

  11. #11
    Join Date
    Feb 2004
    Location
    Sydney, Australia
    Posts
    498
    Regsvr32.dll MSVBVM60.DLL
    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.

  12. #12
    Join Date
    Apr 2004
    Location
    New York City
    Posts
    538
    Quote Originally Posted by gupex
    Re Regsvr32.exe (not .dll)
    Oops! You're right, Gupex, thanks for the catch! I was in a hurry yesterday...

    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?


    -Andrew
    Last edited by Andrew Cushen; 03-29-2005 at 10:52 AM.

  13. #13
    Join Date
    Mar 2005
    Posts
    5
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center