Old 28th February 2012, 09:22   #1
modziw
Junior Member
 
Join Date: Nov 2008
Posts: 7
catch minimize of main window

does anyone know how i can execute an action whenever winamp is minimized? my c++ is shit and i can't seem to find a single example of how to receive this kind of a message from the window

there are examples of the reverse -- say to minimize the window. but i want to know when the user minimizes the window, so that i can execute a particular function, and then when winamp is restored, to execute another function.

specifically, i am hoping to have a gen_plugin that loads a different visualizer when winamp is off the screen (keyboard_led_flasher) and then fires up the spectrum analyzer again when back on screen

i've tried loops and switches with IPC_ISWNDVISIBLE but then winamp hangs while the loops wait for focus...

maybe there is a way to use windows messages like WM_ACTIVATEAPP, but could anyone help me figure out how to do it so that winamp doesnt hang?? i was working inside init() but its my first plugin for winamp i really have no idea whats what

appreciate any help

cheers m8s
modziw is offline   Reply With Quote
Old 28th February 2012, 19:48   #2
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: On the streets of Kings County, CA.
Posts: 3,012
Send a message via Skype™ to thinktink
If you want to poll the main window's state you would either need to do it by checking it from a timer message/function or by doing it with an intermittently sleeping thread. However I would not go polling (especially in a loop called from the context of the main UI thread) if I didn't need to.

You can either subclass the main window or hook the main window and then look for one, some, or all of the following messages:
WM_SIZE
WM_SYSCOMMAND
thinktink is offline   Reply With Quote
Old 28th February 2012, 21:10   #3
DrO
 
Join Date: Sep 2003
Posts: 27,873
using a hook would be the only safe way to do it with the scenario presented of this being for a visualisation plug-in.

-daz
DrO is offline   Reply With Quote
Old 28th February 2012, 21:24   #4
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: On the streets of Kings County, CA.
Posts: 3,012
Send a message via Skype™ to thinktink
Quote:
Originally Posted by DrO View Post
using a hook would be the only safe way to do it... ...visualisation plug-in.
Oops, hah, nice catch DrO. Forgot about that.
thinktink is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Tags
listen, minimize, visualizer plugin

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump