Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 14989

Bazaar behavior

$
0
0
I have several programs that after running, they open another piece of software, I decided to modify these programs to open a calculator program before performing its duties. The first one I modified worked as expected, the next one works fine when run from the IDE, but when compiled and I click on the .exe file, the .exe file is deleted! Just tried it with a third program and it did the same thing, works fine in IDE, deletes itself when run from the .exe file. The added code is in red.

Code:

Option Explicit

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
    ByVal lpParameters As String, ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_SHOWNORMAL = 1
.
.
.
sFileSpec = "C:\Program Files (x86)\J. A. Associates\RPN Engineering Calculator\rpn.exe"

R = True

GoSub DoIt

R = False

sFileSpec = "D:\Documents\DesignCAD\Drawings\Puzzles\star13puzzle.dcd"
.
.
.
DoIt:

rtn = ShellExecute(0, "Open", sFileSpec, vbNullString, vbNullString, SW_SHOWNORMAL)

If R = True Then Return

The only other thing that has changed is I added the "MouseWheel Fix", which was added before modifying the first program.

Viewing all articles
Browse latest Browse all 14989

Trending Articles