Link to home
Start Free TrialLog in
Avatar of hmauto
hmautoFlag for United States of America

asked on

VB6 Runtime Error 5 When calling an external executable

I'm having a strange issue with a particular client running an external executable. I've done this very same thing before, and in fact it works fine from other machines using the same application. But on this one machine I get this runtime error.  Here is the code:
Private Sub cmdClock_Click()
Dim X As Long
Dim handle As Long
Dim cmndStr As String
    
    handle = FindWindow("ThunderRT6FormDC", "Scalper Cycle Clock")
    If handle <> 0 Then
        AppActivate "Scalper Cycle Clock"
        X = ShowWindow(handle, 1)
        X = SetWindowFocus(handle)
    Else
        cmndStr = "\\hmnassrvr\HMNASSRVR_D\Applications\Scalper_Cycle_TM\Scalper Cycle TM.exe "
        X = Shell(cmndStr, 1)
        'DoEvents
    End If

End Sub

Open in new window

I thought maybe there was a problem with the spaces in the executable name, but I removed them and still have the problem. This machine runs other external applications from within this VB app with out any problems. Any Ideas?
SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is the operating system different on the problem machine?
Avatar of hmauto

ASKER

No, all running on ether Windows 7 PRO or Windows 2008 server. I'm wondering if this could related to a screen resolution issue? The client I'm having the problem with is a lower resolution than all the others.
 aikimark: thanks for the suggestion but it didn't work.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hmauto

ASKER

I'm pretty sure it's a problem with the application its self, because the Scalper Cycle TM.exe will not run directly on this client ether. So, I don't think it is a VB problem at all. Curious thing about it however, it runs on other clients. I can run this app just fine with the same resolution ( I tried your suggestion) on other clients without issue.  Anyway I'm getting different error messages running the app external to the VB, so maybe I can now come to a resolution.  
Thanks to everyone for there help. I'm going to close case.
Avatar of hmauto

ASKER

Did not actually come to a solution to the problem, however experts trouble shooting suggestions were some help.