Arg! I cannot hide this MFC to save my life!
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Arg! I cannot hide this MFC to save my life!

  1. #1
    Join Date
    Sep 2012
    Posts
    9

    Angry Arg! I cannot hide this MFC to save my life!

    http://read.pudn.com/downloads125/so...mple.cpp__.htm

    That is the code.. I have tried ALL sorts of stuff... For HOURS...

    Please help.

    Oddly enough I have commented out CreateWindow, and the window still gets created. Same with ShowWindow.

    Anyone know why?

    Thanks!

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,069

    Re: Arg! I cannot hide this MFC to save my life!

    What? There's no MFC in your app, and even if there were, it's not something you hide. Explain your problem in more detail.

  3. #3
    Join Date
    Sep 2012
    Posts
    9

    Re: Arg! I cannot hide this MFC to save my life!

    Yeah.. I don't quite understand.. I just want to make the window invisible to the user.
    Either moving the window position, or etc.. I don't care.

    Thanks!

  4. #4
    Join Date
    Sep 2012
    Posts
    9

    Re: Arg! I cannot hide this MFC to save my life!

    I have modified the sample to go straight to the timer and all this stuff I needed.
    The LAST thing I thought would be SO SIMPLE would be... Hiding a Window without using another program....

    Sigh!

    Without the taskbar!

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,069

    Re: Arg! I cannot hide this MFC to save my life!

    Quote Originally Posted by orokusaki View Post
    Yeah.. I don't quite understand.. I just want to make the window invisible to the user.
    Either moving the window position, or etc.. I don't care.

    Thanks!
    You're calling ShowWindow. Read up on it and the arguments it takes.

  6. #6
    Join Date
    Sep 2012
    Posts
    9

    Re: Arg! I cannot hide this MFC to save my life!

    I did.. I changed it to.. and used it twice.. (from some other thread). Still shows a window. I also tried ShowWindow( hWnd, 0 );

    The window shows even if I comment out ShowWindow, Update Window...


    if( !hWnd )
    {
    ShowWindow( hWnd, SW_HIDE );
    ShowWindow( hWnd, SW_HIDE );
    return FALSE;
    }

    ShowWindow( hWnd, SW_HIDE );
    ShowWindow( hWnd, SW_HIDE );
    UpdateWindow( hWnd );
    return TRUE;

    Still no go...

  7. #7
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,069

    Re: Arg! I cannot hide this MFC to save my life!

    You're doing that on line 112?

    Why do you have a test for !hwnd?

    Why are you doing it from another thread?

    Other than that, I guess you'll have to step through with the debugger and see which line is causing it to display.

  8. #8
    Join Date
    Sep 2012
    Posts
    9

    Re: Arg! I cannot hide this MFC to save my life!

    DialogBox( hInstance, ( LPCTSTR )IDD_SAMPLE1_DIALOG, NULL, ( DLGPROC )EM2800PropProc );
    That line seems to show the DialogBox....

    It runs after the ShowWindow and CreateWindow lines... the ones I commented out...??
    Last edited by orokusaki; April 26th, 2014 at 07:12 PM.

  9. #9
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,360

    Re: Arg! I cannot hide this MFC to save my life!

    Quote Originally Posted by orokusaki View Post
    DialogBox( hInstance, ( LPCTSTR )IDD_SAMPLE1_DIALOG, NULL, ( DLGPROC )EM2800PropProc );
    That line seems to show the DialogBox....

    It runs after the ShowWindow and CreateWindow lines... the ones I commented out...??
    What "runs"?
    What did you "comment out"?

    Besides, you might want to show your code attached to your post here in the thread.
    Please, read the Announcement: Before you post....
    Victor Nijegorodov

  10. #10
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,069

    Re: Arg! I cannot hide this MFC to save my life!

    Quote Originally Posted by orokusaki View Post
    DialogBox( hInstance, ( LPCTSTR )IDD_SAMPLE1_DIALOG, NULL, ( DLGPROC )EM2800PropProc );
    That line seems to show the DialogBox....

    It runs after the ShowWindow and CreateWindow lines... the ones I commented out...??
    That's what DialogBox does. The Dialog box and the window you create with CreateWindow are different windows.

  11. #11
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,962

    Re: Arg! I cannot hide this MFC to save my life!

    Quote Originally Posted by orokusaki View Post
    Oddly enough I have commented out CreateWindow, and the window still gets created. Same with ShowWindow.

    Anyone know why?
    There are two windows that your code creates. Commenting out CreateWindow just prevents the first window from creation. Apparently you're talking about the other window, the dialog. If you are, then you seem do nothing to hide the one.
    Best regards,
    Igor

  12. #12
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,845

    Re: Arg! I cannot hide this MFC to save my life!

    Code:
    DWORD dwStyle = ::GetWindowLong(hWnd, GWL_STYLE);
    ::SetWindowLong(hWnd, GWL_STYLE, dwStyle & ~WM_VISIBLE);

  13. #13
    Join Date
    Mar 2001
    Posts
    2,365

    Re: Arg! I cannot hide this MFC to save my life!

    This is because (in theory) MFC is meant to be seen baby!
    ahoodin
    To keep the plot moving, that's why.

  14. #14
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,845

    Re: Arg! I cannot hide this MFC to save my life!

    Quote Originally Posted by ahoodin View Post
    This is because (in theory) MFC is meant to be seen baby!
    theory has nothing to do here, and the statement is wrong.


    there are plenty of usage cases where you might use MFC but not have a UI.
    Typoically thse would be implemented as COM, Webservice, Service and don't usually need a UI directly.

    Or where the UI is just a console.


    But yes, seeing the vast majority of MFC classes is dealing with GUI controls, generally speaking an MFC app would have a visible GUI.

  15. #15
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,069

    Re: Arg! I cannot hide this MFC to save my life!

    The only place the OP is using MFC is in the misleading thread title. There's none in his code.

Page 1 of 2 12 LastLast

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center