//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //agenttype_mixer_destroy //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int agenttype_mixer_destroy(agent *a) { if (a->agentdetails) { //Get the details agenttype_mixer_details *details = (agenttype_mixer_details *) a->agentdetails; //Close the window if (details->hwnd_reciever) window_helper_destroy(details->hwnd_reciever); details->hwnd_reciever = NULL; //Close the mixer mixerClose(details->mixer_handle); //Delete the details delete details; a->agentdetails = NULL; } //Destroy the window if necessary mixer_controlcount--; if (mixer_controlcount < 1 && mixer_recieverregistered) { window_helper_unregister(mixer_recieverclass); mixer_recieverregistered = false; } //No errors return 0; }
void AgentType_Mixer_XP::Destroy () { if (m_hwnd_reciever) { window_helper_destroy(m_hwnd_reciever); m_hwnd_reciever = 0; } //Close the mixer mixerClose(m_mixer_handle); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //message_shutdown //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int message_shutdown() { // Destroy the hwnd... window_helper_destroy(message_window); message_window = NULL; //Unregister the class window_helper_unregister(szMessageMasterName); //No errors return 0; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //agenttype_winamp_shutdown //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int agenttype_winamp_shutdown() { //Destroy the internal tracking list if (agenttype_winamp_agents) list_destroy(agenttype_winamp_agents); //Destroy the window if (agenttype_winamp_window) window_helper_destroy(agenttype_winamp_window); //Unregister the window class if (agenttype_winamp_windowclassregistered) window_helper_unregister(agenttype_winamp_timerclass); //No errors return 0; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //agenttype_diskspacemonitor_shutdown //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int agenttype_diskspacemonitor_shutdown() { if(agenttype_diskspacemonitor_hastimer){ agenttype_diskspacemonitor_hastimer = false; KillTimer(agenttype_diskspacemonitor_window, 0); } //Destroy the internal tracking list if (agenttype_diskspacemonitor_agents) list_destroy(agenttype_diskspacemonitor_agents); //Destroy the window if (agenttype_diskspacemonitor_window) window_helper_destroy(agenttype_diskspacemonitor_window); //Unregister the window class if (agenttype_diskspacemonitor_windowclassregistered) window_helper_unregister(agenttype_diskspacemonitor_timerclass); //No errors return 0; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //agenttype_systemmonitor_shutdown //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int agenttype_systemmonitor_shutdown() { //Destroy the internal tracking list if (agenttype_systemmonitor_agents) list_destroy(agenttype_systemmonitor_agents); //Destroy the window if (agenttype_systemmonitor_window) window_helper_destroy(agenttype_systemmonitor_window); //Unregister the window class if (agenttype_systemmonitor_windowclassregistered) window_helper_unregister(agenttype_systemmonitor_timerclass); //If we have the library, free it if (agenttype_systemmonitor_ntdllmodule != NULL) { FreeLibrary(agenttype_systemmonitor_ntdllmodule); } //No errors return 0; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //agenttype_mixer_create //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int agenttype_mixer_create(agent *a, char *parameterstring) { //If there's an error bool errorflag = false;; //Check for error conditions if (strlen(parameterstring) >= 30) return false; //Break up the parts int tokensfound = BBTokenize(parameterstring, mixer_tokenptrs, 4, NULL); //Three tokens exactly required if (tokensfound != 3) return 1; long values[3]; //Make sure they are all valid integers for (int i = 0; i < 3; i++) { if (!config_set_long(mixer_tokenptrs[i], &values[i])) return 1; } //Create the details agenttype_mixer_details *details = new agenttype_mixer_details; a->agentdetails = (void *) details; //Copy the values details->device = values[0]; details->line = values[1]; details->control = values[2]; //Create the reciever window class if neccessary //No errors mixer_controlcount++; if (mixer_controlcount > 0 && !mixer_recieverregistered) { if (!window_helper_register(mixer_recieverclass, &agenttype_mixer_recieverevent)) mixer_recieverregistered = true; else errorflag = true; } //Create the reciever window details->hwnd_reciever = NULL; if (!errorflag) { details->hwnd_reciever = window_helper_create(mixer_recieverclass); if (!details->hwnd_reciever) errorflag = true; } if (!errorflag) { //Initialize the mixer values if (MMSYSERR_NOERROR != mixerOpen(&details->mixer_handle, details->device, (DWORD_PTR) details->hwnd_reciever, 0, CALLBACK_WINDOW)) errorflag = true; } if (!errorflag) { //Set the control properties details->mixer_controldetails.cbStruct = sizeof(MIXERCONTROLDETAILS); details->mixer_controldetails.dwControlID = details->control; details->mixer_controldetails.cChannels = 1; details->mixer_controldetails.cMultipleItems = 0; details->mixer_controldetails.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); //Set the window property SetProp(details->hwnd_reciever, "mixagtptr", a); } if (errorflag) { if (details->hwnd_reciever) window_helper_destroy(details->hwnd_reciever); delete details; a->agentdetails = NULL; agent_destroy(&a); return 1; } return 0; }