[fpc-pascal] Re: Can a program find out how it was started?

Jeff Pohlmeyer yetanothergeek at gmail.com
Thu Aug 4 07:24:27 CEST 2005


> > {===========================}
> > program contest;
> > uses windows;
> >
> > var
> >   info:tSTARTUPINFO;
> >
> > begin
> >   GetStartupInfo(@info);
> >   if ( info.hStdInput = 0 )
> >   then {Started from Explorer}
> >   else {Started from Console}
> > end.
> > {===========================}

> This looks really attractive, but it doesn't work.
> I get the same value of info.hStdInput (4294967295)
> whether I run the program from the console or explorer.

Sorry, I tested in Win98 and it works fine, but Win2k is a 
whole different animal.


> So far I have been unable to find any information on 
> the fields of STARTUPINFO, so I can't figure out how
> to elaborate on this idea.
> If you have any further guidance on that, I'd appreciate it.

Maybe this will help:
http://msdn.microsoft.com/library/en-us/dllproc/base/startupinfo_str.asp
http://msdn.microsoft.com/library/en-us/dllproc/base/getstartupinfo.asp




More information about the fpc-pascal mailing list