Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB6 Shell function works in ide but not in exe

Posted on 2014-01-31
8
Medium Priority
?
603 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 664 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 668 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 28

Assisted Solution

by:Ark
Ark earned 668 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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 you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

688 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