Solved

VB6 Runtime Error 5 When calling an external executable

Posted on 2013-10-23
7
311 Views
Last Modified: 2013-10-24
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?
0
Comment
Question by:hmauto
  • 3
  • 2
7 Comments
 
LVL 45

Assisted Solution

by:aikimark
aikimark earned 125 total points
ID: 39597093
Try this:
      cmndStr = Chr(34) & "\\hmnassrvr\HMNASSRVR_D\Applications\Scalper_Cycle_TM\Scalper Cycle TM.exe" & Chr(34)

Open in new window

0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 39597650
Is the operating system different on the problem machine?
0
 

Author Comment

by:hmauto
ID: 39597729
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.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 45

Accepted Solution

by:
Martin Liss earned 125 total points
ID: 39597765
Try having the client increase his screen resolution or have another client temporarily lower theirs.
0
 

Author Comment

by:hmauto
ID: 39598764
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.
0
 

Author Closing Comment

by:hmauto
ID: 39598775
Did not actually come to a solution to the problem, however experts trouble shooting suggestions were some help.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now