Solved

VB6 Shell function works in ide but not in exe

Posted on 2014-01-31
8
592 Views
Last Modified: 2014-02-07
I have a simple VB program to make CAB files using the makefile.exe utility that ships with windows.  The program runs without error and makes the cab files specified when I run it through the IDE. When I compile it, the makefile.exe utility fails to make the cab files but does not show any errors.  I tried the built in VB shell function, and the ShellExecute API with the same results.  To debug, I wrote a batch program in the application with a pause command after the makecab.exe command to see what is happening.  The makefile.exe seems to run and displays the same output that I see when I run it manually from a cmd prompt, it just does not make the cab file.

dim i as integer
i = FreeFile
Open "C:\DIRS\RMakeCab.bat" For Output As #i
Print #i, "@echo off"
Print #i, "cls"
Print #i, "call makecab.exe /f  " & "C:\DIRS\dirsends.ddf"
Print #i, "pause"
Close #i

dim x as long
x = ShellExecute(Me.hwnd, "", "C:\DIRS\RMakeCab.bat", "", "", SW_HIDE)
'x = Shell("makecab.exe /f  " & dirsends.ddf", vbHide) 'tried both...

Any ideas on what I'm missing here would be greatly appreciated...
0
Comment
Question by:IT-Ed
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 39826268
Two things I can suggest.
First don't use the 'hide' whilst testing - maybe you see some feedback with that about a problem
second try \\ instead of \
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 166 total points
ID: 39826334
>it just does not make the cab file.
I think it actually DOES the cab file, but maybe not in the folder you think it does ...
please check if the cab file is created in the folder where makefile is located ...
0
 
LVL 45

Assisted Solution

by:aikimark
aikimark earned 167 total points
ID: 39826377
Does the makefile.exe proper execution depend on the current directory?  If so, that should be part of the batch file.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 28

Assisted Solution

by:Ark
Ark earned 167 total points
ID: 39827161
The makefile.exe seems to run and displays the same output that I see when I run it manually from a cmd prompt,
It's strange because you include @echo off command into bat file. And second, you must specify path to the  dirsends.ddf in VB Shell function:
x = Shell("makecab.exe /f  " & "C:\DIRS\dirsends.ddf", vbHide)
0
 

Author Comment

by:IT-Ed
ID: 39828724
From further testing I've discovered that it has nothing to do with the VB IDE or the paths in the code, I am running the exe from a mapped network drive.  When I compile it locally it works fine, I need it to run from the mapped drive for several users so I still need to figure  out a way to get to run from the network drive...
0
 

Accepted Solution

by:
IT-Ed earned 0 total points
ID: 39828738
Okay, solved the problem by adding a ChDrive "c" statement before executing makecab.exe
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39829976
@IT-Ed

I think it would be better to accept the comments from Ark and aikimark, as these are the comments related to the path and current directory at run time.

Including your comment, http:#a39828738 , should be your closing/accepting comment.
0
 

Author Closing Comment

by:IT-Ed
ID: 39841396
Problem solved...
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where to obtain Oracle Data Provider for .NET 3.5 7 61
What are the big features of MVC5? 4 104
Post a good COM tutorial 1 72
What are MicroServices? 4 67
This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

734 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