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 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Geminias




PostPosted: Sun Nov 20, 2005 8:17 pm   Post subject: 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.
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Sun Nov 20, 2005 8:19 pm   Post subject: (No subject)

Are you using an IDE?
Geminias




PostPosted: Sun Nov 20, 2005 8:29 pm   Post subject: (No subject)

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




PostPosted: Sun Nov 20, 2005 8:31 pm   Post subject: (No subject)

Here's an idea... find the executable Dev-C++ created, if you can, and double-click it.
Geminias




PostPosted: Sun Nov 20, 2005 8:37 pm   Post subject: (No subject)

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




PostPosted: Sun Nov 20, 2005 9:02 pm   Post subject: (No subject)

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




PostPosted: Sun Nov 20, 2005 9:11 pm   Post subject: (No subject)

hmm, no after my post i checked it by running the .exe but i had no luck. the console window still appeared behind it. Crying or Very sad

i will likely have to resort to CreateProcess() and make it run silent.. unless you know of a better way?
wtd




PostPosted: Sun Nov 20, 2005 9:16 pm   Post subject: (No subject)

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.
Sponsor
Sponsor
Sponsor
sponsor
Geminias




PostPosted: Sun Nov 20, 2005 9:18 pm   Post subject: (No subject)

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




PostPosted: Sun Nov 20, 2005 9:20 pm   Post subject: (No subject)

Can I see your code? I'm seeing an "int nCmdShow" arg to WinMain that looks like it might relate to this issue.
Geminias




PostPosted: Sun Nov 20, 2005 9:28 pm   Post subject: (No subject)

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




PostPosted: Sun Nov 20, 2005 9:36 pm   Post subject: (No subject)

What happens with this sample?

code:
#include <windows.h>

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




PostPosted: Sun Nov 20, 2005 10:17 pm   Post subject: (No subject)

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




PostPosted: Sun Nov 20, 2005 10:25 pm   Post subject: (No subject)

So, C# is a decent language. Smile
md




PostPosted: Sun Nov 20, 2005 10:27 pm   Post subject: (No subject)

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.
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 1 of 2  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: