Solved

VB6 Shell function works in ide but not in exe

Posted on 2014-01-31
8
595 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 46

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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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 46

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

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.…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

626 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