Doubleclick

JustinCase2
01-30-2008, 02:44 AM
Is there a code equivalent to doubleclicking a random file? And letting the system decide how to open it? Or do i HAVE TO create the handler for the application the file will be opened in?

charlie
01-30-2008, 02:48 AM
What?!?!?!

Code equivalent to doubleclicking a random file: make a list of every file on your drive and open it.

Letting the system decide how to open it: you should access to the file opening options stored in the Windows registry...

I don't know what you gonna achive... :confused:

the master
01-30-2008, 02:54 AM
By random file i assume you mean whatever file the user specifies.

Simulating a double click and letting the system decide how to open it? All i can think of is that you want the ShellExecute API (http://allapi.mentalis.org/apilist/ShellExecute.shtml). No double clicking involved. You give it a filename and it opens it with whatever the default program for that type is. EG. A .doc file will open with word

JustinCase2
01-30-2008, 03:32 AM
Thats exactly what i meen. Realized it not long after i posted this. Not been using Shell much before, but ofcourse thats what I was looking for. :)

JustinCase2
01-30-2008, 04:19 AM
but it doesn't seem to want to open anything other than .exe files.

This works:




Dim ProcID As Integer
' Run Calculator.
ProcID = Shell("C:\Windows\system32\calc.exe")




But not this:




Dim ProcID As Integer
ProcID = Shell("c:\Book1.xlsx")



The file i actually need to open is an outlook .msg file...

the master
01-30-2008, 04:31 AM
Shell and ShellExecute are 2 different things. Shell() will open an exe and allow you to pass arguments to it to tell it which file to load EG "winword.exe myfile.doc". ShellExecute will allow you to pass the file you want to open and it will decide which application to open it with based on your current settings in windows

JustinCase2
01-30-2008, 06:07 AM
My bad. Works now, thanks! ;)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum