Start Menu or Autorun.INF?

  • Thread starter Thread starter zacks
  • Start date Start date
Z

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)?
 
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
 
Back
Top