Question Application works properly on my PC but not others

adamstemper

New member
Joined
Mar 8, 2010
Messages
2
Programming Experience
1-3
Hey Everyone,

I have an application developed in VS2008 VB.net. It is a numberpad with buttons for 0 - 9.

When published and installed on my local PC, everything works as expected. I open a browser window, and am able to click a number-button and have the corrosponding number sent to the active window location.

When installed on other PC's, the numbers sent to the active window location are repeated many many times. If you click the "3" button, then anywhere from 10 to 50 "3"s are sent to the screen.

All PC's have Windows XP Professional, Version 2002, Service Pack 3.

The only differences I can detect are the many many .NET frameworks installed on my computer and not on others.

My application has the following method declarations:

VB.NET:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    Declare Auto Function FindWindow Lib "USER32.DLL" ( _
        ByVal lpClassName As String, _
        ByVal lpWindowName As String) As IntPtr

    Private Declare Function SetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal handle As IntPtr) As Integer

    Private Declare Function SetCursorPos Lib "user32" (ByVal x As Integer, _
        ByVal y As Integer) As Integer

    Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, _
        ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)

    Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" _
        (ByVal wCode As Integer, ByVal wMapType As Integer) As Integer


To send the keys to the active window, i use the following code:

VB.NET:
AppActivate("http://tess.vmc.com/etm/ - Windows Internet Explorer")
Dim windowHandle As IntPtr = FindWindow("IEFrame", "http://tess.vmc.com/etm/ - Windows Internet Explorer")
SetForegroundWindow(windowHandle)
Sleep(50)
keybd_event(letter, MapVirtualKey(letter, 0), 0, 0) ' Key Down
Sleep(50)
keybd_event(letter, MapVirtualKey(letter, 0), 2, 0) ' Key Up

Just so all are aware, I have tried the SendKeys.Send and SendKeys.SendWait along with appropriate .Flush's, and encountered issues even on my development PC (which is why I have gone the route of keybd_event)

Anybody have any idea why this is happening? All help is very appreciated!

Thanks!
 
Sorry to have posted and then found the answer on my own so suddenly. The problem wasnt that this code was failing, or even that the computers in use were missing any components. It was with how I updated the application.

On the other PC's, they connected to the application through our server. Because I didnt want everybody to consistantly receive updates, I had the test users connect directly to my computer to get the install. This was not the correct way to do things apparently, because some of the updates were not completing properly. As soon as I updated the server, and had all test users get the updates from the server instead of my PC remotely, everything works fine.
 
Back
Top