Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,581 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,937 people online right now. Registration is fast and FREE... Join Now!




Need help writing an exe that will launch index.htm

 
Reply to this topicStart new topic

Need help writing an exe that will launch index.htm

Panarchy
26 Sep, 2008 - 07:50 PM
Post #1

New D.I.C Head
*

Joined: 28 Nov, 2007
Posts: 16


My Contributions
Hello

Can someone please help me create a program that will launch index.htm?

I need it for a CD...

I will tell the autorun.inf to;
open=indexopener.exe

Please tell me how I can make this!

Thanks in advance,

Panarchy

PS: The index.htm is in the same place as the autorun.inf
User is offlineProfile CardPM
+Quote Post

JackOfAllTrades
RE: Need Help Writing An Exe That Will Launch Index.htm
26 Sep, 2008 - 08:03 PM
Post #2

Cantankerous Old Fart
Group Icon

Joined: 23 Aug, 2008
Posts: 580



Thanked: 59 times
Dream Kudos: 50
My Contributions
Use ShellExecute.

This code should load the default web browser and point to index.htm
cpp
ShellExecute(
NULL, // No associated window
"open", // Command to run
"index.htm", // Document on which to run command
NULL, // Not an exe file, so no other parameters
NULL, // Current working directory
SW_SHOWNORMAL);


This post has been edited by JackOfAllTrades: 27 Sep, 2008 - 07:14 AM
User is offlineProfile CardPM
+Quote Post

Panarchy
RE: Need Help Writing An Exe That Will Launch Index.htm
26 Sep, 2008 - 08:11 PM
Post #3

New D.I.C Head
*

Joined: 28 Nov, 2007
Posts: 16


My Contributions
Thanks

Just tried it (in Dev-C++) and got the following errors;

1 C:\Dev-Cpp\indexopener.cpp expected constructor, destructor, or type conversion before '(' token
1 C:\Dev-Cpp\indexopener.cpp expected `,' or `;' before '(' token

Please tell me what I'm doing wrong!

Thanks in advance,

Panarchy

PS: Maybe I'm compiling it wrong? Could you please give me your cpp file?
User is offlineProfile CardPM
+Quote Post

MorphiusFaydal
RE: Need Help Writing An Exe That Will Launch Index.htm
26 Sep, 2008 - 08:26 PM
Post #4

D.I.C Lover
Group Icon

Joined: 12 May, 2005
Posts: 1,108



Thanked: 8 times
Expert In: Hardware, Networking

My Contributions
I think you need to include <windows.h>
User is online!Profile CardPM
+Quote Post

Panarchy
RE: Need Help Writing An Exe That Will Launch Index.htm
26 Sep, 2008 - 08:40 PM
Post #5

New D.I.C Head
*

Joined: 28 Nov, 2007
Posts: 16


My Contributions
Hello

Thanks once again for you reply.

Unfortuanatley I am still unable to get it to work.

Here is my .dev file;

CODE

#include <windows.h>

   ShellExecute(  
        NULL, // No associated window  
        "open", // Command to run  
        "index.htm", // Document on which to run command  
        NULL, // Not an exe file, so no other parameters  
        NULL, // Current working directory  
        SW_SHOWNORMAL);  


Please tell me what I need to add to make it work.

Thanks in advance,

Panarchy
User is offlineProfile CardPM
+Quote Post

Panarchy
RE: Need Help Writing An Exe That Will Launch Index.htm
26 Sep, 2008 - 08:47 PM
Post #6

New D.I.C Head
*

Joined: 28 Nov, 2007
Posts: 16


My Contributions
Got it to work!

WOOT

Thanks

Heres my new code;

CODE

#include <windows.h>

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = "WindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
   ShellExecute(  
        NULL, // No associated window  
        "open", // Command to run  
        "index.htm", // Document on which to run command  
        NULL, // Not an exe file, so no other parameters  
        NULL, // Current working directory  
        SW_SHOWNORMAL);  
    return 0;
}

User is offlineProfile CardPM
+Quote Post

sergio1
RE: Need Help Writing An Exe That Will Launch Index.htm
27 Sep, 2008 - 11:37 AM
Post #7

New D.I.C Head
*

Joined: 15 Jul, 2008
Posts: 30


My Contributions
on the consol you could try:
system (cd /c/d/directoryhere)
system("start index.HTML")
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/3/08 12:29AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month