(asthetics) I know it can be done easily with a windows project, but how can you make a program invisible? even without iostream header file, the console box still appears. Any way to make it go away?
(asthetics) I know it can be done easily with a windows project, but how can you make a program invisible? even without iostream header file, the console box still appears. Any way to make it go away?
Behind me lies another fallen soldier...
On the Win32 platform, one solution is to design the process as a service.
Kuphryn
Or start the console application using this:Code:#include <windows.h> #include <iostream> using namespace std; bool HideConsoleWindow() { char title[MAX_PATH]; HWND hwnd; // NOTE: if you have 2000/XP and latest Platform SDK, then you can simply // call GetConsoleWindow() and pass that to ShowWindow() if (GetConsoleTitleA(title, sizeof(title)) && ((hwnd = FindWindowA(NULL, title)) != NULL) && ShowWindow(hwnd, SW_HIDE)) { return true; }//if return false; }//HideConsoleWindow int main() { if (HideConsoleWindow()) MessageBoxA(NULL, "You can't see me!", "<Nelson>:Ha-Ha", MB_OK); else cout << "Didn't work, ec = " << GetLastError() << endl; return 0; }//main
ggCode:bool StartAppHidden(char *command) { PROCESS_INFORMATION ProcInfo = {0}; STARTUPINFO si = {0}; si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; BOOL bSuccess; bSuccess = CreateProcessA(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &ProcInfo); if (!bSuccess) return false; CloseHandle(ProcInfo.hThread); CloseHandle(ProcInfo.hProcess); return true; }//StartAppHidden
There is an easy answer, if you are using Dev-C++ go to "Linker" and write Yes instead of No on the "Make a console window"
It makes sense if it's impossible, MS-DOS doesn't have multitasking capabilities, and what I really want to do is make a simple program have no console box. Yea, I am using Dev-C++, and I already did the windows deal. But whenever I include Windows.h my compile time doubles, but I guess I'll just make it winapp.
Behind me lies another fallen soldier...
>> ...MS-DOS doesn't have multitasking capabilities...
Dev-C++ creates 32bit console applications will all the capabilities of 32bit GUI applications. The only difference is that the OS creates a console window for you and hooks up standard input and standard output to that window.
Any technique you use will require windows.h, so you might as well do it the WinMain() way.
gg