Just a question!
Hi, I want to write a program to open files in there default programs. For example, in my program I may want to open an .html file. When ever I want to open the .html file, the file will be open in my default browser. When I want to open a .wav file, it will be opened in my default wave player. How do I do that?
Lookup ShellExecute() in your docs. That should do it.
Hang on, VB is you? Well I'm not sure about VB. It's in C++.
Edited by - Doc on January 1, 2001 6:56:51 PM
Hang on, VB is you? Well I'm not sure about VB. It's in C++.
Edited by - Doc on January 1, 2001 6:56:51 PM
My stuff.Shameless promotion: FreePop: The GPL god-sim.
It''s not "in C++", ShellExecute() is a function from the Win32 API, that means you can call it in VB just like you do in any other language, once you have properly declared it (yes, you DO have to declare API functions in C++ as well, it''s just that Microsoft already did this for you in the various .h files ).
The declaration for the ShellExecute function is as follow:
Just copy/paste this in a module, and call the function the following way:
I haven''t got the time to test it, but it should work fine. Look into MSDN if anything is wrong.
The declaration for the ShellExecute function is as follow:
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Just copy/paste this in a module, and call the function the following way:
ShellExecute 0, "open", "c:\folder\filename.ext", vbNullString, vbNullString, 0
I haven''t got the time to test it, but it should work fine. Look into MSDN if anything is wrong.
---All you base are belong to us !
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement