|
-
Apr 29th, 2002, 04:04 AM
#1
Thread Starter
PowerPoster
Simple code?
I want to make a simple C++ program that will be put on a CD that when ran, it will open an html file on the CD, and then just quit the program. I don't want console or anything, just a quick load, and unload that I can put in my autorun.inf file. I tried adding index.html to the autorun, but it needs a valid Win32 executable to run. Can anyone help me with the code? I have this in my VB Sub Main() but the user might not have the vb runtimes installed:
VB Code:
Private 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
Private Const SW_SHOWNORMAL = 1
Sub Main()
ShellExecute hWnd, "open", App.Path & "\index.html", vbNullString, vbNullString, SW_SHOWNORMAL
End
End Sub
Thanks a lot
Joey
-
Apr 29th, 2002, 06:07 AM
#2
Code:
#include <windows.h> // the declares are in headers in C++
// the equivalent to sub main
int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
// the ShellExecute call
ShellExecute(NULL, NULL, "index.html", NULL, NULL, SW_SHOWNORMAL);
return 0;
}
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Apr 29th, 2002, 04:36 PM
#3
Thread Starter
PowerPoster
Thanks for the reply. That worked perfect! Thank you so much!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|