CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2007
    Posts
    437

    GUI and Console Application within single application

    Hi Guys,

    today i am in some very diiferent scenario

    My client needed a GUI and Console Application within single application.

    I am able to achieve using just wriiten Main and then called WinMain based on commnadline parameters

    Code:
    	HINSTANCE inst;
    	inst=(HINSTANCE)GetModuleHandle(NULL);
            WinMain(inst,NULL,buf,SW_SHOWNORMAL);
    But if commnadline parameters say should be window based, then i hide console window using

    Code:
    		HWND console = GetConsoleWindow();
    		ConsoleWindow = 0;
    		if(IsWindow(console))
    			ShowWindow(console,SW_HIDE); // hides the window
    but as i tried to hide, it created an issue for me when i run this application on console window, it hide console window.

    so is there any way so i will be able to get whether it is run through Windows double click or througth console window. or any good solution for this issue
    Last edited by ashukasama; July 16th, 2010 at 05:00 AM. Reason: not resolved
    ashu
    always use code tag

  2. #2
    Join Date
    May 2007
    Posts
    437

    Re: [RESOLVED] GUI and Console Application within single application

    Done using FreeConsole
    ashu
    always use code tag

  3. #3
    Join Date
    May 2007
    Posts
    437

    Re: [RESOLVED] GUI and Console Application within single application

    Quote Originally Posted by ashukasama View Post
    Done using FreeConsole
    not worked as if launched from console window it will not leave console application
    ashu
    always use code tag

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: [RESOLVED] GUI and Console Application within single application

    Whenever I have that requirement, I just create a dialog application and show the dialog or not depending on command line switches.

  5. #5
    Join Date
    May 2007
    Posts
    437

    Re: [RESOLVED] GUI and Console Application within single application

    it will have same issue like
    it will be deattached from parent console window if i run application as console mode in console window.
    ashu
    always use code tag

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured