experchange > vb.* > vb.general.discussion

RobertJ (10-24-18, 07:04 PM)
Win XP Pro

Below code used for years in my application to start .EXE apps. It does
not work for one .EXE app.
I get a window asking if I want to start the app but only the red [X] works.

If I double click the .EXE app by itself it starts and runs.

Code that usually works but for one .EXE fails.
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 Declare Function GetDesktopWindow Lib "USER32" () As Long

Dim hdc As Long
Dim Fldr As String

hdc = GetDesktopWindow()
Fldr = GetParentFolderName(DPName)
Args = vbNullString

Rtn = ShellExecute(hdc, "Open", DPName, Args, Fldr, vbNormalFocus)
RobertJ (10-24-18, 08:10 PM)
I found a way around this but how to do in VB6 code ?

I open the app at the app by double-click.
The window opens and it asks if
[ ] Always Ask Before Opening ?
I uncheck, click Run and it opens. I close EXIT the app.

Then I use my VB6 app with ShellExecute and it opens OK now.

How do I overcome this in VB6 code ?

RobertJ wrote:
[..]
Mayayana (10-25-18, 04:22 PM)
"RobertJ" <RobertJ> wrote

| I open the app at the app by double-click.
| The window opens and it asks if
| [ ] Always Ask Before Opening ?
| I uncheck, click Run and it opens. I close EXIT the app.
|
| Then I use my VB6 app with ShellExecute and it opens OK now.
|
| How do I overcome this in VB6 code ?
|

I thought someone more knowledgeable than I would
have answered this, but not so far...

I use VB's Shell, only using ShellExecute for opening
non-EXEs like help files. I don't know whether that
would make a difference.

From your description it sounds like ShellExecute
is not the problem. Something (anti-virus? anti-malware?)
is stepping in to stop the program running until you
approve it. You need to figure out what that something
is and disable it. What's the title in the popup that
asks permission for the program to run? Disable that.

Or tell your customer to disable it, if it's not
your machine. It's not your problem if they've crippled
their machine.
Brian Kelly (10-25-18, 10:57 PM)
Sounds like the same thing that happens when you try to run an executable
that's been downloaded from the www unless you clear the always ask flag,
would that fit the scenario ?

"Mayayana" wrote in message news:7nj1

"RobertJ" <RobertJ> wrote

| I open the app at the app by double-click.
| The window opens and it asks if
| [ ] Always Ask Before Opening ?
| I uncheck, click Run and it opens. I close EXIT the app.
|
| Then I use my VB6 app with ShellExecute and it opens OK now.
|
| How do I overcome this in VB6 code ?
|

I thought someone more knowledgeable than I would
have answered this, but not so far...

I use VB's Shell, only using ShellExecute for opening
non-EXEs like help files. I don't know whether that
would make a difference.

From your description it sounds like ShellExecute
is not the problem. Something (anti-virus? anti-malware?)
is stepping in to stop the program running until you
approve it. You need to figure out what that something
is and disable it. What's the title in the popup that
asks permission for the program to run? Disable that.

Or tell your customer to disable it, if it's not
your machine. It's not your problem if they've crippled
their machine.
Mayayana (10-26-18, 03:59 AM)
"Brian Kelly" <Brian> wrote

| Sounds like the same thing that happens when you try to run an executable
| that's been downloaded from the www unless you clear the always ask flag,
| would that fit the scenario ?
|

I didn't think of that. Fortunately I've never actually
seen it because I run XP on FAT32. But it sounds like
a good guess. I don't see why RobertJ is suspecting
a problem with ShellExecute.
Similar Threads