Home All Groups Group Topic Archive Search About

Start Menu or Autorun.INF?

Author
18 Dec 2006 9:46 PM
zacks
Is there any way in VB code to tell if an application was invoked from
an Autorun.INF file on a CD/DVD or if it was invoked from the Start
Menu (or a shortcut)?

Author
19 Dec 2006 4:12 AM
Newbie Coder
If the autorun starts setup then the location is usually held in the
registry, but if you are just launching an exe then they will all do the
same thing

I suppose you can add command line attributes that would then pass the
relavant parameter to the application & handle it that way

Example:

MyApp.exe "lnk"
MyApp.exe "ar"
MyApp.exe "cmd"

In sub main you can the say:

if args(0) = "cmd" then
       messagebox.show ("Command Line")
else if args(0) = "ar" then
       messagebox.show("Autorun")
elseif args(0) = "lnk" then
       messagebox.show("Shortcut")
else
       messagebox.show ("Unknown Start Procedure")
end if

I cannot see another way to handle it apart from the above unless you know
an autorun will be from CD/DVD you can trap that by checking the path, but
for me the simple if statement running from sub main is the best idea,
making sub main the application start point

I hope this helps,

Newbie Coder

<za***@construction-imaging.com> wrote in message
Show quoteHide quote
news:1166478365.975415.281790@t46g2000cwa.googlegroups.com...
> Is there any way in VB code to tell if an application was invoked from
> an Autorun.INF file on a CD/DVD or if it was invoked from the Start
> Menu (or a shortcut)?
>