void TransportControlGroup::AttachedToWindow() { SetEnabled(EnabledButtons()); // we are now a valid BHandler if (fSeekSlider != NULL) fSeekSlider->SetTarget(this); if (fVolumeSlider != NULL) fVolumeSlider->SetTarget(this); if (fSkipBack) fSkipBack->SetTarget(this); if (fSkipForward) fSkipForward->SetTarget(this); if (fRewind) fRewind->SetTarget(this); if (fForward) fForward->SetTarget(this); fPlayPause->SetTarget(this); fStop->SetTarget(this); fMute->SetTarget(this); }
int PASCAL MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static HICON m_hIcon = 0; char szHelp[256]; switch ( uMsg ) { case WM_INITDIALOG: RECT WindowRect; GetWindowRect(hWnd, &WindowRect); POINT ScreenPos; ScreenPos.x = (GetSystemMetrics(SM_CXSCREEN)-(WindowRect.right-WindowRect.left)) / 2; ScreenPos.y = (GetSystemMetrics(SM_CYSCREEN)-(WindowRect.bottom-WindowRect.top)) / 2; MoveWindow(hWnd, ScreenPos.x, ScreenPos.y, WindowRect.right-WindowRect.left, WindowRect.bottom-WindowRect.top, false); m_hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MAIN)); SendMessage(hWnd, WM_SETICON, TRUE, (LPARAM) m_hIcon); SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM) m_hIcon); char szModuleFilename[MAX_PATH]; GetModuleFileName(g_hInstance, szModuleFilename, sizeof szModuleFilename); char szVersion[256]; GetVersionResourceEntry(szModuleFilename, TEXT("ProductVersion"), szVersion, sizeof szVersion); GetWindowText(hWnd, szHelp, sizeof szHelp); wsprintf(g_szCaption, szHelp, szVersion); SetWindowText(hWnd, g_szCaption); EnabledButtons(hWnd); DisplayInstalledVersion(hWnd); return 1; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: EndDialog(hWnd, IDCANCEL); break; case IDC_REGISTER: if ( RegisterUnregisterVPinMAME(hWnd, true) ) MessageBox(hWnd, "Visual PinMAME installed successfully!", g_szCaption, MB_ICONINFORMATION|MB_OK); DisplayInstalledVersion(hWnd); EnabledButtons(hWnd); break; case IDC_UNREGISTER: if ( RegisterUnregisterVPinMAME(hWnd, false) ) MessageBox(hWnd, "Visual PinMAME uninstalled successfully! \nYou may now safely delete your Visual PinMAME Directory!", g_szCaption, MB_ICONINFORMATION|MB_OK); DisplayInstalledVersion(hWnd); EnabledButtons(hWnd); break; case IDC_DISPLAYPATHESDLG: DisplayDialogs(hWnd, 0); break; case IDC_DISPLAYOPTSDIALOG: DisplayDialogs(hWnd, 1); break; case IDC_TESTDIALOG: RunTest(hWnd); break; case IDC_DISPLAYBAOUTDIALOG: DisplayDialogs(hWnd, 2); break; } } return 0; }