VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Shell Execute Launch an Application and Open Files

EM Dixson  (6 Submissions)   Windows API Call/Explanation   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

You people are gonna LOVE ME LONG TIME for this!
This MODULE's function will load (on Call) any file name and launch it's associated application based on the file extension! I know you've see those SHELL commands that just take a couple of lines but they may or may not work in Windows 98, WindowsNT and Win2000 and guess what MINE DOES! And it does it EVERY SINGLE TIME! (You need to insert your own error traps in the Whatever_Event() of your code. *.txt, *.mdb, *.xls, *.html, *.doc, *.rtf, *.Anything Man! long as there is an associated application for the file extension!
Also has params for Specifying a working directory and you can also set the vbWhateverFocus like vbMinimized or whatever. vbNormailFocus is the default. But if you are a newbie then you don't have to set those params. Just call it like: Call Shell("C:\Wherever\YourFileIs.htm")
NOTE: THIS MOD DOES NOT SHELL TO THE WEB. IT LAUNCHES ANY FILE BUT ONLY FILES THAT ARE RESIDENT ON THE BOX OR NETWORK THAT THE PROGRAM CALLING THE FILE IS ON!!
EM Dixson
https://developer.ecorp.net

Inputs
Just paste the whole thing into one (1) new module and call name it SURETHING.BAS and call it from you form like this: Private Sub Command_Click() Call Shell("Whatever.txt") 'if the file you are calling is in the 'same folder as the progam (.EXE) that you made. 'if not then do it like this: Call Shell("C:\Path\To\Yourfile.htm")'There are some optional params and if 'you know what you are doing you'll see them. 'Even if you don't know what you are doing and you are completely lame 'and "not all there" this MOD will still work for you. Now I'm beginning 'to sound like a get rich quick ad..(I need sleep). 'Come see me at: 'http://developer.ecorp.net 'FREE Visual Basic Source Code, Tips and Tricks

Side Effects
Clean as they come!

API Declarations
'I'm just gonna paste the whole thing into one big enchilada.
'I suggest you do the same.

Rate Shell Execute Launch an Application and Open Files (5(5 Vote))
Shell Execute Launch an Application and Open Files.bas

Shell Execute Launch an Application and Open Files Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters