Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How to get the status of main window? (Read 2558 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to get the status of main window?

Hello!

I want to implement some basic function in my vis: to not let it show, when the main window is minimized at startup. All visualization plugins I saw till now show up at every song change (SW_SHOWNOACTIVATE is called at the end of window creation)

I inserted an if-then clause which checks if main window IsWindowVisible or IsIconic, but I have to do this each time there is data, because user can minimize-maximize the foobar window, and thus the vis window even during a song.
Code: [Select]
if ( cfg_stay_on_top==0 && (!IsWindowVisible(parentWindowForNow) || IsIconic(parentWindowForNow)))
     {
   if (IsWindowVisible(g_wnd))
   {
       ShowWindow(g_wnd,SW_HIDE);
   }
     }
 else
     {
   if (!IsWindowVisible(g_wnd))
   {    
       ShowWindow(g_wnd,SW_SHOWNOACTIVATE);
   }
     }

Can the same be achieved with event handling? I tried a switch for WM_SHOWWINDOW, and then switch for SW_PARENTCLOSING/OPENING inside g_windowproc, but to no avail, I've no idea how to use this right.
Code: [Select]
case WM_SHOWWINDOW:
 switch (lp)
 {
 case SW_PARENTCLOSING:
     //if (cfg_stay_on_top == 0)
   ShowWindow(wnd,SW_HIDE);
     break;
 case SW_PARENTOPENING:
     //if (cfg_stay_on_top == 0)
   ShowWindow(wnd,SW_SHOWNOACTIVATE);
     break;
 }
 break;

Maybe I could ShowWindow(g_wnd, SW_HIDE) at first, and then only activate the vis window when the main window is visible?

Anyone understand what I mean?    I would be happy if someone could help me, even though the first part of code I posted does just what I want, but I don't think thats neat and clean.

Thanks  & sorry for the long post
Life is Real...
(But not in audio :) )