
-----------------------------------
Geminias
Sun Nov 20, 2005 8:17 pm

hide the dos window
-----------------------------------
pls tell me there is an easy way to get rid of the dos window.. i mean i'm making a window with winAPI and this stupid dos window shows in the back round all the time.

-----------------------------------
wtd
Sun Nov 20, 2005 8:19 pm


-----------------------------------
Are you using an IDE?

-----------------------------------
Geminias
Sun Nov 20, 2005 8:29 pm


-----------------------------------
yeah dev c++  

my fingers were getting sore from all the command line typing i had to do with mingw.  dev c++ is a much more friendly way to go when you're constantly testing little programs.

-----------------------------------
wtd
Sun Nov 20, 2005 8:31 pm


-----------------------------------
Here's an idea... find the executable Dev-C++ created, if you can, and double-click it.

-----------------------------------
Geminias
Sun Nov 20, 2005 8:37 pm


-----------------------------------
did you misunderstand me or am i misunderstanding you?  that is the question twirling through my brain.  

you've seen me post here often enough to know that i certainly know how to run a compiled program.  so i hope that isn't what you thought i was asking.  

just because i am not an experienced programmer does not mean i am an idiot... but you already know that right?  then why treat me like i was born yesterday?  maybe you shouldn't help people if it annoys you?  

Now for the question:

i use the windows.h preprocessor and winmain() instead of main.. i make my window and it shows up fine,  but behind it there is a dos window, is there a way to remove it?  

i dont like it there, it looks unprofessional to me.

-----------------------------------
wtd
Sun Nov 20, 2005 9:02 pm


-----------------------------------
My thinking was that the window was there because the executable was launched via the IDE, which was spawning that to show error output.

-----------------------------------
Geminias
Sun Nov 20, 2005 9:11 pm


-----------------------------------
hmm, no after my post i checked it by running the .exe but i had no luck.  the console window still appeared behind it. :cry: 

i will likely have to resort to CreateProcess() and make it run silent.. unless you know of a better way?

-----------------------------------
wtd
Sun Nov 20, 2005 9:16 pm


-----------------------------------
Trying to find something, though it's not easy considering how convoluted Microsoft's documentation is.

As for the IDE thing... I just like to rule out the simple stuff first.

-----------------------------------
Geminias
Sun Nov 20, 2005 9:18 pm


-----------------------------------
yeah i always do a google and search around before i ask any questions here.  I understand you're a linux man, but if you find anything let me know.

-----------------------------------
wtd
Sun Nov 20, 2005 9:20 pm


-----------------------------------
Can I see your code?  I'm seeing an "int nCmdShow" arg to WinMain that looks like it might relate to this issue.

-----------------------------------
Geminias
Sun Nov 20, 2005 9:28 pm


-----------------------------------
I thought that also.  It looks a lot like "show command" lol, which was the first thing i went after.  

heres a link which should dissuade you from that line of thought.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/showwindow.asp[/code]

-----------------------------------
wtd
Sun Nov 20, 2005 9:36 pm


-----------------------------------
What happens with this sample?

#include 

const char *ClsName = "BasicApp";
const char *WndName = "A Simple Window";

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg,
			   WPARAM wParam, LPARAM lParam);

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
               LPSTR lpCmdLine, int nCmdShow)
{
	MSG        Msg;
	HWND       hWnd;
	WNDCLASSEX WndClsEx;

	// Create the application window
	WndClsEx.cbSize        = sizeof(WNDCLASSEX);
	WndClsEx.style         = CS_HREDRAW | CS_VREDRAW;
	WndClsEx.lpfnWndProc   = WndProcedure;
	WndClsEx.cbClsExtra    = 0;
	WndClsEx.cbWndExtra    = 0;
	WndClsEx.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
	WndClsEx.hCursor       = LoadCursor(NULL, IDC_ARROW);
	WndClsEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	WndClsEx.lpszMenuName  = NULL;
	WndClsEx.lpszClassName = ClsName;
	WndClsEx.hInstance     = hInstance;
	WndClsEx.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

	// Register the application
	RegisterClassEx(&WndClsEx);

	// Create the window object
	hWnd = CreateWindow(ClsName,
			  WndName,
			  WS_OVERLAPPEDWINDOW,
			  CW_USEDEFAULT,
			  CW_USEDEFAULT,
			  CW_USEDEFAULT,
			  CW_USEDEFAULT,
			  NULL,
			  NULL,
			  hInstance,
			  NULL);
	
	// Find out if the window was created
	if( !hWnd ) // If the window was not created,
		return 0; // stop the application

	// Display the window to the user
	ShowWindow(hWnd, SW_SHOWNORMAL);
	UpdateWindow(hWnd);

	// Decode and treat the messages
	// as long as the application is running
	while( GetMessage(&Msg, NULL, 0, 0) )
	{
             TranslateMessage(&Msg);
             DispatchMessage(&Msg);
	}

	return Msg.wParam;
}

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,
			   WPARAM wParam, LPARAM lParam)
{
    switch(Msg)
    {
    // If the user wants to close the application
    case WM_DESTROY:
        // then close it
        PostQuitMessage(WM_QUIT);
        break;
    default:
        // Process the left-over messages
        return DefWindowProc(hWnd, Msg, wParam, lParam);
    }
    // If something was not done, let it go
    return 0;
}

-----------------------------------
Geminias
Sun Nov 20, 2005 10:17 pm


-----------------------------------
linker error, and i can't do anything about that since i dont know how to make dll's and link them and stuff

-----------------------------------
wtd
Sun Nov 20, 2005 10:25 pm


-----------------------------------
So, C# is a decent language.  :)

-----------------------------------
md
Sun Nov 20, 2005 10:27 pm


-----------------------------------
a linker error doesn't mean you need to make dlls, it just means you need to link against the right libraries. Unfortunately I don't know what they would be... but I know that they exist and that msdn should tell you what they are.

-----------------------------------
Geminias
Mon Nov 21, 2005 12:40 am


-----------------------------------
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.

-----------------------------------
Geminias
Mon Nov 21, 2005 1:34 am


-----------------------------------
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.


DWORD RunSilent(char* strFunct, char* strstrParams)
{
	STARTUPINFO StartupInfo;
	PROCESS_INFORMATION ProcessInfo;
	char Args

-----------------------------------
[Gandalf]
Mon Nov 21, 2005 1:40 am


-----------------------------------
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.
