This commit is contained in:
Birunthan Mohanathas 2010-12-25 17:13:50 +00:00
parent 2e173b69d7
commit c9c477868f

View File

@ -436,7 +436,7 @@ function are:
instance The instance of this DLL instance The instance of this DLL
iniFile The name of the ini-file (usually Rainmeter.ini) iniFile The name of the ini-file (usually Rainmeter.ini)
section The name of the section in the ini-file for this measure section The name of the section in the ini-file for this measure
id The identifier for the measure. This is used to identify the measures that use the same plugin. id The identifier for the measure. This is used to identify the measures that use the same plugin.
*/ */
UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id) UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
{ {
@ -781,30 +781,28 @@ void ExecuteBang(LPCTSTR args, UINT id)
} }
} }
if (!InstanceCreated)
{
if (COMMAND_POWER == command && CoInitialized && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER)))
{
IITBrowserWindowPtr browserWindow;
if (SUCCEEDED(iTunes->get_BrowserWindow(&browserWindow)))
{
browserWindow->put_Minimized(VARIANT_TRUE);
}
InstanceCreated = true;
}
return;
}
switch (command) switch (command)
{ {
case COMMAND_POWER: case COMMAND_POWER:
{ {
if (!InstanceCreated) iTunes->Quit();
{ iTunes.Release();
if (COMMAND_POWER == command && CoInitialized && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER))) InstanceCreated = false;
{ break;
IITBrowserWindowPtr browserWindow;
if (SUCCEEDED(iTunes->get_BrowserWindow(&browserWindow)))
{
browserWindow->put_Minimized(VARIANT_TRUE);
}
InstanceCreated = true;
}
break;
}
else
{
iTunes->Quit();
iTunes.Release();
InstanceCreated = false;
break;
}
} }
case COMMAND_TOGGLEITUNES: case COMMAND_TOGGLEITUNES:
{ {