CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Sep 2017
    Posts
    7

    How to start a doc view app in hidden mode

    Hi all of you. From some time I struggle to start an MDI app in hidden mode (with an icon in system tray), but seem to appear an flicker in taskbar on application startup ...

    What I have tried ? All the solution from here:
    https://stackoverflow.com/questions/...cation-hidden/

    An important notice: there is an VS2008/VS2010 MDI project (the same behavior with VS2008 or VS2010.

    Has anyone did solved this task ? Can you help me ?

  2. #2
    Join Date
    Mar 2017
    Posts
    105

    Re: How to start a doc view app in hidden mode

    Read this It will help you.https://msdn.microsoft.com/en-us/library/ms973874.aspx
    If you like my answer,do rate it.

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

    Re: How to start a doc view app in hidden mode

    Quote Originally Posted by A_Singh View Post
    Read this It will help you.https://msdn.microsoft.com/en-us/library/ms973874.aspx
    If you like my answer,do rate it.
    How does that help the specific problem?

  4. #4
    Join Date
    Mar 2017
    Posts
    105

    Re: How to start a doc view app in hidden mode

    By reading that, one can gain more knowledge about the while topic, thus having easiness in solving the probelem, an internet search about this topic even provides some helping code snippets,

  5. #5
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: How to start a doc view app in hidden mode

    Quote Originally Posted by A_Singh View Post
    By reading that, one can gain more knowledge about the while topic, thus having easiness in solving the probelem, an internet search about this topic even provides some helping code snippets,
    That article references .net, whilst the question concerned c++.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  6. #6
    Join Date
    Mar 2017
    Posts
    105

    Re: How to start a doc view app in hidden mode


  7. #7
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: How to start a doc view app in hidden mode

    Quote Originally Posted by A_Singh View Post
    That link is broken. Error 404 not found.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

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

    Re: How to start a doc view app in hidden mode

    Quote Originally Posted by 2kaud View Post
    That link is broken. Error 404 not found.
    That and the OP isn't asking for an MDI doc/view overview. He's asking specifically how to stop the task bar flickering when the app starts up hidden.

  9. #9
    Join Date
    Mar 2017
    Posts
    105

    Re: How to start a doc view app in hidden mode

    So, please go ahead and give your solutions.

  10. #10
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: How to start a doc view app in hidden mode

    Quote Originally Posted by ioancalator View Post

    Has anyone did solved this task ? Can you help me ?
    As you might understand to the moment, the trouble part is MFC standard behavior. In fact, you tried to bend what initially designed to be straight, and by no means this is a sort of common practice obliged to have a standard solution.

    So, in case you need to get a real help with this, you have to provide here a simplistic project (or projects, as solution essence may depend on particular MFC version) that clearly demonstrates the issue.

    Dealing with explicit code is going to be much more productive by not making us guess about what 'this task' really is and what you already tried to do with that.
    Best regards,
    Igor

  11. #11
    Join Date
    Sep 2017
    Posts
    7

    Re: How to start a doc view app in hidden mode

    Kindly thank you for your interest.

    Yes, I have made an test app (in VS2008), MDI, that reveal the behavior from the first post.

    What I have tried by now ?

    Code:
    BOOL CTestApp::InitInstance()
    {
    .....
    	EnableLoadWindowPlacement(FALSE);
    
    .....
    	m_nCmdShow = SW_HIDE;
    	// Dispatch commands specified on the command line.  Will return FALSE if
    	// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
    	if (! ProcessShellCommand(cmdInfo))
    		return FALSE;
    	// The main window has been initialized, so show and update it
    	pMainFrame->ShowWindow(m_nCmdShow);
    	pMainFrame->UpdateWindow();
    
    	return TRUE;
    }
    started this test app, you will notice an flicker in taskbar (tested in Win10 64bit). The test app will automatically close after 3 seconds, in order to make easy to test it.
    That is why, you can start multiple instances (in this way, you will spot the taskbar flicker very easy), and they will clean up their self.

    I have saw that overriding
    Code:
    CWinAppEx::LoadState(LPCTSTR lpszSectionName /*=NULL*/, CFrameImpl* pFrameImpl /*= NULL*/)
    in such a way:
    Code:
    // Test.h
    virtual BOOL LoadState(LPCTSTR lpszSectionName = NULL, CFrameImpl* pFrameImpl = NULL){return TRUE;}
    the problem is solved, but I cannot do this because there is handled a lot of useful things.

    I will appreciate any help !
    Thank you.
    Attached Files Attached Files
    Last edited by ioancalator; January 15th, 2018 at 09:56 AM.

  12. #12
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: How to start a doc view app in hidden mode

    So far I can see that Test.exe built as is with VS2012 runs with no flicker in Win 7 SP1. Will give it a try with VS2010, when I find a VM with the one. Sorry, have no Win10 at hand, and have no time to install that.
    Last edited by Igor Vartanov; January 16th, 2018 at 04:04 AM.
    Best regards,
    Igor

  13. #13
    Join Date
    Sep 2017
    Posts
    7

    Re: How to start a doc view app in hidden mode

    Quote Originally Posted by Igor Vartanov View Post
    So far I can see that Test.exe built as is with VS2012 runs with no flicker in Win 7 SP1. Will give it a try with VS2010, when I find a VM with the one.
    Thank you Igor. I guess the flicker is present on Win10 as OS, rather than project VS. And this flicker are noticeable when you run the Test.exe on an not so fast PC, or, starting multiple instances from Windows Explorer (and they will automatically stop, one by one), by simply keeping Enter key on Test.exe ... in this way you easily see the taskbar flicker.

  14. #14
    Join Date
    Sep 2017
    Posts
    7

    Re: How to start a doc view app in hidden mode

    Also, I have tried:
    Code:
    BOOL CTestApp::InitInstance()
    {
    	CSettingsStoreSP::SetRuntimeClass(NULL);
    .....
    }
    no effect ...

  15. #15
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: How to start a doc view app in hidden mode

    Okay, there is an update. 32-bit Test.exe built with VS2010 runs with no flicker in Win7 x64 SP1 (Aero Theme).

    The same exe time to time (but rare) produces some flicker in a virtual machine running with extremely low resources (2 CPU cores, 2GB RAM) for Win7 x64 SP1 (Windows Classic scheme).

    So it's hardly about OS version or VS version, but just hardware resources or window manager maybe.
    Last edited by Igor Vartanov; January 16th, 2018 at 10:02 AM.
    Best regards,
    Igor

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
  •  





Click Here to Expand Forum to Full Width

Featured