
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$.