Am I an .EXE, or am I running under VB env? 
Author Message
 Am I an .EXE, or am I running under VB env?


Quote:

>I'm wondering if there's a way to let a program understand if it's an
>EXE file or it's running under VB environment. I need this to make
>some debugging stuff with a software I'm working on. Do you know
>something about that? Thanks :)

A straight forward way of knowing if your program is running as an EXE or
under VB is to pass a Cpmmand Line Argument, for instance "-Debug". Then
use the Command[$] function in your code to check for the Argument.

To set a Command Line Argument under VB select the Project option from
the Options menu and type the Command Line Argument.

To set a Command Line Argument for your EXE file add the Argument to the
Command Line of the Icon's properties. (Hilight the Icon in Program
Manager and select Properties from the File menu.)



Tue, 27 Jan 1998 03:00:00 GMT  
 Am I an .EXE, or am I running under VB env?
I'm wondering if there's a way to let a program understand if it's an
EXE file or it's running under VB environment. I need this to make
some debugging stuff with a software I'm working on. Do you know
something about that? Thanks :)

_________________________________________________
Gianfranco Cecconi

http://cicscu.unicam.it/~gianfry/gia/gia.htm



Tue, 27 Jan 1998 03:00:00 GMT  
 Am I an .EXE, or am I running under VB env?
: I'm wondering if there's a way to let a program understand if it's an
: EXE file or it's running under VB environment. I need this to make
: some debugging stuff with a software I'm working on. Do you know
: something about that? Thanks :)

   Sure, using a couple of Windows API calls.  What does the app.exec return?

Jim Blaich
Windows Genealogy 2.0 Author

--
***********************************************************************
***  This is a public access account provided by the Central branch ***
***  of the Contra Costa County Library.  Literally anyone can be   ***
***  using it to send this message. Their views are their own, and  ***
***  do not reflect those of the Contra Costa County Library.       ***
***********************************************************************



Tue, 27 Jan 1998 03:00:00 GMT  
 Am I an .EXE, or am I running under VB env?

Quote:
(Gianfranco Cecconi) writes:

> I'm wondering if there's a way to let a program understand if it's
> an EXE file or it's running under VB environment. I need this to
> make some debugging stuff with a software I'm working on. Do you
> know something about that? Thanks :)

From the excellent Visual Basic Tips & Tricks;

'--------------------------------------------------------------------
'  ROUTINE: InIDE:BOOL,    Params( inhwnd InputOnly )
'  Purpose: to determine if the program is running in the Integrated
'           Development Environment
'
'  Description: Uses the class of the hidden parent window to
'               determine if the program is running in the IDE or is
'               compiled into an EXE.
'
'  INPUT: inhwnd -- the window handle of the calling window
'  OUTPUT: return code is True if the program is running in the IDE,
'          False if it is an EXE
'
'--------------------------------------------------------------------
'
Function InIDE (ByVal inhwnd As Integer) As Integer

    Dim parent%, pclass$, nlen%

    parent% = GetWindowWord(inhwnd, GWW_HWNDPARENT)
    pclass$ = Space$(32)
    nlen% = GetClassName(parent%, pclass$, 31)
    pclass$ = Left$(pclass$, nlen%)
    If InStr(pclass$, "RT") Then
        InIDE = False
    Else
        InIDE = True
    End If

End Function

Use the above function in your Form_Load event to set a global flag
along the lines of;

gDebugMode = InIDE(hWnd)
If gDebugMode Then
    cmdTest.Visible = False
End If

_________________________________________________

   Cheers,

       Stu.



Wed, 28 Jan 1998 03:00:00 GMT  
 Am I an .EXE, or am I running under VB env?

Quote:

>I'm wondering if there's a way to let a program understand if it's an
>EXE file or it's running under VB environment. I need this to make
>some debugging stuff with a software I'm working on. Do you know
>something about that? Thanks :)
>_________________________________________________
>Gianfranco Cecconi

>http://cicscu.unicam.it/~gianfry/gia/gia.htm

MS doc. no. Q113680 describes how to do this.  It involves API
functions GetModuleFileName() and GetWindowWord().


Wed, 28 Jan 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. I am learning VB.NET and am wondering....

2. I am trying to update a record, i am not using data control

3. I am trying to update a record, i am not using data control

4. When is 5:00 AM not 5:00 AM? When it's 5:00 AM.

5. 50 users running Access, am I crazy.

6. Am I running in design-time ?

7. Program compiles/runs in VB env, but doesn't make

8. Attantion VB specialist : Permanent Problem- I am stack................

9. I am writing a book about VB .NET, and I need your help you

10. ADSI and VB HELP I am NEW

11. I am seaching vb old version and cpu emulator

12. Who Am I Program in VB

 

 
Powered by phpBB® Forum Software