Determine whether running in design mode or not 
Author Message
 Determine whether running in design mode or not

Hi there,

do you know a way to determine if your MSVB4.0 programs runs as an exe or
if it runs in design mode?

Thanks in adcance.
Regards
Franz GEIGER

--
*** Please answer by e-mail AND to the NG ***



Mon, 06 Mar 2000 03:00:00 GMT  
 Determine whether running in design mode or not

Quote:

> Hi there,

> do you know a way to determine if your MSVB4.0 programs runs as an exe or
> if it runs in design mode?

> Thanks in adcance.
> Regards
> Franz GEIGER

> --
> *** Please answer by e-mail AND to the NG ***

Dear Franz:  I answered another question like this:

Your working directory when in the VB environment is different
from the working directory of your compiled EXE, I'll bet.

I get around this by having, in my .MAK file, a command-line
parm

   /path=d:\directory

which I look for in program startup code.  The startup code then
changes to the appropriate drive (if need be) and directory.

The d:\directory entry, of course, points to the working directory
of the compiled EXE.

You, Franz, can use a similar trick.  If the COMMAND$ contains
/path=, you then know you're in the environment, otherwise not.

True, this isn't a scientific answer, but it's practical.
In VB4, you set the command line in Tools/Options/Advanced, I think.



Mon, 06 Mar 2000 03:00:00 GMT  
 Determine whether running in design mode or not



Quote:
>do you know a way to determine if your MSVB4.0 programs runs as an exe or
>if it runs in design mode?

That 's a frequently asked question, and I just had an idea:

The App.Path will tell you the directory, either of your VB project, or of
the exe file. If you compile the program to a different directory, you'll
not find the MAK/VBP file there, when the program is started from there!

You also can try to open the exe file For Write, what should be denied by
the system, when the compiled program is actually running.

Please post or mail me your experiences with my suggestions, I had no time
for tests yet. (ggf. auch deutsch ;-)

DoDi



Wed, 08 Mar 2000 03:00:00 GMT  
 Determine whether running in design mode or not


13:54:54 GMT):

Quote:
>do you know a way to determine if your MSVB4.0 programs runs as an exe or
>if it runs in design mode?

What I think the best way to decide this is to query the
filename of the current task (and yes, here's a problem as
well - if someone changes his VB's EXEName you're some kind
of unlucky - but you might then relate to other properties
of the file like length in bytes etc).

Basically I'd say you'd need 2 API-calls:
1) GetCurrentTask
2)TaskFindHandle
You can then use the .szModule-Property of the
TASKENTRY-structure you passed to TaskFindHandle which
contains the name of the EXE (without ".EXE").

Notice that TOLLHELP.DLL which offers TaskFindHandle is not
provided with Windows, so you'd need to include it in your
distribution.

Another thing would be to use App.EXEName if you use
different names for EXE and Project, because App.EXEName
returns the project's name when using/running under the IDE.

Depending on what you actually need this might help or need
more refinement I leave up to you.

(f'up set to comp.lang.basic.visual.misc.)

Mathias Schiffer, Germany
--
ActiveX: http://www.comports.com/Schiffer
VB-FAQ:  http://home.sol.no/jansh/vb/default.htm
--
The USA owe the UNO about 1.500.000.000 US$.



Wed, 08 Mar 2000 03:00:00 GMT  
 Determine whether running in design mode or not

Franz,

You can use the GetModuleFileName API call.  If you are compiled your
actual EXE name is
returned. If you are running under the development environment then VB.EXE
is returned.  

Hope this helps....

Jeff Sinason

http://itdcomm.com/



Quote:
> Hi there,

> do you know a way to determine if your MSVB4.0 programs runs as an exe or
> if it runs in design mode?

> Thanks in adcance.
> Regards
> Franz GEIGER

> --
> *** Please answer by e-mail AND to the NG ***



Fri, 10 Mar 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

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

2. Runs in design mode, NOT Run Time.

3. Runs in Design Mode, NOT Run Time

4. Determining Run-Time/Design-Time mode

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

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

7. change from running mode to design mode

8. Please Help......Design mode Vs. Run mode detection

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

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

11. How to determine report mode (design or preview)?

12. Determine if in Design Mode

 

 
Powered by phpBB® Forum Software