Пример #1
0
BOOL CALLBACK ConfigurePluginsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	switch(uMsg) {
		case WM_INITDIALOG:
			SetWindowText(hW, _("Configuration"));

			Button_SetText(GetDlgItem(hW, IDOK), _("OK"));
			Button_SetText(GetDlgItem(hW, IDCANCEL), _("Cancel"));
			Static_SetText(GetDlgItem(hW, IDC_BIOS), _("Bios"));			
			return OnConfigurePluginsDialog(hW);

		case WM_COMMAND:
			switch(LOWORD(wParam)) {				
				case IDCANCEL: 
					OnCancel(hW); 
					if (CancelQuit) {
						SysClose(); exit(1);
					}
					return TRUE;
				case IDOK:     
					OnOK(hW);     
					return TRUE;
			}
	}
	return FALSE;
}
Пример #2
0
LRESULT WINAPI AboutDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	switch (uMsg) {
		case WM_INITDIALOG:
			SetWindowText(hDlg, _("About"));

			Button_SetText(GetDlgItem(hDlg, IDOK), _("OK"));
			Static_SetText(GetDlgItem(hDlg, IDC_PCSX_ABOUT_TEXT), _("PCSX EMU\n"));
			Static_SetText(GetDlgItem(hDlg, IDC_PCSX_ABOUT_AUTHORS), _(LabelAuthors));
			Static_SetText(GetDlgItem(hDlg, IDC_PCSX_ABOUT_GREETS), _(LabelGreets));
			Button_SetText(GetDlgItem(hDlg,IDOK), _("OK"));
			return TRUE;

		case WM_COMMAND:
			switch (wParam) {
				case IDOK:
					EndDialog(hDlg, TRUE);
					return TRUE;
			}
			break;

		case WM_CLOSE:
			EndDialog(hDlg, TRUE);
			return TRUE;
	}
	return FALSE;
}
BOOL plFootstepSoundComponentProc::DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    IParamBlock2 *pb = pm->GetParamBlock();
    HWND hSurface = GetDlgItem(hWnd, IDC_COMP_FOOTSTEP_SOUND_SURFACE);
    HWND hPick = GetDlgItem(hWnd, IDC_COMP_FOOTSTEP_SOUND_PICK);
    INode *curPick = nil;
    int curSurface = 0;

    switch (msg)
    {
    case WM_INITDIALOG:
        {
            int i;
            for (i = 0; i < plArmatureEffectsMgr::kMaxSurface; i++)
                ComboBox_AddString(hSurface, plArmatureEffectsMgr::SurfaceStrings[i]);

            curSurface = pb->GetInt(ParamID(plFootstepSoundComponent::kSurface));
            ComboBox_SetCurSel(hSurface, curSurface);

            curPick = pb->GetINode(ParamID(plFootstepSoundComponent::kSurfaceList), 0, curSurface);
            Button_SetText(hPick, (curPick == nil ? "None" : curPick->GetName()));
        }
        return TRUE;


    case WM_COMMAND:
        if (HIWORD(wParam) == BN_CLICKED)
        {
            if (LOWORD(wParam) == IDC_COMP_FOOTSTEP_SOUND_PICK)
            {
                std::vector<Class_ID> cids;
                cids.push_back(RANDOM_SOUND_COMPONENT_ID);
                if (plPick::NodeRefKludge(pb, plFootstepSoundComponent::kNodePicker, &cids, true, false))           
                {
                    curPick = pb->GetINode(ParamID(plFootstepSoundComponent::kNodePicker));
                    curSurface = pb->GetInt(ParamID(plFootstepSoundComponent::kSurface));
                    pb->SetValue(ParamID(plFootstepSoundComponent::kSurfaceList), 0, curPick, curSurface); 
                    Button_SetText(hPick, (curPick == nil ? "None" : curPick->GetName()));
                }
            
                return TRUE;
            }
        }
        else if (LOWORD(wParam) == IDC_COMP_FOOTSTEP_SOUND_SURFACE)
        {
            curSurface = ComboBox_GetCurSel(hSurface);
            curPick = pb->GetINode(ParamID(plFootstepSoundComponent::kSurfaceList), 0, curSurface);
            pb->SetValue(ParamID(plFootstepSoundComponent::kSurface), 0, curSurface);
            Button_SetText(hPick, (curPick == nil ? "None" : curPick->GetName()));
        }
    }

    return FALSE;
}
Пример #4
0
LRESULT WINAPI AboutDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
		case WM_INITDIALOG:
			//hBMP = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(SPLASH_LOGO));
			hSilverBMP = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_PS2SILVER));

			/*hW = CreateWindow("STATIC", "", WS_VISIBLE | WS_CHILD | SS_BITMAP, 
					  230, 10, 211, 110, hDlg, (HMENU)IDC_STATIC, GetModuleHandle(NULL), NULL);
			SendMessage(hW, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hBMP);*/

			SetWindowText(hDlg, _("About PCSX2"));

			Button_SetText(GetDlgItem(hDlg, IDOK), _("OK"));
			Static_SetText(GetDlgItem(hDlg, IDC_PCSX_ABOUT_AUTHORS), _(LabelAuthors));
			Static_SetText(GetDlgItem(hDlg, IDC_PCSX_ABOUT_GREETS), _(LabelGreets));
		return TRUE;

		case WM_COMMAND:
			switch(wParam)
			{
				case IDOK:
					EndDialog( hDlg, TRUE );
				return TRUE;
			}
		return FALSE;

		case WM_CLOSE:
			EndDialog( hDlg, TRUE );
		return TRUE;
	}
	return FALSE;
}
Пример #5
0
BOOL CALLBACK PropSheetProc(HWND hwnd, UINT msg, LPARAM lParam) {
  if (msg == PSCB_PRECREATE) {
    DLGTEMPLATE *pDlgTemplate = (DLGTEMPLATE*) lParam;
    pDlgTemplate->style |= WS_THICKFRAME;
  }
  else if (msg == PSCB_INITIALIZED) {
    g_cfgwnd = hwnd;
    SetWindowSubclass(g_cfgwnd, PropSheetWinProc, 0, 0);
    UpdateStrings();

    // Set new icon specifically for the taskbar and Alt+Tab, without changing window icon
    HICON taskbar_icon = LoadImage(g_hinst, L"taskbar_icon", IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
    SendMessage(g_cfgwnd, WM_SETICON, ICON_BIG, (LPARAM)taskbar_icon);

    // OK button replaces Cancel button
    SendMessage(g_cfgwnd, PSM_CANCELTOCLOSE, 0, 0);
    HWND cancel = GetDlgItem(g_cfgwnd, IDCANCEL);
    HWND ok = GetDlgItem(g_cfgwnd, IDOK);
    Button_Enable(cancel, TRUE); // Re-enable to enable escape key
    WINDOWPLACEMENT wndpl = { sizeof(WINDOWPLACEMENT) };
    GetWindowPlacement(cancel, &wndpl);
    SetWindowPlacement(ok, &wndpl);
    ShowWindow(cancel, SW_HIDE);

    HWND apply = GetDlgItem(g_cfgwnd, IDAPPLY);
    Button_SetText(apply, L""); // Remove text to remove it's shortcut (Alt+A in English)
  }
}
Пример #6
0
VOID WINAPI pistaParaAterrarOuDescolar(HWND hControl, INT idLane, HWND hStatic)
{
	Button_GetText(hControl,buffer,MAX_BUFFER);
	if(buffer[0]=='A')
	{
		gestor->SetLanePriorityTo(Plane::LAND,idLane);
		Button_SetText(hControl,_T("Descolar"));
		Static_SetText(hStatic,_T("Dá prioridade a aterragens"));
	}
	else if(buffer[0]=='D')
	{
		gestor->SetLanePriorityTo(Plane::LIFTOFF,idLane);
		Button_SetText(hControl,_T("Aterrar"));
		Static_SetText(hStatic,_T("Dá prioridade a descolagens"));
	}
}
Пример #7
0
VOID WINAPI fecharOuAbrirPista(HWND hControl,INT idLane, HWND hStatic)
{
	Button_GetText(hControl,buffer,MAX_BUFFER);
	if(buffer[0]=='A')
	{
		gestor->abrirPista(idLane);
		Button_SetText(hControl,_T("Fechar"));
		Static_SetText(hStatic,_T("Encontra-se aberta"));
	}
	else if(buffer[0]=='F')
	{
		gestor->fecharPista(idLane);
		Button_SetText(hControl,_T("Abrir"));
		Static_SetText(hStatic,_T("Encontra-se fechada"));
	}
}
Пример #8
0
/*
 * InitControlValues() -
 */
void sd_InitControlValues(HWND sysDlg)
{
    _TUCHAR startupMsg[16];
    UINT ctrlID;
    HWND ctrl;
    int i;
    int index;

    /*
     * Startup message LCD.
     */
    FromAnsiNCopy(startupMsg, &sd_data[TX81Z_SYS_STARTUP_MSG], 16);
    LcdCtrl_SetText(GetDlgItem(sysDlg, IDC_STARTUP_MSG), startupMsg);
    /*
     * Init numeric LCD's.
     */
    for (i = 0; i < sd_numLcdInitCnt; i++) {
        ctrlID = sd_numLcdInits[i].ctrlID;
        ctrl = GetDlgItem(sysDlg, ctrlID);
        LcdCtrl_SetValue(ctrl, sd_data[ctrlID - SYS_ID_OFFSET]);
    }
    /*
     * Init special LCD's
     */
    for (i = 0; i < sd_specialLcdInitCnt; i++) {
        ctrlID = sd_specialLcdInits[i].ctrlID;
        ctrl = GetDlgItem(sysDlg, ctrlID);
        LcdCtrl_SetValue(ctrl, sd_data[ctrlID - SYS_ID_OFFSET]);
    }
    /*
     * Toggle buttons
     */
    for (i = 0; i < sd_toggleInitCnt; i++) {
        BOOL btnOn;

        /*
         * Get the ID of the next control.
         */
        ctrlID = sd_toggleInits[i].ctrlID;
        /*
         * Get the status of the button from the snapshot data.
         */
        index = ctrlID - SYS_ID_OFFSET;
        btnOn = sd_data[index] != 0;
        /*
         * Set the checked status of the button.
         */
        ctrl = GetDlgItem(sysDlg, ctrlID);
        Button_SetCheck(ctrl, btnOn);
        Button_SetText(ctrl, btnOn ? sd_toggleInits[i].modeOn
                : sd_toggleInits[i].modeOff);
    }
    sd_dirty = FALSE;
    Undo_Clear(sd_undo);
    sd_undoGroup = TRUE;
    MenuItem_Disable(sd_menu, IDM_UNDO);
    MenuItem_Disable(sd_menu, IDM_REDO);
}
Пример #9
0
void UpdateCheck_Progress(UpdateData* data, int progress) {
	if(IsWindow(data->update_window)){
		HWND control;
		control = GetDlgItem(data->update_window, IDC_PROGRESS);
		SendMessage(control, PBM_SETPOS, progress, 0);
		if(progress >= 100) {
			control = GetDlgItem(data->update_window, IDCANCEL);
			Button_SetText(control, L"Close");
		}
	}
}
Пример #10
0
/* *** SCRIPT SYMBOL: [Button] SetButtonText *** */
void SetButtonText(int guin,int objn,char*newtx) {
  VALIDATE_STRING(newtx);
  if ((guin<0) | (guin>=game.numgui))
    quit("!SetButtonText: invalid GUI number");
  if ((objn<0) | (objn>=guis[guin].numobjs))
    quit("!SetButtonText: invalid object number");
  if (guis[guin].get_control_type(objn)!=GOBJ_BUTTON)
    quit("!SetButtonText: specified control is not a button");

  GUIButton*guil=(GUIButton*)guis[guin].objs[objn];
  Button_SetText(guil, newtx);
}
Пример #11
0
void fill_header(HWND hwnd)
{
	Button_SetText(GetDlgItem(hwnd, find_bt_id), utf8_2_ansi(_("Find")));

	Button_Enable(GetDlgItem(hwnd, find_bt_id), FALSE);

	char text[1024];
	HWND hctl = GetDlgItem(hwnd, listview_id);
	LVCOLUMN lvc;

	lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
	lvc.fmt = LVCFMT_LEFT;
	lvc.cx = 90;
	strcpy(text, dgettext_2_ansi("wesnoth-hero", "name"));
	lvc.pszText = text;
	lvc.cchTextMax = 0;
	lvc.iSubItem = 0;
	ListView_InsertColumn(hctl, 0, &lvc);

	lvc.mask= LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
	lvc.cx = 60;
	lvc.iSubItem = 1;
	strcpy(text, dgettext_2_ansi("wesnoth-hero", "catalog"));
	lvc.pszText = text;
	ListView_InsertColumn(hctl, 1, &lvc);

	lvc.cx = 48;
	lvc.iSubItem = 2;
	strcpy(text, dgettext_2_ansi("wesnoth-hero", "feature"));
	lvc.pszText = text;
	ListView_InsertColumn(hctl, 2, &lvc);

	lvc.cx = 40;
	lvc.iSubItem = 3;
	strcpy(text, dgettext_2_ansi("wesnoth-hero", "side feature"));
	lvc.pszText = text;
	ListView_InsertColumn(hctl, 3, &lvc);

	lvc.cx = 40;
	lvc.iSubItem = 4;
	strcpy(text, dgettext_2_ansi("wesnoth-hero", "leadership"));
	lvc.pszText = text;
	ListView_InsertColumn(hctl, 4, &lvc);

	ListView_SetImageList(hctl, NULL, LVSIL_SMALL);
	ListView_SetExtendedListViewStyleEx(hctl, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
}
Пример #12
0
void tintegrate2::refresh(HWND hdlgP)
{
    fill_formaters();

    Button_SetText(GetDlgItem(hdlgP, IDC_BT_INTEGRATE_CONVERT), utf8_2_ansi(_("Convert to")));

    std::stringstream strstr;
    HWND hctl = GetDlgItem(hdlgP, IDC_CMB_INTEGRATE_FORMATER);
    ComboBox_ResetContent(hctl);
    for (std::vector<tformater>::const_iterator it = formaters.begin(); it != formaters.end(); ++ it) {
        const tformater& formater = *it;
        strstr.str("");
        strstr << utf8_2_ansi(formater.name) << " <=====> ";
        strstr << formater.example;
        ComboBox_AddString(hctl, strstr.str().c_str());
    }
    ComboBox_SetCurSel(hctl, 0);
}
Пример #13
0
LRESULT WINAPI AboutDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
		case WM_INITDIALOG:
			hSilverBMP = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_PS2SILVER));

			SetWindowText(hDlg, _("About PCSX2"));

			Button_SetText(GetDlgItem(hDlg, IDOK), _("OK"));
			Static_SetText(GetDlgItem(hDlg, IDC_PCSX_ABOUT_AUTHORS), _(LabelAuthors));
			Static_SetText(GetDlgItem(hDlg, IDC_PCSX_ABOUT_GREETS), _(LabelGreets));

			ConvertStaticToHyperlink( hDlg, IDC_LINK_GOOGLECODE );
			ConvertStaticToHyperlink( hDlg, IDC_LINK_WEBSITE );

		return TRUE;

		case WM_COMMAND:
			switch(wParam)
			{
				case IDOK:
					EndDialog( hDlg, TRUE );
				return TRUE;

				case IDC_LINK_WEBSITE:
					ShellExecute(hDlg, "open", "http://www.pcsx2.net/",
						NULL, NULL, SW_SHOWNORMAL);
					return TRUE;

				case IDC_LINK_GOOGLECODE:
					ShellExecute(hDlg, "open", "http://code.google.com/p/pcsx2",
						NULL, NULL, SW_SHOWNORMAL);
					return TRUE;
			}
		return FALSE;

		case WM_CLOSE:
			EndDialog( hDlg, TRUE );
		return TRUE;
	}
	return FALSE;
}
Пример #14
0
BOOL CALLBACK PropSheetProc(HWND hwnd, UINT msg, LPARAM lParam) {
  if (msg == PSCB_PRECREATE) {
    DLGTEMPLATE *pDlgTemplate = (DLGTEMPLATE*) lParam;
    pDlgTemplate->style |= WS_THICKFRAME;
  }
  else if (msg == PSCB_INITIALIZED) {
    g_cfgwnd = hwnd;
    SetWindowSubclass(g_cfgwnd, PropSheetWinProc, 0, 0);
    UpdateStrings();

    // OK button replaces Cancel button
    SendMessage(g_cfgwnd, PSM_CANCELTOCLOSE, 0, 0);
    HWND cancel = GetDlgItem(g_cfgwnd, IDCANCEL);
    HWND ok = GetDlgItem(g_cfgwnd, IDOK);
    Button_Enable(cancel, TRUE); // Re-enable to enable escape key
    WINDOWPLACEMENT wndpl = { sizeof(WINDOWPLACEMENT) };
    GetWindowPlacement(cancel, &wndpl);
    SetWindowPlacement(ok, &wndpl);
    ShowWindow(cancel, SW_HIDE);

    HWND apply = GetDlgItem(g_cfgwnd, IDAPPLY);
    Button_SetText(apply, L""); // Remove text to remove it's shortcut (Alt+A in English)
  }
}
void SetupAsServer() {
	Button_SetText(GetDlgItem(hMain, IDC_ACTION_BUTTON), "Allow Connections");
	EnableWindow(GetDlgItem(hMain, IDC_IP), FALSE);
}
Пример #16
0
INT_PTR CALLBACK UpdaterWndProc(
    __in HWND hwndDlg,
    __in UINT uMsg,
    __in WPARAM wParam,
    __in LPARAM lParam
    )
{
    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            LOGFONT lHeaderFont = { 0 };

            // load the PH main icon using the 'magic' resource id.
            HANDLE hPhIcon = LoadImage(
                GetModuleHandle(NULL),
                MAKEINTRESOURCE(PHAPP_IDI_PROCESSHACKER),
                IMAGE_ICON,
                GetSystemMetrics(SM_CXICON),
                GetSystemMetrics(SM_CYICON),
                LR_SHARED
                );

            // Set our initial state as download
            PhUpdaterState = Download;

            // Set the window icon.
            SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hPhIcon);

            lHeaderFont.lfHeight = -15;
            lHeaderFont.lfWeight = FW_MEDIUM;
            lHeaderFont.lfQuality = CLEARTYPE_QUALITY | ANTIALIASED_QUALITY;
            
            // We don't check if Segoe exists, CreateFontIndirect does this for us.
            wcscpy_s(
                lHeaderFont.lfFaceName, 
                _countof(lHeaderFont.lfFaceName), 
                L"Segoe UI"
                );

            // Create the font handle.
            FontHandle = CreateFontIndirectW(&lHeaderFont);

            // Set the header font.
            SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), WM_SETFONT, (WPARAM)FontHandle, FALSE);

            // Center the update window on PH if visible and not mimimized else center on desktop.
            PhCenterWindow(hwndDlg, (IsWindowVisible(GetParent(hwndDlg)) && !IsIconic(GetParent(hwndDlg))) ? GetParent(hwndDlg) : NULL);

            // Create our update check thread.
            UpdateCheckThreadHandle = PhCreateThread(0, (PUSER_THREAD_START_ROUTINE)CheckUpdateThreadStart, hwndDlg);
        }
        break;
    case WM_SHOWDIALOG:
        {
            if (IsIconic(hwndDlg))
                ShowWindow(hwndDlg, SW_RESTORE);
            else
                ShowWindow(hwndDlg, SW_SHOW);

            SetForegroundWindow(hwndDlg);
        }
        break;
    case WM_CTLCOLORBTN:
    case WM_CTLCOLORDLG:
    case WM_CTLCOLORSTATIC:
        {
            HDC hDC = (HDC)wParam;
            HWND hwndChild = (HWND)lParam;

            // Check for our static label and change the color.
            if (GetDlgCtrlID(hwndChild) == IDC_MESSAGE)
            {
                SetTextColor(hDC, RGB(19, 112, 171));
            }

            // Set a transparent background for the control backcolor.
            SetBkMode(hDC, TRANSPARENT);

            // set window background color.
            return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
        }
    case WM_COMMAND:
        {
            switch (LOWORD(wParam))
            {
            case IDCANCEL:
            case IDOK:
                {
                    PostQuitMessage(0);
                }
                break;
            case IDC_DOWNLOAD:
                {
                    switch (PhUpdaterState)
                    {
                    case Download:
                        {
                            if (PhInstalledUsingSetup())
                            {
                                // Start our Downloader thread
                                DownloadThreadHandle = PhCreateThread(0, (PUSER_THREAD_START_ROUTINE)DownloadUpdateThreadStart, hwndDlg);
                            }
                            else
                            {
                                // Let the user handle non-setup installation, show the homepage and close this dialog.
                                PhShellExecute(hwndDlg, L"http://processhacker.sourceforge.net/downloads.php", NULL);

                                PostQuitMessage(0);
                            }
                        }
                        break;
                    case Install:
                        {
                            SHELLEXECUTEINFO info = { sizeof(SHELLEXECUTEINFO) };
                            info.lpFile = SetupFilePath->Buffer;
                            info.lpVerb = L"runas";
                            info.nShow = SW_SHOW;
                            info.hwnd = hwndDlg;

                            ProcessHacker_PrepareForEarlyShutdown(PhMainWndHandle);

                            if (!ShellExecuteEx(&info))
                            {
                                // Install failed, cancel the shutdown.
                                ProcessHacker_CancelEarlyShutdown(PhMainWndHandle);

                                // Set button text for next action
                                Button_SetText(GetDlgItem(hwndDlg, IDC_DOWNLOAD), L"Retry");
                            }
                            else
                            {
                                ProcessHacker_Destroy(PhMainWndHandle);
                            }
                        }
                        break;
                    }
                }
                break;
            }
            break;
        }
        break;
    case WM_UPDATE:
        {
            if (IsUpdating)
            {
                DWORD time_taken;
                DWORD download_speed;        
                //DWORD time_remain = (MulDiv(time_taken, contentLength, bytesDownloaded) - time_taken);
                int percent;
                PPH_STRING dlRemaningBytes;
                PPH_STRING dlLength;
                PPH_STRING dlSpeed;
                PPH_STRING statusText;

                PhAcquireQueuedLockExclusive(&Lock);

                time_taken = (GetTickCount() - timeTransferred);
                download_speed = (bytesDownloaded / max(time_taken, 1));  
                percent = MulDiv(100, bytesDownloaded, contentLength);

                dlRemaningBytes = PhFormatSize(bytesDownloaded, -1);
                dlLength = PhFormatSize(contentLength, -1);
                dlSpeed = PhFormatSize(download_speed * 1024, -1);

                LastUpdateTime = GetTickCount();

                PhReleaseQueuedLockExclusive(&Lock);

                statusText = PhFormatString(
                    L"%s (%d%%) of %s @ %s/s",
                    dlRemaningBytes->Buffer,
                    percent,
                    dlLength->Buffer,
                    dlSpeed->Buffer
                    );

                SetDlgItemText(hwndDlg, IDC_STATUS, statusText->Buffer);
                SendDlgItemMessage(hwndDlg, IDC_PROGRESS, PBM_SETPOS, percent, 0);

                PhDereferenceObject(statusText);
                PhDereferenceObject(dlSpeed);
                PhDereferenceObject(dlLength);
                PhDereferenceObject(dlRemaningBytes);

                
                IsUpdating = FALSE; 
            }  
        }
        break;
    }

    return FALSE;
}
Пример #17
0
static NTSTATUS DownloadUpdateThreadStart(
    __in PVOID Parameter
    )
{
    PPH_STRING downloadUrlPath = NULL;
    HANDLE tempFileHandle = NULL;
    HINTERNET hInitialize = NULL, hConnection = NULL, hRequest = NULL;
    NTSTATUS status = STATUS_UNSUCCESSFUL;
    HWND hwndDlg = (HWND)Parameter;

    Button_Enable(GetDlgItem(hwndDlg, IDC_DOWNLOAD), FALSE);
    SetDlgItemText(hwndDlg, IDC_STATUS, L"Initializing");

    // Reset the progress state on Vista and above.
    if (WindowsVersion > WINDOWS_XP)
        SendDlgItemMessage(hwndDlg, IDC_PROGRESS, PBM_SETSTATE, PBST_NORMAL, 0L);

    if (!ConnectionAvailable())
        return status;

    __try
    {
        // Get temp dir.
        WCHAR tempPathString[MAX_PATH];
        DWORD tempPathLength = GetTempPath(MAX_PATH, tempPathString);

        if (tempPathLength == 0 || tempPathLength > MAX_PATH)
        {
            LogEvent(hwndDlg, PhFormatString(L"CreateFile failed (%d)", GetLastError()));
            __leave;
        }

        // create the download path string.
        downloadUrlPath = PhFormatString(
            L"/projects/processhacker/files/processhacker2/processhacker-%u.%u-setup.exe/download?use_mirror=autoselect", /* ?use_mirror=waix" */
            UpdateData.MajorVersion,
            UpdateData.MinorVersion
            );

        // Append the tempath to our string: %TEMP%processhacker-%u.%u-setup.exe
        // Example: C:\\Users\\dmex\\AppData\\Temp\\processhacker-2.10-setup.exe
        SetupFilePath = PhFormatString(
            L"%sprocesshacker-%u.%u-setup.exe",
            tempPathString,
            UpdateData.MajorVersion,
            UpdateData.MinorVersion
            );

        // Create output file
        status = PhCreateFileWin32(
            &tempFileHandle,
            SetupFilePath->Buffer,
            FILE_GENERIC_READ | FILE_GENERIC_WRITE,
            FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | FILE_ATTRIBUTE_TEMPORARY,
            FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
            FILE_OVERWRITE_IF,
            FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT
            );

        if (!NT_SUCCESS(status))
        {
            LogEvent(hwndDlg, PhFormatString(L"PhCreateFileWin32 failed (%s)", ((PPH_STRING)PHA_DEREFERENCE(PhGetNtMessage(status)))->Buffer));
            __leave;
        }

        {
            // Create a user agent string.
            PPH_STRING phVersion = PhGetPhVersion();
            PPH_STRING userAgent = PhConcatStrings2(L"PH Updater v", phVersion->Buffer);

            // Initialize the wininet library.
            if (!(hInitialize = InternetOpen(
                userAgent->Buffer,
                INTERNET_OPEN_TYPE_PRECONFIG,
                NULL,
                NULL,
                0
                )))
            {
                LogEvent(hwndDlg, PhFormatString(L"Updater: (InitializeConnection) InternetOpen failed (%d)", GetLastError()));

                PhDereferenceObject(userAgent);
                PhDereferenceObject(phVersion);

                __leave;
            }

            PhDereferenceObject(userAgent);
            PhDereferenceObject(phVersion);
        }

        // Connect to the server.
        if (!(hConnection = InternetConnect(
            hInitialize,
            L"sourceforge.net",
            INTERNET_DEFAULT_HTTP_PORT,
            NULL,
            NULL,
            INTERNET_SERVICE_HTTP,
            0,
            0)))
        {
            LogEvent(hwndDlg, PhFormatString(L"InternetConnect failed (%d)", GetLastError()));
            __leave;
        }

        // Open the HTTP request.
        if (!(hRequest = HttpOpenRequest(
            hConnection,
            NULL,
            downloadUrlPath->Buffer,
            NULL,
            NULL,
            NULL,
            INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RESYNCHRONIZE,
            0
            )))
        {
            LogEvent(hwndDlg, PhFormatString(L"HttpOpenRequest failed (%d)", GetLastError()));
            __leave;
        }

        SetDlgItemText(hwndDlg, IDC_STATUS, L"Connecting");

        // Send the HTTP request.
        if (!HttpSendRequest(hRequest, NULL, 0, NULL, 0))
        {
            LogEvent(hwndDlg, PhFormatString(L"HttpSendRequest failed (%d)", GetLastError()));

            // Enable the 'Retry' button.
            Button_Enable(GetDlgItem(hwndDlg, IDC_DOWNLOAD), TRUE);
            SetDlgItemText(hwndDlg, IDC_DOWNLOAD, L"Retry");

            // Reset the state and let user retry the download.
            PhUpdaterState = Download;
        }
        else
        {
            BYTE hashBuffer[20]; 
            DWORD contentLengthSize = sizeof(DWORD);
            PH_HASH_CONTEXT hashContext;

            // Initialize hash algorithm.
            PhInitializeHash(&hashContext, Sha1HashAlgorithm);

            if (!HttpQueryInfoW(hRequest, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &contentLength, &contentLengthSize, 0))
            {
                // No content length...impossible to calculate % complete...
                // we can read the data, BUT in this instance Sourceforge always returns the content length
                // so instead we'll exit here instead of downloading the file.
                LogEvent(hwndDlg, PhFormatString(L"HttpQueryInfo failed (%d)", GetLastError()));
                __leave;
            }
            else
            {
                BYTE buffer[PAGE_SIZE];
                DWORD bytesRead = 0, startTick = 0;
                IO_STATUS_BLOCK isb;

                // Zero the buffer.
                ZeroMemory(buffer, PAGE_SIZE);

                // Reset the counters.
                bytesDownloaded = 0, timeTransferred = 0, LastUpdateTime = 0;
                IsUpdating = FALSE;

                // Start the clock.
                startTick = GetTickCount();
                timeTransferred = startTick;

                // Download the data.
                while (InternetReadFile(hRequest, buffer, PAGE_SIZE, &bytesRead))
                {
                    // If we get zero bytes, the file was uploaded or there was an error.
                    if (bytesRead == 0)
                        break;

                    // If window closed and thread handle was closed, just dispose and exit.
                    // (This also skips error checking/prompts and updating the disposed UI)
                    if (!DownloadThreadHandle)
                        __leave;

                    // Update the hash of bytes we downloaded.
                    PhUpdateHash(&hashContext, buffer, bytesRead);

                    // Write the downloaded bytes to disk.
                    status = NtWriteFile(
                        tempFileHandle,
                        NULL,
                        NULL,
                        NULL,
                        &isb,
                        buffer,
                        bytesRead,
                        NULL,
                        NULL
                        );

                    if (!NT_SUCCESS(status))
                    {
                        PPH_STRING message = PhGetNtMessage(status);

                        LogEvent(hwndDlg, PhFormatString(L"NtWriteFile failed (%s)", message->Buffer));

                        PhDereferenceObject(message);
                        break;
                    }

                    // Check dwBytesRead are the same dwBytesWritten length returned by WriteFile.
                    if (bytesRead != isb.Information)
                    {
                        PPH_STRING message = PhGetNtMessage(status);

                        LogEvent(hwndDlg, PhFormatString(L"NtWriteFile failed (%s)", message->Buffer));

                        PhDereferenceObject(message);
                        break;
                    }
                                        
                    // Update our total bytes downloaded
                    PhAcquireQueuedLockExclusive(&Lock);
                    bytesDownloaded += (DWORD)isb.Information;
                    PhReleaseQueuedLockExclusive(&Lock);

                    AsyncUpdate();
                }

                // Check if we downloaded the entire file.
                assert(bytesDownloaded == contentLength);

                // Compute our hash result.
                if (PhFinalHash(&hashContext, &hashBuffer, 20, NULL))
                {
                    // Allocate our hash string, hex the final hash result in our hashBuffer.
                    PPH_STRING hexString = PhBufferToHexString(hashBuffer, 20);

                    if (PhEqualString(hexString, UpdateData.Hash, TRUE))
                    {
                        // If PH is not elevated, set the UAC shield for the install button as the setup requires elevation.
                        if (!PhElevated)
                            SendMessage(GetDlgItem(hwndDlg, IDC_DOWNLOAD), BCM_SETSHIELD, 0, TRUE);

                        // Set the download result, don't include hash status since it succeeded.
                        //SetDlgItemText(hwndDlg, IDC_STATUS, L"Download Complete");
                        // Set button text for next action
                        Button_SetText(GetDlgItem(hwndDlg, IDC_DOWNLOAD), L"Install");
                        // Enable the Install button
                        Button_Enable(GetDlgItem(hwndDlg, IDC_DOWNLOAD), TRUE);
                        // Hash succeeded, set state as ready to install.
                        PhUpdaterState = Install;
                    }
                    else
                    {
                        if (WindowsVersion > WINDOWS_XP)
                            SendDlgItemMessage(hwndDlg, IDC_PROGRESS, PBM_SETSTATE, PBST_ERROR, 0L);

                        SetDlgItemText(hwndDlg, IDC_STATUS, L"Download complete, SHA1 Hash failed.");

                        // Set button text for next action
                        Button_SetText(GetDlgItem(hwndDlg, IDC_DOWNLOAD), L"Retry");
                        // Enable the Install button
                        Button_Enable(GetDlgItem(hwndDlg, IDC_DOWNLOAD), TRUE);
                        // Hash failed, reset state to downloading so user can redownload the file.
                        PhUpdaterState = Download;
                    }

                    PhDereferenceObject(hexString);
                }
                else
                {
                    //SetDlgItemText(hwndDlg, IDC_STATUS, L"PhFinalHash failed");

                    // Show fancy Red progressbar if hash failed on Vista and above.
                    if (WindowsVersion > WINDOWS_XP)
                        SendDlgItemMessage(hwndDlg, IDC_PROGRESS, PBM_SETSTATE, PBST_ERROR, 0L);
                }
            }
        }

        status = STATUS_SUCCESS;
    }
    __finally
    {
        if (hInitialize)
        {
            InternetCloseHandle(hInitialize);
            hInitialize = NULL;
        }

        if (hConnection)
        {
            InternetCloseHandle(hConnection);
            hConnection = NULL;
        }

        if (hRequest)
        {
            InternetCloseHandle(hRequest);
            hRequest = NULL;
        }

        if (tempFileHandle)
        {
            NtClose(tempFileHandle);
            tempFileHandle = NULL;
        }

        if (downloadUrlPath)
        {
            PhDereferenceObject(downloadUrlPath);
            downloadUrlPath = NULL;
        }
    }

    return status;
}
Пример #18
0
/*响应开始测试按钮*/
LONG OnBtnStart(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	//MapInit(hDlg);
	SetButtonEnble(hDlg,FALSE);
	//读取类型
	g_sType[0] = NULL;
	HWND combox = GetDlgItem(hDlg,IDC_COMBOX_TYPE);
	ComboBox_GetText(combox,(LPWSTR)g_sType,10);


	if (*g_sType == NULL) 
	{
		SetButtonEnble(hDlg,TRUE);
		return FALSE;
	}

	//打开类型文档读取速度
	_stprintf_s(TestsFileName,50,_T("\\NandFlash\\detector_"));
	memcpy(TestsFileName+20,g_sType,5);
	int i = 0;
	for (i = 0; i <5; i++)
	{
		if (g_sType[i] == NULL)
		{
			break;
		}
	}
	_stprintf_s(TestsFileName+20+i,60,_T(".txt"));

	HANDLE hFile = CreateFile(TestsFileName,
		GENERIC_READ ,
		FILE_SHARE_READ,
		NULL,
		OPEN_EXISTING,
		FILE_ATTRIBUTE_NORMAL,
		0);
	if( hFile == INVALID_HANDLE_VALUE)
		return FALSE;
	char detector[120] = {NULL};//读取文件内容到该缓存
	TCHAR buf[20] = {NULL};
	DWORD dwRead = -1;
	ReadFile(hFile,(LPVOID)detector,120,&dwRead,NULL);
	memcpy(buf,detector+75,20);
	Edit_SetText(GetDlgItem(hDlg,IDC_EDIT_RSpeed),(LPCWSTR)buf);A	g_dwRatedSpeed = GetDlgItemInt(hDlg,IDC_EDIT_RSpeed,NULL,FALSE);
	memcpy(buf,detector+105,10);
	Edit_SetText(GetDlgItem(hDlg,IDC_EDIT_RSpeedLimitLow),(LPCWSTR)buf);
	g_dwRatedSpeedLimitLow = GetDlgItemInt(hDlg,IDC_EDIT_RSpeedLimitLow,NULL,FALSE);
	memcpy(buf,detector+95,10);
	Edit_SetText(GetDlgItem(hDlg,IDC_EDIT_RSpeedLimitUp),(LPCWSTR)buf);
	g_dwRatedSpeedLimitUp = GetDlgItemInt(hDlg,IDC_EDIT_RSpeedLimitUp,NULL,FALSE);




	CloseHandle(hFile);

	//读取编号

	g_sId[0] = NULL;
	GetDlgItemText(hDlg,IDC_EDIT_ID,g_sId,10);
	if (*g_sId0 == NULL)
	{
		for (i = 0; i<10; i++)
		{
			g_sId0[i] = g_sId[i];
			g_sType0[i] = g_sType[i];
		}

	}
	else
	{
		if ((*g_sType == *g_sType0)&&(*g_sId == *g_sId0))
		{
			SetButtonEnble(hDlg,TRUE);
			wsprintf(buf,TEXT("请改型号或点下一次!"));
			Edit_SetText(GetDlgItem(hDlg,IDC_BtnStart),buf);
			return FALSE;
		}

	}

	//g_sId[0] =(TCHAR ) GetDlgItemText(hDlg,IDC_EDIT_ID,NULL,FALSE);
	g_iOrder = 1;

	if (!demo)
	{


		if (hServoComPort == INVALID_HANDLE_VALUE) 
		{
			HWND hand = GetDlgItem(hDlg,IDC_BtnStart);
			TCHAR buf[64];
			wsprintf(buf,TEXT("与放大器串口通信失败!"));
			Button_SetText(hand,buf);
			SetButtonEnble(hDlg,TRUE);
			return FALSE;
		}
		if ( *g_sId == NULL)
		{
			HWND hand = GetDlgItem(hDlg,IDC_EDIT_ID);
			SetFocus(hand);
			TCHAR buf[64];
			wsprintf(buf,TEXT("请输编号!"));
			Edit_SetText(hand,buf);
			SetButtonEnble(hDlg,TRUE);
			return FALSE;
		}


	}
	else
	{
		Gonvernor gonvernor;
		gonvernor.SetGonvernor();
		gonvernor.GetVelocity(g_dwVelocity,count);

		TCHAR buf[64];
		HWND hand = GetDlgItem(hDlg,IDC_EDIT_Type);
		gonvernor.GetType(buf);
		Edit_SetText(hand,buf);

		hand = GetDlgItem(hDlg,IDC_EDIT_ID);
		gonvernor.GetID(buf);
		Edit_SetText(hand,buf);
		

		hand = GetDlgItem(hDlg,IDC_EDIT_RSpeed);
		//gonvernor.GetRSpeed(&dwbuf);
		//wsprintf(buf,TEXT("%.0f"),dwbuf);
		Edit_SetText(hand,buf);

		hand = GetDlgItem(hDlg,IDC_EDIT_ESpeed);
		//gonvernor.GetESpeed(&dwbuf);
		//wsprintf(buf,TEXT("%.0f"),dwbuf);
		//Edit_SetText(hand,buf);

		hand = GetDlgItem(hDlg,IDC_EDIT_MSpeed);
		//gonvernor.GetMSpeed(&dwbuf);
		//wsprintf(buf,TEXT("%.0f"),dwbuf);
		//Edit_SetText(hand,buf);

		int nbuf;
		hand = GetDlgItem(hDlg,IDC_EDIT_Order);
		gonvernor.GetOrder(&nbuf);
		gonvernor.GetOrder(&g_iIndex);
		wsprintf(buf,TEXT("%d"),nbuf);
		Edit_SetText(hand,buf);
	}

	MainThreadStart = TRUE;

	return TRUE;
}
Пример #19
0
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
  static HWND hwndDoIt;
  static HWND hwndClear;
  static HWND hwndExit;
  
  switch (Msg) {
  case WM_CREATE:
    hwndEdit = CreateWindow(SYX_IFDEF_UNICODE ("EDIT"),
			    NULL,
			    WS_CHILD | WS_VISIBLE | WS_HSCROLL |
			    WS_VSCROLL | ES_LEFT | ES_MULTILINE |
			    ES_AUTOHSCROLL | ES_AUTOVSCROLL,
			    0, 0, 0, 0,
			    hWnd,
			    0,
			    hInstance,
			    NULL);
    if (!hwndEdit)
      {
	MessageBox(0, SYX_IFDEF_UNICODE ("Could not create workspace"),
		   SYX_IFDEF_UNICODE ("Error"), 0);
	exit(1);
      }
    Edit_SetText (hwndEdit, SYX_IFDEF_UNICODE ("'Hello PocketPC' printNl"));

    hwndDoIt = CreateWindow(SYX_IFDEF_UNICODE ("BUTTON"),
			    NULL,
			    WS_CHILD | WS_VISIBLE | ES_LEFT,
			    0, 0, 0, 0,
			    hWnd,
			    (HMENU) ID_BTN_DOIT,
			    hInstance,
			    NULL);
    if (!hwndDoIt)
      {
	MessageBox(0, SYX_IFDEF_UNICODE ("Could not create button"), SYX_IFDEF_UNICODE ("Error"), 0);
	exit(1);
      }
    Button_SetText (hwndDoIt, SYX_IFDEF_UNICODE ("&DoIt"));

    hwndClear = CreateWindow(SYX_IFDEF_UNICODE ("BUTTON"),
			     NULL,
			     WS_CHILD | WS_VISIBLE | ES_LEFT,
			     0, 0, 0, 0,
			     hWnd,
			     (HMENU) ID_BTN_CLEAR,
			     hInstance,
			     NULL);
    if (!hwndClear)
      {
	MessageBox(0, SYX_IFDEF_UNICODE ("Could not create button"), SYX_IFDEF_UNICODE ("Error"), 0);
	exit(1);
      }
    Button_SetText (hwndClear, SYX_IFDEF_UNICODE ("&Clear"));

    hwndExit = CreateWindow(SYX_IFDEF_UNICODE ("BUTTON"),
			    NULL,
			    WS_CHILD | WS_VISIBLE | ES_LEFT,
			    0, 0, 0, 0,
			    hWnd,
			    (HMENU) ID_BTN_EXIT,
			    hInstance,
			    NULL);
    if (!hwndExit)
      {
	MessageBox(0, SYX_IFDEF_UNICODE ("Could not create button"), SYX_IFDEF_UNICODE ("Error"), 0);
	exit(1);
      }
    Button_SetText (hwndExit, SYX_IFDEF_UNICODE ("E&xit"));
    break;
  case WM_SIZE:
    MoveWindow(hwndEdit, 1, 21, LOWORD(lParam)+1, HIWORD(lParam) - 21, TRUE);
    MoveWindow(hwndDoIt, 1, 0, 50, 20, TRUE);
    MoveWindow(hwndClear, 60, 0, 50, 20, TRUE);
    MoveWindow(hwndExit, LOWORD(lParam)-50, 0, 50, 20, TRUE);
    break;
  case WM_DESTROY:
    exit (0);
    break;
  case WM_COMMAND:
    switch (LOWORD(wParam))
      {
      case ID_BTN_DOIT:
	{
	  syx_size length = Edit_GetTextLength (hwndEdit) + 1;
	  SYX_IFDEF_CHAR_T *text = syx_calloc (length + 1, sizeof (SYX_IFDEF_CHAR_T));
	  Edit_GetText (hwndEdit, text, length);
	  text[length] = '\0';
	  SyxOop stext = syx_string_new (SYX_IFDEF_ANSI (text));
	  syx_free (text);
	  /* Pop out from the stack the true object previously pushed
	     by WinGui_IterateLoop. We'll enter another context, which will return
	     another object (push the object into the stack of this context).
	     The true object is in other words the default object returned by the
	     loop iteration, but now we let the new context push its object without growing
	     the stack versus infinite.
	  */
	  syx_interp_stack_pop ();
	  syx_interp_enter_context (syx_processor_active_process,
                                    syx_send_binary_message (syx_globals_at ("WinWorkspace"),
							     "doIt:",
							     stext));
	}
	break;
      case ID_BTN_CLEAR:
	Edit_SetText (hwndEdit, "");
	break;
      case ID_BTN_EXIT:
	exit (0);
	break;
      }
  default:
    return DefWindowProcW(hWnd, Msg, wParam, lParam);
  }
  return 0;
}
Пример #20
0
INT_PTR CALLBACK DiskDriveOptionsDlgProc(
    _In_ HWND hwndDlg,
    _In_ UINT uMsg,
    _In_ WPARAM wParam,
    _In_ LPARAM lParam
    )
{
    PDV_DISK_OPTIONS_CONTEXT context = NULL;

    if (uMsg == WM_INITDIALOG)
    {
        context = (PDV_DISK_OPTIONS_CONTEXT)PhAllocate(sizeof(DV_DISK_OPTIONS_CONTEXT));
        memset(context, 0, sizeof(DV_DISK_OPTIONS_CONTEXT));

        SetProp(hwndDlg, L"Context", (HANDLE)context);
    }
    else
    {
        context = (PDV_DISK_OPTIONS_CONTEXT)GetProp(hwndDlg, L"Context");

        if (uMsg == WM_DESTROY)
        {
            if (context->OptionsChanged)
                DiskDrivesSaveList();

            FreeListViewDiskDriveEntries(context);

            RemoveProp(hwndDlg, L"Context");
            PhFree(context);
        }
    }

    if (context == NULL)
        return FALSE;

    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            // Center the property sheet.
            PhCenterWindow(GetParent(hwndDlg), GetParent(GetParent(hwndDlg)));
            // Hide the OK button.
            ShowWindow(GetDlgItem(GetParent(hwndDlg), IDOK), SW_HIDE);
            // Set the Cancel button text.
            Button_SetText(GetDlgItem(GetParent(hwndDlg), IDCANCEL), L"Close");

            context->ListViewHandle = GetDlgItem(hwndDlg, IDC_DISKDRIVE_LISTVIEW);
            PhSetListViewStyle(context->ListViewHandle, FALSE, TRUE);
            ListView_SetExtendedListViewStyleEx(context->ListViewHandle, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
            PhSetControlTheme(context->ListViewHandle, L"explorer");
            PhAddListViewColumn(context->ListViewHandle, 0, 0, 0, LVCFMT_LEFT, 350, L"Disk Drives");
            PhSetExtendedListView(context->ListViewHandle);
           
            if (WindowsVersion >= WINDOWS_VISTA)
            {
                ListView_EnableGroupView(context->ListViewHandle, TRUE);
                AddListViewGroup(context->ListViewHandle, 0, L"Connected");
                AddListViewGroup(context->ListViewHandle, 1, L"Disconnected");
            }

            FindDiskDrives(context);

            context->OptionsChanged = FALSE;

            EnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB);
        }
        break;
    case WM_NOTIFY:
        {
            LPNMHDR header = (LPNMHDR)lParam;

            if (header->code == LVN_ITEMCHANGED)
            {
                LPNM_LISTVIEW listView = (LPNM_LISTVIEW)lParam;

                if (context->EnumeratingDisks)
                    break;

                if (listView->uChanged & LVIF_STATE)
                {
                    switch (listView->uNewState & LVIS_STATEIMAGEMASK)
                    {
                    case 0x2000: // checked
                        {
                            PDV_DISK_ID param = (PDV_DISK_ID)listView->lParam;

                            if (!FindDiskEntry(param, FALSE))
                            {
                                PDV_DISK_ENTRY entry;

                                entry = CreateDiskEntry(param);
                                entry->UserReference = TRUE;
                            }

                            context->OptionsChanged = TRUE;
                        }
                        break;
                    case 0x1000: // unchecked
                        {
                            PDV_DISK_ID param = (PDV_DISK_ID)listView->lParam;

                            FindDiskEntry(param, TRUE);

                            context->OptionsChanged = TRUE;
                        }
                        break;
                    }
                }
            }
            else if (header->code == NM_RCLICK)
            {
                PDV_DISK_ID param;
                PPH_STRING deviceInstance;

                if (param = PhGetSelectedListViewItemParam(context->ListViewHandle))
                {
                    if (deviceInstance = FindDiskDeviceInstance(param->DevicePath))
                    {
                        ShowDeviceMenu(hwndDlg, deviceInstance);
                        PhDereferenceObject(deviceInstance);
                    }
                }
            }
        }
        break;
    }

    return FALSE;
}
Пример #21
0
	BOOL Button::SetText(LPCWSTR text)
	{
		return Button_SetText(ThisWindow, text);
	}
Пример #22
0
    BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
        int selection;
        HWND cbox = NULL;
        HWND hList = GetDlgItem(hWnd, IDC_COMP_LOD_AVATAR_BONELIST);

        switch (msg)
        {
        case WM_INITDIALOG:
            {
                int LodBeginState   = map->GetParamBlock()->GetInt(plLODAvatarComponent::kLODState);

                HWND LODCombo = GetDlgItem(hWnd, IDC_COMP_LOD_AVATAR_STATE);
    
                fMstrDlg = hWnd;
            
                fPB = map->GetParamBlock();
                fComp = (plLODAvatarComponent*) fPB->GetOwner();

                VCharArray Nilptr;
                ILoadComboBox(LODCombo, fComp->fLODLevels);
                SendMessage(LODCombo, CB_SETCURSEL, LodBeginState,  0); // select the right one

                int i;
                for (i = 0; i < plClothingMgr::kMaxGroup; i++)
                {
                    cbox = GetDlgItem(hWnd, IDC_COMP_AVATAR_CLOTHING_GROUP);
                    SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plClothingMgr::GroupStrings[i]);
                }
                selection = fPB->GetInt(ParamID(plLODAvatarComponent::kClothingGroup));
                SendMessage(cbox, CB_SETCURSEL, selection, 0);

                for (i = 0; i < plArmatureMod::kMaxBoneBase; i++)
                {
                    cbox = GetDlgItem(hWnd, IDC_COMP_AVATAR_SKELETON);
                    SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plArmatureMod::BoneStrings[i]);
                }
                selection = fPB->GetInt(ParamID(plLODAvatarComponent::kSkeleton));
                SendMessage(cbox, CB_SETCURSEL, selection, 0);

                Mtl *mat = fPB->GetMtl(plLODAvatarComponent::kMaterial);
                Button_SetText(GetDlgItem(hWnd, IDC_COMP_LOD_AVATAR_MTL), (mat ? mat->GetName() : "(none)"));

                UpdateBoneDisplay(map);
                return true;
            }

        case WM_COMMAND:
            if (LOWORD(wParam) == IDC_COMP_AVATAR_CLOTHING_GROUP)
            {
                selection = SendMessage(GetDlgItem(hWnd, IDC_COMP_AVATAR_CLOTHING_GROUP), CB_GETCURSEL, 0, 0);
                fPB->SetValue(ParamID(plLODAvatarComponent::kClothingGroup), t, selection);
                return TRUE;
            }
            else if (LOWORD(wParam) == IDC_COMP_AVATAR_SKELETON)
            {
                selection = SendMessage(GetDlgItem(hWnd, IDC_COMP_AVATAR_SKELETON), CB_GETCURSEL, 0, 0);
                fPB->SetValue(ParamID(plLODAvatarComponent::kSkeleton), t, selection);
                return TRUE;
            }
            else if (HIWORD(wParam) == BN_CLICKED)
            {
                if (LOWORD(wParam) == IDC_COMP_LOD_AVATAR_BONE_ADD)
                {
                    std::vector<Class_ID> cids;
                    cids.push_back(Class_ID(TRIOBJ_CLASS_ID, 0));
                    cids.push_back(Class_ID(EDITTRIOBJ_CLASS_ID, 0));
                    if (plPick::NodeRefKludge(fPB, plLODAvatarComponent::kLastPick, &cids, true, false))            
                        fComp->AddSelectedBone();

                    return TRUE;
                }
                // Remove the currently selected material
                else if (LOWORD(wParam) == IDC_COMP_LOD_AVATAR_BONE_REMOVE)
                {
                    int curSel = SendMessage(hList, LB_GETCURSEL, 0, 0);
                    if (curSel >= 0)
                        fComp->RemoveBone(curSel);

                    return TRUE;
                }
                else if (LOWORD(wParam) == IDC_COMP_LOD_AVATAR_MTL)
                {
                    Mtl *pickedMtl = plPickMaterialMap::PickMaterial(plMtlCollector::kPlasmaOnly);
                    fPB->SetValue(plLODAvatarComponent::kMaterial, 0, pickedMtl);
                    Button_SetText(GetDlgItem(hWnd, IDC_COMP_LOD_AVATAR_MTL), (pickedMtl ? pickedMtl->GetName() : "(none)"));

                    return TRUE;
                }
            }
            else 
            {
                int LodBeginState   = map->GetParamBlock()->GetInt(plLODAvatarComponent::kLODState);
                
                if(fPB->GetINode(plLODAvatarComponent::kMeshNodeAddBtn,t))
                    fPB->SetValue(plLODAvatarComponent::kMeshNodeTab, t, fPB->GetINode(plLODAvatarComponent::kMeshNodeAddBtn,t), LodBeginState);
                    
                if(LOWORD(wParam) == IDC_COMP_LOD_AVATAR_STATE && HIWORD(wParam) == CBN_SELCHANGE)
                {
                    int idx = SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0);
                    fPB->SetValue(plLODAvatarComponent::kLODState, 0, idx);
                    
                    if(fPB->GetINode(plLODAvatarComponent::kMeshNodeTab, t, idx))
                        fPB->SetValue(plLODAvatarComponent::kMeshNodeAddBtn, t, fPB->GetINode(plLODAvatarComponent::kMeshNodeTab,t, idx));
                    else
                        fPB->Reset(plLODAvatarComponent::kMeshNodeAddBtn);
                    return true;
                }
            }

            break;

        case WM_CLOSE:
            {
                int LodBeginState   = map->GetParamBlock()->GetInt(plLODAvatarComponent::kLODState);

                if(fPB->GetINode(plLODAvatarComponent::kMeshNodeAddBtn,t))
                    fPB->SetValue(plLODAvatarComponent::kMeshNodeTab, t, fPB->GetINode(plLODAvatarComponent::kMeshNodeAddBtn,t), LodBeginState);

                return false;
            }
        }
            
        return false;
    }
Пример #23
0
/*
 * TODO:
 * - not topmost
 * - resize stuff
 * - ask to save in exit (check if changed)
 */
BOOL CALLBACK PatchBDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {

	int tmpi,i;
	char fileName[MAX_PATH], *tmpStr;
	FILE *fp;

	switch(uMsg) {

		case WM_INITDIALOG:
            SetWindowText(hW, _("Patches Browser"));
            Button_SetText(GetDlgItem(hW,IDC_REFRESHPATCHLIST), _("Refresh List"));
            Button_SetText(GetDlgItem(hW,IDC_NEWPATCH), _("New Patch"));
			Button_SetText(GetDlgItem(hW,IDC_SAVEPATCH), _("Save Patch"));
			Button_SetText(GetDlgItem(hW,IDC_EXITPB), _("Exit"));
            Static_SetText(GetDlgItem(hW,IDC_GAMENAMESEARCH), _("Search game name patch:")); 
			//List Patches
			ListPatches ((HWND) hW);
			return TRUE;

		case WM_COMMAND:
			switch(LOWORD(wParam)) {

				case IDC_NEWPATCH:

					i = Save_Patch_Proc(fileName);
					if ( i == FALSE || (fp = fopen(fileName,"a")) == NULL ) { 
						MessageBox(hW,(LPCTSTR)"Couldn't create the file.",NULL,(UINT)MB_ICONERROR);
						return FALSE;
					}

					fclose(fp);
					i = MessageBox(hW,(LPCTSTR)"File created sucessfully.\nClear textbox?",NULL,(UINT)(MB_YESNO|MB_ICONQUESTION));
					if (i==IDYES) SetDlgItemText(hW, IDC_PATCHTEXT, (LPCTSTR)""); 

					return TRUE;

				case IDC_SAVEPATCH:

					i = Save_Patch_Proc(fileName);
					if ( i == FALSE || (fp = fopen(fileName,"w")) == NULL ) { 
						MessageBox(hW,(LPCTSTR)"Couldn't save the file.",NULL,(UINT)MB_ICONERROR);
						return FALSE;
					}

					tmpi = SendDlgItemMessage(hW, IDC_PATCHTEXT, EM_GETLINECOUNT, (WPARAM)NULL, (LPARAM)NULL);
					i=0;
					for (;tmpi>=0;tmpi--)
						i += SendDlgItemMessage(hW, IDC_PATCHTEXT, EM_LINELENGTH, (WPARAM)tmpi, (LPARAM)NULL);

					tmpStr = (char *) malloc(i);
					sprintf(tmpStr,"");
					SendDlgItemMessage(hW, IDC_PATCHTEXT, WM_GETTEXT, (WPARAM)i, (LPARAM)tmpStr);

					//remove \r
					for (i=0,tmpi=0; tmpStr[i]!='\0'; i++)
						if (tmpStr[i] != '\r')
							tmpStr[tmpi++] = tmpStr[i];
					tmpStr[tmpi] = '\0';

					fputs(tmpStr,fp);

					fclose(fp);
					free(tmpStr);

					MessageBox(hW,(LPCTSTR)"File saved sucessfully.",NULL,(UINT)MB_ICONINFORMATION);

					return TRUE;

				case IDC_REFRESHPATCHLIST:

					//List Patches
					ListPatches ((HWND) hW);

					return TRUE;

				case IDC_EXITPB:

					//Close Dialog
					EndDialog(hW, FALSE);

					return TRUE;

				case IDC_PATCHCRCLIST:

					//Get selected item
					tmpi = SendDlgItemMessage(hW, IDC_PATCHCRCLIST, LB_GETCURSEL, 0, 0);
					SendDlgItemMessage(hW, IDC_PATCHCRCLIST, LB_GETTEXT, (WPARAM)tmpi, (LPARAM)fileName);

					return ReadPatch ((HWND) hW, fileName);

				case IDC_PATCHNAMELIST:

					//Get selected item
					tmpi = SendDlgItemMessage(hW, IDC_PATCHNAMELIST, LB_GETCURSEL, 0, 0);
					SendDlgItemMessage(hW, IDC_PATCHNAMELIST, LB_GETTEXT, (WPARAM)tmpi, (LPARAM)fileName);

					//another small hack :p
					//eg. SOCOM Demo PAL (7dd01dd9.pnach)
					for (i=0;i<(int)strlen(fileName);i++)
						if (fileName[i] == '(') tmpi = i;

					sprintf(fileName,"%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
						fileName[tmpi+1],fileName[tmpi+2],fileName[tmpi+3],
						fileName[tmpi+4],fileName[tmpi+5],fileName[tmpi+6],
						fileName[tmpi+7],fileName[tmpi+8],fileName[tmpi+9],
						fileName[tmpi+10],fileName[tmpi+11],fileName[tmpi+12],
						fileName[tmpi+13],fileName[tmpi+14]);

					//sanity check
					if (fileName[tmpi+15] != ')') return FALSE;

					return ReadPatch ((HWND) hW, fileName);

				case IDC_SEARCHPATCHTEXT:

					//get text
					SendDlgItemMessage(hW, IDC_SEARCHPATCHTEXT, EM_GETLINE, 0, (LPARAM)fileName);
					//search
					tmpi = SendDlgItemMessage(hW, IDC_PATCHNAMELIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)fileName);
					//select match item 
					SendDlgItemMessage(hW, IDC_PATCHNAMELIST, LB_SETCURSEL, (WPARAM)tmpi, (LPARAM)NULL);

					return TRUE;
			}
			return TRUE;

		case WM_CLOSE:
			EndDialog(hW, FALSE);
			break;

	}
	return FALSE;
}
Пример #24
0
// the message handler for this window
LRESULT CALLBACK MainDialog::WinMsgHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
   int wmId, wmEvent;

   switch (uMsg) 
   {
      case SWM_TRAYMSG:
      {
         switch(lParam)
         {
            case WM_LBUTTONDOWN:
            case WM_LBUTTONDBLCLK:
            {
               static int i = 0;
               if( i == 0 ){
                  i++;
                  ShowWindow(hWnd, SW_SHOW);
               }else{
                  i--;
                  ShowWindow(hWnd, SW_HIDE);
               }
               break;
            }
            case WM_RBUTTONDOWN:
            case WM_CONTEXTMENU:
            {
               showMenu();
               break;
            }
         }
         break;
      }
      case WM_SYSCOMMAND:
      {
         if((wParam & 0xFFF0) == SC_MINIMIZE)
         {
			ShowWindow(hWnd, SW_HIDE);
			return 1;
         }
         else if(wParam == IDM_ABOUT)
         {
			DialogBox(_hInstance, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
            break;
         }
      }
      case WM_COMMAND:
      {
         wmId    = LOWORD(wParam);
         wmEvent = HIWORD(wParam); 

         switch (wmId)
         {
            case SWM_MAIN:
            {
               ShowWindow(hWnd, SW_SHOW);
               break;
            }
            case SWM_SETTING:
			case IDC_BUTTON_SETTING:
			{
               _settingDialog.show(true);
               break;
            }
            case SWM_ABOUT:
            {
               DialogBox(_hInstance, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
               break;
            }
            case SWM_EXIT:
            {
               DestroyWindow(hWnd);
               break;
            }
            case IDC_BUTTON_ANALYSIS_SITUATION:
            {
               std::string str = MetaMachine::getDefault().estimateScore();
               SetWindowText(GetDlgItem(_hWnd, IDC_STATIC_OUTPUT), str.c_str());
               break;
            }
            case IDC_RADIO_BLACK:
            {
               if(wmEvent == BN_CLICKED){
                  _context.setGoPlayerKind("black");
               }
               break;
            }
            case IDC_RADIO_WHITE:
            {
               if(wmEvent == BN_CLICKED){
                  _context.setGoPlayerKind("white");
               }
               break;
            }
            case IDC_BUTTON_START_STOP:
            {
               static int i = 0;
               if( i == 0 ){
				   i++;
                  _watcher.start();
                  Button_SetText(GetDlgItem(hWnd, IDC_BUTTON_START_STOP), "停止");
               }else{
                  i--;
                  _watcher.stop();
                  Button_SetText(GetDlgItem(hWnd, IDC_BUTTON_START_STOP), "开始");
               }
               break;
            }
            default:
            {
			   return 0;
			}
         }
      }
      case WM_INITDIALOG:
      {
         break;
         //return initDialog();
      }
      case WM_CLOSE:
      {
         ShowWindow(hWnd, SW_HIDE);
         break;
      }
      case WM_DESTROY:
      {
         niData.uFlags = 0;
         Shell_NotifyIcon(NIM_DELETE,&niData);
         PostQuitMessage(0);
         break;
      }
   }
   return 0;
}
Пример #25
0
/*
 * OnCommand - handles OK and X buttons
 */
void sd_OnCommand(HWND sysDlg, UINT ctrlID, HWND ctrl, UINT notify)
{
    int value;

    switch (ctrlID) {
        /*
         * Menus
         */
        case IDM_RETRIEVE_SYS:
            TX81Z_RetrieveData(Prog_midi, REQ_SYS, &Prog_snapshot);
            SendMessage(Prog_mainWnd, WM_COMMAND
                    , MAKEWPARAM(IDD_SYSDLG, EDN_CHANGE)
                    , (LPARAM) sysDlg);
            sd_InitControlValues(sysDlg);
            return;
        case IDM_TRANSMIT_SYS:
            TX81Z_SendData(Prog_midi, REQ_SYS, &Prog_snapshot);
            return;
        case IDM_EXIT:
            PostMessage(Prog_mainWnd, WM_COMMAND, IDM_EXIT, 0L);
        case IDM_CLOSE:
        case IDCANCEL:
            DestroyWindow(sysDlg);
            return;
        case IDM_UNDO:
            Undo_Undo(sd_undo, sd_Undo, sysDlg);
            goto UpdateUndoMenus;
        case IDM_REDO:
            Undo_Redo(sd_undo, sd_Redo, sysDlg);
UpdateUndoMenus:
            EnableMenuItem(sd_menu, IDM_UNDO
                    , MF_BYCOMMAND | (Undo_AnyUndoes(sd_undo)
                        ? MF_ENABLED : MF_GRAYED));
            EnableMenuItem(sd_menu, IDM_REDO
                    , MF_BYCOMMAND | (Undo_AnyRedoes(sd_undo)
                        ? MF_ENABLED : MF_GRAYED));
            return;
        case IDM_KYBDDLG:
        case IDM_REMOTEWND:
        case IDM_MAINWND:
        case IDM_VOICEDLG:
        case IDM_PFMDLG:
        case IDM_FXDLG:
        case IDM_PCDLG:
        case IDM_MTODLG:
        case IDM_MTFDLG:
            SendMessage(Prog_mainWnd, WM_COMMAND, ctrlID, 0);
            return;
        case IDM_HELP:
            Prog_OpenHelp(sysDlg, _T("system_editor.html"));
            return;
        /*
         * Controls
         */
        case IDC_SYSEX_SW:
        case IDC_MEMPROT_SW:
        case IDC_COMBINE_SW:
        case IDC_AT_SW:
        {
            unsigned i;

            /*
             * Find the toggleInit structure for the button.
             */
            for (i = 0; i < sd_toggleInitCnt; i++) {
                if (sd_toggleInits[i].ctrlID == ctrlID)
                    break;
            }
            /*
             * Find the checked status of the button.
             */
            value = Button_IsChecked(ctrl);
            /*
             * Toggle the text on the button the user clicked.
             */
            Button_SetText(ctrl, value ? sd_toggleInits[i].modeOn
                    : sd_toggleInits[i].modeOff);
            break;
        }
        case IDC_STARTUP_MSG:
            if (notify == LCN_EDITUPDATE) {
                int cursorPos = LcdCtrl_GetCursorPos(ctrl);

                ctrlID += cursorPos;
                value = LcdCtrl_GetChar(ctrl, cursorPos);
            } else {
                return;
            }
            break;
        default:
            if (notify == LCN_SELCHANGE) {
                value = LcdCtrl_GetValue(ctrl);
            } else {
                return;
            }
            break;
    }
    sd_ChangeParameter(ctrlID - SYS_ID_OFFSET, value, CP_SEND);
}
Пример #26
0
BOOL CALLBACK CpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	char cpuspeedc[20];
	char features[256];
	char cfps[20];
	char cFrameskip[20];
	char cConsecutiveFrames[20];
	char cConsecutiveSkip[20];
	u32 newopts;

	switch(uMsg) {
		case WM_INITDIALOG:
            SetWindowText(hW, _("Cpu Config"));
			SetDlgItemText(hW, IDC_VENDORINPUT,cpuinfo.x86ID );
            SetDlgItemText(hW, IDC_FAMILYINPUT, cpuinfo.x86Fam);
			sprintf(cpuspeedc,"%d MHZ",cpuinfo.cpuspeed);
			SetDlgItemText(hW, IDC_CPUSPEEDINPUT, cpuspeedc);
			Static_SetText(GetDlgItem(hW, IDC_VENDORNAME), _("CPU Vendor"));
			Static_SetText(GetDlgItem(hW, IDC_FAMILYNAME), _("Family"));
			Static_SetText(GetDlgItem(hW, IDC_CPUSPEEDNAME), _("CPU Speed"));
			Static_SetText(GetDlgItem(hW, IDC_FEATURESNAME), _("Features"));
			Static_SetText(GetDlgItem(hW, IDC_CPU_EEREC), _("EERec -  EE/IOP recompiler (need MMX/SSE)"));
			Static_SetText(GetDlgItem(hW, IDC_CPU_VUGROUP), _("VU Recompilers - All options are set by default"));
			Static_SetText(GetDlgItem(hW, IDC_CPU_VU0REC), _("VU0rec - enable recompiler for VU0 unit"));
			Static_SetText(GetDlgItem(hW, IDC_CPU_VU1REC), _("VU1rec - enable recompiler for VU1 unit"));
			Static_SetText(GetDlgItem(hW, IDC_CPU_GSMULTI), _("Multi threaded GS mode (MTGS)\n(faster on dual core/HT procs, requires pcsx2 restart)"));
			Static_SetText(GetDlgItem(hW, IDC_FRAMELIMIT), _("Frame Limiting (F4 key switches the mode in-game!)"));
			Static_SetText(GetDlgItem(hW, IDC_CPU_FL_NORMAL), _("Normal - All frames are rendered as fast as possible."));
			Static_SetText(GetDlgItem(hW, IDC_CPU_FL_LIMIT), _("Limit - Force frames to normal speeds if too fast."));
			Static_SetText(GetDlgItem(hW, IDC_CPU_FL_SKIP), _("Frame Skip - In order to achieve normal speeds,\nsome frames are skipped (fast).\nFps displayed counts skipped frames too."));
			Static_SetText(GetDlgItem(hW, IDC_CPU_FL_SKIPVU), _("VU Skip - Same as 'Frame Skip', but tries to skip more.\nArtifacts might be present, but will be faster."));
			Static_SetText(GetDlgItem(hW, IDC_CUSTOM_FPS), _("Custom FPS Limit (0=auto):"));
			Static_SetText(GetDlgItem(hW, IDC_FRAMESKIP_LABEL1), _("Skip Frames when slower than:\n(See Note 1)"));
			Static_SetText(GetDlgItem(hW, IDC_FRAMESKIP_LABEL2), _("Consecutive Frames before skipping:\n(See Note 2)"));
			Static_SetText(GetDlgItem(hW, IDC_FRAMESKIP_LABEL3), _("*Note 1: Will only skip when slower than this fps number.\n (0 = Auto) ; (9999 = Forced-Frameskip regardless of speed.)\n (e.g. If set to 45, will only skip when slower than 45fps.)"));
			Static_SetText(GetDlgItem(hW, IDC_FRAMESKIP_LABEL4), _("*Note 2: Will render this number of consecutive frames before\n  skipping the next frame. (0=default)\n (e.g. If set to 2, will render 2 frames before skipping 1.)"));
			Static_SetText(GetDlgItem(hW, IDC_FRAMESKIP_LABEL5), _("Consecutive Frames to skip:\n(See Note 3)"));
			Static_SetText(GetDlgItem(hW, IDC_FRAMESKIP_LABEL6), _("*Note 3: Will skip this number of frames before\n  rendering the next sequence of frames. (0=default)\n (e.g. If set to 2, will skip 2 consecutive frames whenever its time\n  to skip.)"));

			Button_SetText(GetDlgItem(hW, IDOK), _("OK"));
			Button_SetText(GetDlgItem(hW, IDCANCEL), _("Cancel"));

			//features[0]=':';
			//strcat(features,"");
			strcpy(features,"");
            if(cpucaps.hasMultimediaExtensions) strcat(features,"MMX");
            if(cpucaps.hasStreamingSIMDExtensions) strcat(features,",SSE");
            if(cpucaps.hasStreamingSIMD2Extensions) strcat(features,",SSE2");
			if(cpucaps.hasStreamingSIMD3Extensions) strcat(features,",SSE3");
			if(cpucaps.hasSupplementalStreamingSIMD3Extensions) strcat(features,",SSSE3");
			if(cpucaps.hasStreamingSIMD4Extensions) strcat(features,",SSE4.1");
//            if(cpucaps.has3DNOWInstructionExtensions) strcat(features,",3DNOW");
//            if(cpucaps.has3DNOWInstructionExtensionsExt)strcat(features,",3DNOW+");
//			if(cpucaps.hasAMD64BitArchitecture) strcat(features,",x86-64");
            SetDlgItemText(hW, IDC_FEATURESINPUT, features);

			CheckDlgButton(hW, IDC_CPU_EEREC, !!(Config.Options&PCSX2_EEREC));
			CheckDlgButton(hW, IDC_CPU_VU0REC, !!(Config.Options&PCSX2_VU0REC));
			CheckDlgButton(hW, IDC_CPU_VU1REC, !!(Config.Options&PCSX2_VU1REC));

			EnableDlgItem( hW, IDC_CPU_EEREC, !g_Session.ForceDisableEErec );
			EnableDlgItem( hW, IDC_CPU_VU0REC, !g_Session.ForceDisableVU0rec );
			EnableDlgItem( hW, IDC_CPU_VU1REC, !g_Session.ForceDisableVU1rec );

			CheckDlgButton(hW, IDC_CPU_GSMULTI, !!CHECK_MULTIGS);

			CheckRadioButton(hW,IDC_CPU_FL_NORMAL, IDC_CPU_FL_NORMAL+3, IDC_CPU_FL_NORMAL+(CHECK_FRAMELIMIT>>10));
			
			sprintf(cfps,"%d",Config.CustomFps);
			SetDlgItemText(hW, IDC_CUSTOMFPS, cfps);

			sprintf(cFrameskip,"%d",Config.CustomFrameSkip);
			SetDlgItemText(hW, IDC_CUSTOM_FRAMESKIP, cFrameskip);
			
			sprintf(cConsecutiveFrames,"%d",Config.CustomConsecutiveFrames);
			SetDlgItemText(hW, IDC_CUSTOM_CONSECUTIVE_FRAMES, cConsecutiveFrames);

			sprintf(cConsecutiveSkip,"%d",Config.CustomConsecutiveSkip);
			SetDlgItemText(hW, IDC_CUSTOM_CONSECUTIVE_SKIP, cConsecutiveSkip);

			//EnableWindow( GetDlgItem( hW, IDC_CPU_GSMULTI ), !g_GameInProgress );

			return TRUE;

		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case IDCANCEL:
					EndDialog(hW, FALSE);
				return FALSE;

				case IDOK:
					newopts = 0;

					if( SendDlgItemMessage(hW,IDC_CPU_EEREC,BM_GETCHECK,0,0) ) newopts |= PCSX2_EEREC;

					if( SendDlgItemMessage(hW,IDC_CPU_VU0REC,BM_GETCHECK,0,0) ) newopts |= PCSX2_VU0REC;
					if( SendDlgItemMessage(hW,IDC_CPU_VU1REC,BM_GETCHECK,0,0) ) newopts |= PCSX2_VU1REC;

					if( SendDlgItemMessage(hW,IDC_CPU_GSMULTI,BM_GETCHECK,0,0) ) newopts |= PCSX2_GSMULTITHREAD;

					if( SendDlgItemMessage(hW,IDC_CPU_FL_NORMAL,BM_GETCHECK,0,0) ) newopts |= PCSX2_FRAMELIMIT_NORMAL;
					else if( SendDlgItemMessage(hW,IDC_CPU_FL_LIMIT,BM_GETCHECK,0,0) ) newopts |= PCSX2_FRAMELIMIT_LIMIT;
					else if( SendDlgItemMessage(hW,IDC_CPU_FL_SKIP,BM_GETCHECK,0,0) ) newopts |= PCSX2_FRAMELIMIT_SKIP;
					else if( SendDlgItemMessage(hW,IDC_CPU_FL_SKIPVU,BM_GETCHECK,0,0) ) newopts |= PCSX2_FRAMELIMIT_VUSKIP;

					GetDlgItemText(hW, IDC_CUSTOMFPS, cfps, 20);
					Config.CustomFps = atoi(cfps);

					GetDlgItemText(hW, IDC_CUSTOM_FRAMESKIP, cFrameskip, 20);
					Config.CustomFrameSkip = atoi(cFrameskip);

					GetDlgItemText(hW, IDC_CUSTOM_CONSECUTIVE_FRAMES, cConsecutiveFrames, 20);
					Config.CustomConsecutiveFrames = atoi(cConsecutiveFrames);

					GetDlgItemText(hW, IDC_CUSTOM_CONSECUTIVE_SKIP, cConsecutiveSkip, 20);
					Config.CustomConsecutiveSkip = atoi(cConsecutiveSkip);

					EndDialog(hW, TRUE);

					if( Config.Options != newopts )
					{
						SysRestorableReset();

						if( (Config.Options&PCSX2_GSMULTITHREAD) ^ (newopts&PCSX2_GSMULTITHREAD) )
						{
							// Need the MTGS setting to take effect, so close out the plugins:
							PluginsResetGS();
							if( CHECK_MULTIGS )
								Console::Notice( "MTGS mode disabled.\n\tEnjoy the fruits of single-threaded simpicity." );
							else
								Console::Notice( "MTGS mode enabled.\n\tWelcome to multi-threaded awesomeness." );
						}
						Config.Options = newopts;
					}
					else if( Cpu != NULL )
						UpdateVSyncRate();

					SaveConfig();

				return FALSE;
			}
		return TRUE;
	}
	return FALSE;
}