Starting a program hidden (Tray Icon)
-
I am developing a program that resides in the system tray and want it to start hidden. But, I am having a slight problem. I know how to start with the main window hidden, that's the easy part. The part that I'm having trouble with is that when I start the program you can see the main window flash for a split second. I've tried removing WS_VISIBLE from the mainframe, SW_HIDE on m_pMainWnd in theApp class, adding WS_ICONIC to the mainframe style, but no go. Any help on this is greatly appreciated. Bret Faller Odyssey Computing, Inc.
-
I am developing a program that resides in the system tray and want it to start hidden. But, I am having a slight problem. I know how to start with the main window hidden, that's the easy part. The part that I'm having trouble with is that when I start the program you can see the main window flash for a split second. I've tried removing WS_VISIBLE from the mainframe, SW_HIDE on m_pMainWnd in theApp class, adding WS_ICONIC to the mainframe style, but no go. Any help on this is greatly appreciated. Bret Faller Odyssey Computing, Inc.
-
I am developing a program that resides in the system tray and want it to start hidden. But, I am having a slight problem. I know how to start with the main window hidden, that's the easy part. The part that I'm having trouble with is that when I start the program you can see the main window flash for a split second. I've tried removing WS_VISIBLE from the mainframe, SW_HIDE on m_pMainWnd in theApp class, adding WS_ICONIC to the mainframe style, but no go. Any help on this is greatly appreciated. Bret Faller Odyssey Computing, Inc.
This is a wierd situation, and the solution is even wierder. I had to do this in an app a while ago and it took me a while to solve it. Change this: m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); To this: m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); And add this: m_nCmdShow = SW_HIDE; Right before you register your doc templates. Hope this helps, Frank
-
This is a wierd situation, and the solution is even wierder. I had to do this in an app a while ago and it took me a while to solve it. Change this: m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); To this: m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); And add this: m_nCmdShow = SW_HIDE; Right before you register your doc templates. Hope this helps, Frank
Thanks for the info. It surprisingly worked, somewhat. It does start hidden but when the listview refreshes the first time (2-3sec after startup) it flashes on screen. I don't see why the m_nCmdShow is any different than just passing it a simple SW_HIDE but it works better. Thanks. Bret Faller Odyssey Computing, Inc.
-
I am developing a program that resides in the system tray and want it to start hidden. But, I am having a slight problem. I know how to start with the main window hidden, that's the easy part. The part that I'm having trouble with is that when I start the program you can see the main window flash for a split second. I've tried removing WS_VISIBLE from the mainframe, SW_HIDE on m_pMainWnd in theApp class, adding WS_ICONIC to the mainframe style, but no go. Any help on this is greatly appreciated. Bret Faller Odyssey Computing, Inc.
Ok, after further analysis I've discovered the problem. After the view refreshes I have a function called ProcessReminders() and in it if a reminder has the dialog option set that means show the window. I call showwindow on the mainframe ((CMainFrame*)AfxGetMainWnd()) and pass it SW_SHOW which causes it to be shown but then the app hides it do to the SW_HIDE value of m_nCmdShow. If I comment out the showwindow line everything starts up how I want it to, but if a reminder is set to show the window I need it to show. Bret Faller Odyssey Computing, Inc.
-
Ok, after further analysis I've discovered the problem. After the view refreshes I have a function called ProcessReminders() and in it if a reminder has the dialog option set that means show the window. I call showwindow on the mainframe ((CMainFrame*)AfxGetMainWnd()) and pass it SW_SHOW which causes it to be shown but then the app hides it do to the SW_HIDE value of m_nCmdShow. If I comment out the showwindow line everything starts up how I want it to, but if a reminder is set to show the window I need it to show. Bret Faller Odyssey Computing, Inc.