Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Reply
Thread Tools Search this Thread Display Modes
Old 28th March 2010, 22:08   #1
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,182
This question is for the Winamp Devs and the Winamp SDK managers only!

In the DSP.h header file found in the SDK:

Quote:
code:
// return values from the winampUninstallPlugin(HINSTANCE hdll, HWND parent, int param)
// which determine if we can uninstall the plugin immediately or on winamp restart
#define DSP_PLUGIN_UNINSTALL_NOW 0x0
#define DSP_PLUGIN_UNINSTALL_REBOOT 0x1
//
// uninstall support was added from 5.0+ and uninstall now support from 5.5+
// it is down to you to ensure that if uninstall now is returned that it will not cause a crash
// (ie don't use if you've been subclassing the main window)

What is the window that the handle referenced by the parameter "HWND parent" supposed to be? Is there additional documentation elsewhere in the SDK about that parameter? If there is, where in the SDK is it?
thinktink is offline   Reply With Quote
Old 28th March 2010, 22:29   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
it's basically Winamp's hwnd so that messageboxes, any ui aspects required to be shown as children against can have a valid hwnd to use. the gen_lang_example shows the gen version of this being used but it applies the same for any of the uninstall callback functions.

-daz
DrO is offline   Reply With Quote
Old 28th March 2010, 22:36   #3
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,182
Quote:
Originally Posted by DrO View Post
it's basically Winamp's hwnd so that..
It's supposed to be Winamp's MAIN HWND, the very exact 100% same window the wa_ipc.h API calls are made to?
thinktink is offline   Reply With Quote
Old 29th March 2010, 00:01   #4
DrO
 
Join Date: Sep 2003
Posts: 27,873
i've double-checked the source code (is 3 years since i added that stuff to the header files considering it was missing since the 5.0 release) and the hwnd is actually the hwnd of the preference page related to the plug-in being removed which is also used for the prompt made about the uninstall in the first instance.

apologies for the confusion about this - will have to amend the headers for when an updated sdk is released to indicate this.

-daz
DrO is offline   Reply With Quote
Old 29th March 2010, 02:00   #5
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,182
Thank you for the clarification!

Is there a Winamp API I can call directly to this window handle to retrieve the actual main HWND?


Thanks in advance.
thinktink is offline   Reply With Quote
Old 29th March 2010, 09:17   #6
DrO
 
Join Date: Sep 2003
Posts: 27,873
you should be able to get Winamp's hwnd from the winampDSPModule(..) hwndParent member or define USE_DSP_HDR_HWND for the project (the header shows the HWND as a param for earlier versions as well but this is done to prevent breakages when running older dsp versions without messing up things with the client changes in 5.5+) and you'll then get Winamp's hwnd passed in the winampDSPGetHeader2(..) parameter (assuming it's a 5.5x client) and you'd have to cache that as required.

though i think due to the quirky way in which dsp's can be present & they're dynamic loading then the winampDSPGetHeader2(..) hwnd caching may not work in all cases ie if the dsp isn't loaded when the plugin is being uninstalled. i guess in that instance if you did a few GetWindow(..., GW_OWNER) calls may get the correct hwnd after a few repeated calls or just use the FindWindow(NULL, "v1.x") (which that will fail if /class has been used).

-daz
DrO is offline   Reply With Quote
Old 29th March 2010, 16:01   #7
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,182
Right now I've got:
code:
int __declspec( dllexport ) winampUninstallPlugin(HINSTANCE hdll, HWND parent, int param)
{
HWND ActualParent;
try{ActualParent=module0.hwndParent;}catch(...){ActualParent=NULL;} //cache method
if(ActualParent==NULL || !IsWindow(ActualParent)) //window walking method
{
ActualParent=GetAncestor(parent,GA_ROOTOWNER);
}
if(ActualParent==NULL || !IsWindow(ActualParent)) //searching method
{
ActualParent=FindWindow("Winamp v1.x",0);
}
if(ActualParent==NULL || !IsWindow(ActualParent)) //uber epic phail method D:
{
Application->MessageBox(TEXT("Error while init API. A manual unsinstall will be required."),TEXT("Uninstall Error"),MB_OK);
throw new Exception("Error while init API. A manual unsinstall will be required.");
}
...



Does that describe what you're talking about?
thinktink is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Tags
winampuninstallplugin

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