Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 hide the dos window
Index -> Programming, C++ -> C++ Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Geminias




PostPosted: Mon Nov 21, 2005 12:40 am   Post subject: (No subject)

yeah, i guess thats true cornflake.

oh well, if anyone stumbles across how to make the program run without a dos window that would be helpful.
Sponsor
Sponsor
Sponsor
sponsor
Geminias




PostPosted: Mon Nov 21, 2005 1:34 am   Post subject: (No subject)

hey wtd.. i found a "tutorial" about making the dos window invisible.

i can't make much sense of it though... i dont know if its either a really bad tutorial or if i'm just not advanced enough yet to put it to use.

i can't get the source it provides to work either.

Vist it here

ps. no i did not try to run it exactly as it appears here.

c++:

DWORD RunSilent(char* strFunct, char* strstrParams)
{
        STARTUPINFO StartupInfo;
        PROCESS_INFORMATION ProcessInfo;
        char Args[4096];
        char *pEnvCMD = NULL;
        char *pDefaultCMD = "CMD.EXE";
        ULONG rc;
       
        memset(&StartupInfo, 0, sizeof(StartupInfo));
        StartupInfo.cb = sizeof(STARTUPINFO);
        StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
        StartupInfo.wShowWindow = SW_HIDE;

        Args[0] = 0;

        pEnvCMD = getenv("COMSPEC");

        if(pEnvCMD){
               
                strcpy(Args, pEnvCMD);
        }
        else{
                strcpy(Args, pDefaultCMD);
        }

        // "/c" option - Do the command then terminate the command window
        strcat(Args, " /c ");
        //the application you would like to run from the command window
        strcat(Args, strFunct)
        strcat(Args, " ");
        //the parameters passed to the application being run from the command window.
        strcat(Args, strstrParams);

        if (!CreateProcess( NULL, Args, NULL, NULL, FALSE,
                CREATE_NEW_CONSOLE,
                NULL,
                NULL,
                &StartupInfo,
                &ProcessInfo))
        {
                return GetLastError();   
        }

        WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
        if(!GetExitCodeProcess(ProcessInfo.hProcess, &rc))
                rc = 0;

        CloseHandle(ProcessInfo.hThread);
        CloseHandle(ProcessInfo.hProcess);

        return rc;
       
}
[Gandalf]




PostPosted: Mon Nov 21, 2005 1:40 am   Post subject: (No subject)

From my somewhat limited experience with Dev-C++, I am almost sure that there is a 'project' option that disables the command prompt showing up. Look around there. Or else, try selecting the 'WinApi' option, not "command prompt" when creating your project.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 18 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: