Q: How can I Tell whether in Design or Runtime Mode 
Author Message
 Q: How can I Tell whether in Design or Runtime Mode

Is there a way of telling which mode I am running a VB program. I want
to be able to tell whether the program is running in Design mode or
Runtime mode so that after shelling out, I can AppActivate either
Microsost Visual Basic or my application.

Thanks

--
[ Name : Daniel Grealy              ]



Sat, 30 Aug 1997 04:39:55 GMT  
 Q: How can I Tell whether in Design or Runtime Mode

Quote:

>Is there a way of telling which mode I am running a VB program. I want
>to be able to tell whether the program is running in Design mode or
>Runtime mode so that after shelling out, I can AppActivate either
>Microsost Visual Basic or my application.

Unfortunately, App.EXEName doesn't really return the name of the currently
running program when in design mode, so you have to fiddle with API calls to
get it.

First, copy the declarations of GetWindowWord, GetInstanceModule,
GetModuleFileName and GWW_HInstance from the API help file or win30api.txt.

Next, use the following code to get the EXE file name. If you're running in
design mode, it's VB.EXE; otherwise it isn't (unless you've called your
program VB :-)):

    Inst% = GetWindowWord(MasterForm.hWnd, GWW_Hinstance)
    'Where "MasterForm" is the main (or any open) form in your app.

    Inst% = GetInstanceModule(Inst%)
    'Probably not necessary. Anyone care to enlighten me?

    res% = GetModuleFileName(Inst%, Windir, Len(Windir))
    If InStr(Left(Windir, res%), "VB.EXE") Then
        MsgBox "Design Mode"
    Else
        MsgBox "Runtime"
    End If




Sat, 30 Aug 1997 18:09:47 GMT  
 Q: How can I Tell whether in Design or Runtime Mode

Quote:

>>Is there a way of telling which mode I am running a VB program. I want
>>to be able to tell whether the program is running in Design mode or
>>Runtime mode so that after shelling out, I can AppActivate either
>>Microsost Visual Basic or my application.
>Unfortunately, App.EXEName doesn't really return the name of the currently
>running program when in design mode, so you have to fiddle with API calls to
>get it.
>First, copy the declarations of GetWindowWord, GetInstanceModule,
>GetModuleFileName and GWW_HInstance from the API help file or win30api.txt.
>Next, use the following code to get the EXE file name. If you're running in
>design mode, it's VB.EXE; otherwise it isn't (unless you've called your
>program VB :-)):
>    Inst% = GetWindowWord(MasterForm.hWnd, GWW_Hinstance)
>    'Where "MasterForm" is the main (or any open) form in your app.
>    Inst% = GetInstanceModule(Inst%)
>    'Probably not necessary. Anyone care to enlighten me?
>    res% = GetModuleFileName(Inst%, Windir, Len(Windir))
>    If InStr(Left(Windir, res%), "VB.EXE") Then
>        MsgBox "Design Mode"
>    Else
>        MsgBox "Runtime"
>    End If

In design mode app.exename returns the project name. At runtime it
returns the exe name.

------------------------------------------------------------------------
Chuck Stuart - Mesquite TX USA  
VBTrace 2.00 is a runtime Procedure Trace/XReference/Debug/Profiler and
much more. Shareware $49.95.
Available from ftp.apexsc.com/pub/cgvb/visitor.
------------------------------------------------------------------------



Sat, 30 Aug 1997 20:01:32 GMT  
 Q: How can I Tell whether in Design or Runtime Mode

Quote:


>Subject: Q: How can I Tell whether in Design or Runtime Mode
>Date: Mon, 13 Mar 1995 20:39:55 +0000
>Is there a way of telling which mode I am running a VB program. I want
>to be able to tell whether the program is running in Design mode or
>Runtime mode so that after shelling out, I can AppActivate either
>Microsost Visual Basic or my application.
>Thanks

Hi Dan
At design time app.exename returns the project name. At runtime it returns the
exe name.

------------------------------------------------------------------------
Chuck Stuart - Mesquite TX USA  
VBTrace 2.00 is a runtime Procedure Trace/XReference/Debug/Profiler and
much more. Shareware $49.95.
Available from ftp.apexsc.com/pub/cgvb/visitor.
------------------------------------------------------------------------



Sat, 30 Aug 1997 20:03:29 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Q: How can I Tell whether in Design or Runtime Mode

2. HOWTO: Tell Whether an App Runs in VB Design Environment

3. Determine whether running in design mode or not

4. ?: Want to determine whether program runs in design mode or not

5. Form size changes in runtime vs design time modes

6. Differentiating between Design/Runtime Mode

7. Differentiating between Design/Runtime Modes

8. Best Way to Detect Design-Time vs RunTime Mode of an Applicatin

9. Qs about OO design

10. MainMenu does not show in design mode when Form1.vb[Design] has focus

11. VBE in User Designed Control Design Mode

12. Browser Control: Design Mode vs Compiled Mode

 

 
Powered by phpBB® Forum Software