BOOL PropSheetPage2_OnCommand(
    _In_ HWND hwnd,
    _In_ INT id,
    _In_ HWND hwndCtl,
    _In_ UINT codeNotify
    )
{
    switch (id)
    {
    case IDC_RADIO1:
    case IDC_RADIO2:
        {
            if (Button_GetCheck(GetDlgItem(hwnd, IDC_RADIO1)) == BST_CHECKED)
            {
                // The user has agreed to the EULA, enable the Next button.
                PropSheet_SetWizButtons(GetParent(hwnd), PSWIZB_NEXT | PSWIZB_BACK);
            }
            else
            {
                // The user did not agree, disable the next button.
                PropSheet_SetWizButtons(GetParent(hwnd), PSWIZB_BACK);
            }
        }
        break;
    }

    return FALSE;
}
Exemple #2
0
static INT_PTR CALLBACK
IsConnctedPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_COMMAND:
        {
            if(HIWORD(wParam) == BN_CLICKED)
            {
                if ((SendDlgItemMessage(hwndDlg, IDC_CONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED) ||
                    (SendDlgItemMessage(hwndDlg, IDC_NOTCONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED))
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
                }
                else
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
                }
            }
        }
        break;

        case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR)lParam;

            switch (lpnm->code)
            {
                case PSN_SETACTIVE:
                {
                    if ((SendDlgItemMessage(hwndDlg, IDC_CONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED) ||
                        (SendDlgItemMessage(hwndDlg, IDC_NOTCONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED))
                    {
                        PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
                    }
                    else
                    {
                        PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
                    }
                }
                break;

                case PSN_WIZNEXT:
                {
                    if (SendDlgItemMessage(hwndDlg, IDC_NOTCONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED)
                        SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_NOTCONNECTEDPAGE);
                    else
                        SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_PROBELISTPAGE);

                    return TRUE;
                }
            }
        }
        break;
    }

    return FALSE;
}
Exemple #3
0
static INT_PTR CALLBACK
ProgressPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR)lParam;

            switch (lpnm->code)
            {
                case PSN_SETACTIVE:
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
                }
                break;

                case PSN_WIZBACK:
                {
                    SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_SELECTWAYPAGE);
                    return TRUE;
                }
            }
        }
        break;
    }

    return FALSE;
}
Exemple #4
0
static INT_PTR CALLBACK
SearchPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            /* TODO: PnP devices search */
        }
        break;

        case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR)lParam;

            switch (lpnm->code)
            {
                case PSN_SETACTIVE:
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
                }
                break;
            }
        }
        break;
    }

    return FALSE;
}
BOOL PropSheetPage2_OnNotify(
    _In_ HWND hwndDlg,
    _In_ INT idCtrl,
    _Inout_ LPNMHDR lpNmh
    )
{
    LPPSHNOTIFY pageNotify = (LPPSHNOTIFY)lpNmh;

    switch (pageNotify->hdr.code)
    {
    case PSN_SETACTIVE:
        {
            HWND hwPropSheet = pageNotify->hdr.hwndFrom;

#ifndef DEBUG
            // Disable the property sheet Next button, the user must accept the EULA to continue.
            PropSheet_SetWizButtons(hwPropSheet, PSWIZB_BACK);
#endif
        }
        break;
    case PSN_QUERYINITIALFOCUS:
        {
            // Set the default control as the 'do not accept' radio button.
            SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LPARAM)GetDlgItem(hwndDlg, IDC_RADIO2));
        }
        return TRUE;
    }

    return FALSE;
}
Exemple #6
0
static INT_PTR CALLBACK
StartPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            /* Set title font */
            SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
        }
        break;

        case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR)lParam;

            switch (lpnm->code)
            {
                case PSN_SETACTIVE:
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
                }
                break;
            }
        }
        break;
    }

    return FALSE;
}
//
// Process messages from the third interior page
//
LRESULT CALLBACK IntPage3DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(wParam);

    SHAREDWIZDATA *pdata = (SHAREDWIZDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

    switch (uMsg)
    {
    case WM_INITDIALOG:
        { 
            // Get the PROPSHEETPAGE lParam value and load it into DWL_USERDATA

            PROPSHEETPAGE *psp = (PROPSHEETPAGE *)lParam;
            pdata = (SHAREDWIZDATA *)(psp->lParam);
            SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pdata);
            break;
        }

    case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR) lParam;

            switch (lpnm->code)
            {
            case PSN_SETACTIVE : //Enable the Next and Finish buttons
                PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_FINISH);
                break;

            case PSN_WIZNEXT :
                //Handle a Next button click, if necessary
                break;

            case PSN_WIZBACK :
                //If the checkbox was checked, jump back
                //to the first interior page, not the second
                if (pdata->fIsBoxChecked)
                {
                    SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_INTERIOR1);
                    return TRUE;
                }
                break;

            case PSN_RESET :
                //Handle a Cancel button click, if necessary
                break;

            default :
                break;
            }
        }
        break;

    default:
        break;
    }

    return 0;
}
Exemple #8
0
	INT_PTR Tab::TabDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
	{
		Tab *tab = (Tab *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
		switch(message)
		{
		case WM_INITDIALOG:
			{
				if (!centered) //HACK
				{
					CenterWindow(GetParent(hDlg));
					centered=true;
				}
				LPARAM l = ((LPPROPSHEETPAGE)lParam)->lParam;
				tab = (Tab *)l;
				SetWindowLongPtr(hDlg, GWLP_USERDATA, (DWORD_PTR)l);
				tab->Init(hDlg);
			}
			break;

		case WM_COMMAND:
			tab->Command(hDlg,wParam);
			break;
		case WM_NOTIFY:
			{
				LPPSHNOTIFY lppsn = (LPPSHNOTIFY) lParam;
				HWND sheet = lppsn->hdr.hwndFrom;
				switch(lppsn->hdr.code) {
				case PSN_APPLY:
					tab->Apply(hDlg);
					break;
				case PSN_SETACTIVE:
					PropSheet_SetWizButtons(GetParent(hDlg), 
						(tab->HasPrev()?PSWIZB_BACK:0) | 
						(tab->HasNext()?PSWIZB_NEXT:0) | 
						(tab->HasFinish()?PSWIZB_FINISH:0));
					break;
				case PSN_WIZNEXT: 
					tab->Apply(hDlg); //maybe not always good
					break;
				case PSN_WIZBACK:
				case PSN_RESET: //cancel
					break;
				}
			}
			break;
		}
		return 0;
	}
BOOL PropSheetPage4_OnNotify(
    _In_ HWND hwndDlg,
    _In_ INT idCtrl,
    _Inout_ LPNMHDR lpNmh
    )
{
    LPPSHNOTIFY pageNotify = (LPPSHNOTIFY)lpNmh;

    switch (pageNotify->hdr.code)
    {
    case PSN_SETACTIVE:
        {
            HWND hwPropSheet = pageNotify->hdr.hwndFrom;

            // Disable Next/Back buttons
            PropSheet_SetWizButtons(hwPropSheet, 0);

            _hwndProgress = hwndDlg;

            
            SetTimer(hwndDlg, 1, 100, NULL);

            PhCreateThread(0, DownloadThread, hwPropSheet);
        }
        break;
    case PSN_QUERYCANCEL:
        {
            //if (UpdateResetState == InstallStateResetting || UpdateResetState == InstallStateInstalling)

            //PropSheet_CancelToClose(GetParent(hwndDlg));
            //EnableMenuItem(GetSystemMenu(GetParent(hwndDlg), FALSE), SC_CLOSE, MF_GRAYED);
            //EnableMenuItem(GetSystemMenu(GetParent(hwndDlg), FALSE), SC_CLOSE, MF_ENABLED);

            //SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LPARAM)TRUE);
            //return TRUE;
        }
        break;
    case PSN_KILLACTIVE:
        {
            KillTimer(hwndDlg, 1);
        }
        break;
    }

    return FALSE;
}
LRESULT CALLBACK ComboDlgProc(   HWND hdlg,
                                 UINT uMessage,
                                 WPARAM wParam,
                                 LPARAM lParam)
{
LPNMHDR     lpnmhdr;

switch (uMessage)
   {
   // on any command notification, tell the property sheet to enable the Apply button
   case WM_COMMAND:
      PropSheet_Changed(GetParent(hdlg), hdlg);
      break;

   case WM_NOTIFY:
      lpnmhdr = (NMHDR FAR *)lParam;

      switch (lpnmhdr->code)
         {
         case PSN_APPLY:   //sent when OK or Apply button pressed
            break;

         case PSN_RESET:   //sent when Cancel button pressed
            break;
         
         case PSN_SETACTIVE:
            //this will be ignored if the property sheet is not a wizard
            PropSheet_SetWizButtons(GetParent(hdlg), PSWIZB_BACK | PSWIZB_FINISH);
            return FALSE;

         default:
            break;
         }
      break;

   default:
   break;
   }

return FALSE;
}
Exemple #11
0
static INT_PTR CALLBACK
SelectWayPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR)lParam;

            switch (lpnm->code)
            {
                case PSN_SETACTIVE:
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
                    if (SendDlgItemMessage(hwndDlg, IDC_AUTOINSTALL, BM_GETCHECK, 0, 0) == BST_CHECKED)
                        SendDlgItemMessage(hwndDlg, IDC_MANUALLYINST, BM_SETCHECK, 0, 0);
                    else
                    {
                        SendDlgItemMessage(hwndDlg, IDC_AUTOINSTALL, BM_SETCHECK, 1, 1);
                        SendDlgItemMessage(hwndDlg, IDC_MANUALLYINST, BM_SETCHECK, 0, 0);
                    }
                }
                break;

                case PSN_WIZNEXT:
                {
                    if (SendDlgItemMessage(hwndDlg, IDC_AUTOINSTALL, BM_GETCHECK, 0, 0) == BST_CHECKED)
                        SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_PROGRESSPAGE);
                    else
                        SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_HWTYPESPAGE);

                    return TRUE;
                }
            }
        }
        break;
    }

    return FALSE;
}
Exemple #12
0
static INT_PTR CALLBACK
DevStatusPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            /* Set title font */
            SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
        }
        break;

        case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR)lParam;

            switch (lpnm->code)
            {
                case PSN_SETACTIVE:
                {
                    /* Set status text */
                    SetWindowText(GetDlgItem(hwndDlg, IDC_HWSTATUSEDIT), pDeviceStatusText);

                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH | PSWIZB_BACK);
                }
                break;

                case PSN_WIZBACK:
                {
                    SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_PROBELISTPAGE);
                    return TRUE;
                }
            }
        }
        break;
    }

    return FALSE;
}
Exemple #13
0
static INT_PTR CALLBACK
NotConnectedPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            /* Set title font */
            SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
        }
        break;

        case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR)lParam;

            switch (lpnm->code)
            {
                case PSN_SETACTIVE:
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH | PSWIZB_BACK);
                }
                break;

                case PSN_WIZBACK:
                {
                    SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_ISCONNECTEDPAGE);
                    return TRUE;
                }
            }
        }
        break;
    }

    return FALSE;
}
// Process messages from the first interior page
LRESULT CALLBACK IntPage1DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(wParam);

    SHAREDWIZDATA *pdata = (SHAREDWIZDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

    switch (uMsg)
    {
    case WM_INITDIALOG:
        { 
            // Get the PROPSHEETPAGE lParam value and load it into DWL_USERDATA

            PROPSHEETPAGE *psp = (PROPSHEETPAGE *)lParam;
            pdata = (SHAREDWIZDATA *)(psp->lParam);
            SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pdata);
            break;
        }

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_CHECK1:
            pdata->fIsBoxChecked = !(pdata->fIsBoxChecked);
            break;

        case IDC_RADIO1:
        case IDC_RADIO2:
        case IDC_RADIO3:
            pdata->fIsButtonClicked = TRUE;
            break;

        default:
            break;
        }

        //If any of the radio buttons are clicked, or the
        //checkbox checked, enable the Next button

        if (pdata->fIsBoxChecked || pdata->fIsButtonClicked)
        {
            PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
        }
        else //otherwise, only enable the Back button
        {
            PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
        }
        break;

    case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR) lParam;

            switch (lpnm->code)
            {
            case PSN_SETACTIVE: // Enable the appropriate buttons

                // If a radio button has been clicked or the 
                // checkbox checked, enable Back and Next 
                if (pdata->fIsBoxChecked || pdata->fIsButtonClicked) 
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
                }
                else 
                {
                    // Otherwise, only enable Back
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
                }
                break;

            case PSN_WIZNEXT:

                // If the checkbox is checked, jump to the final page

                if (pdata->fIsBoxChecked)
                {
                    SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_INTERIOR3);
                    return TRUE;
                }
                break;

            case PSN_WIZBACK:
                //Handle a Back button click, if necessary
                break;

            case PSN_RESET:
                //Handle a Cancel button click, if necessary
                break;

            default:
                break;
            }
        }
        break;

    default:
        break;
    }

    return 0;
}
INT_PTR CALLBACK SetupWebSetup_WndProc(
    _In_ HWND hwndDlg,
    _In_ UINT uMsg,
    _Inout_ WPARAM wParam,
    _Inout_ LPARAM lParam
    )
{
    PPH_SETUP_CONTEXT context = NULL;

    if (uMsg == WM_INITDIALOG)
    {
        context = GetProp(GetParent(hwndDlg), L"SetupContext");
        SetProp(hwndDlg, L"Context", (HANDLE)context);
    }
    else
    {
        context = (PPH_SETUP_CONTEXT)GetProp(hwndDlg, L"Context");
    }

    if (context == NULL)
        return FALSE;

    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            SetupLoadImage(GetDlgItem(hwndDlg, IDC_PROJECT_ICON), MAKEINTRESOURCE(IDB_PNG1));
            SetupInitializeFont(GetDlgItem(hwndDlg, IDC_MAINHEADER), -17, FW_SEMIBOLD);
            //SetupInitializeFont(GetDlgItem(hwndDlg, IDC_SUBHEADER), -12, FW_NORMAL);
            SetupInitializeFont(GetDlgItem(hwndDlg, IDC_INSTALL_STATUS), -12, FW_SEMIBOLD);
            SetupInitializeFont(GetDlgItem(hwndDlg, IDC_INSTALL_SUBSTATUS), -12, FW_NORMAL);

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

            switch (pageNotify->hdr.code)
            {
            case PSN_SETACTIVE:
                {
                    context->MainHeaderHandle = GetDlgItem(hwndDlg, IDC_MAINHEADER);
                    context->StatusHandle = GetDlgItem(hwndDlg, IDC_INSTALL_STATUS);
                    context->SubStatusHandle = GetDlgItem(hwndDlg, IDC_INSTALL_SUBSTATUS);
                    context->ProgressHandle = GetDlgItem(hwndDlg, IDC_INSTALL_PROGRESS);

                    SetWindowText(context->MainHeaderHandle, L"Checking for newer websetup version...");
                    SetWindowText(context->StatusHandle, L"Requesting latest version...");
                    SetWindowText(context->SubStatusHandle, L"");

                    // Disable Next/Back buttons
                    PropSheet_SetWizButtons(context->DialogHandle, 0);

                    PhCreateThread2(SetupDownloadWebSetupThread, context);
                }
                break;
            }
        }
        break;
    }

    return FALSE;
}
INT_PTR
CALLBACK
EndDlgProc(
    _In_ HWND hwndDlg,
    _In_ UINT uMsg,
    _In_ WPARAM wParam,
    _In_ LPARAM lParam
)

/*++

Routine Description:

    This function is the dialog procedure for the Finish page of the wizard.

Arguments:

    hwndDlg - Supplies a handle to the dialog box window

    uMsg - Supplies the message

    wParam - Supplies the first message parameter

    lParam - Supplies the second message parameter

Return Value:

    This dialog procedure always returns zero.

--*/

{
    LPSHAREDWIZDATA pdata;
    LPNMHDR lpnm;

    UNREFERENCED_PARAMETER( wParam );

    //
    // Retrieve the shared user data from GWL_USERDATA
    //
    pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

    switch(uMsg) {

    case WM_INITDIALOG :
    {
        HWND hwndControl;

        //
        // Get the shared data from PROPSHEETPAGE lParam value and load
        // it into GWL_USERDATA
        //
        pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
        SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);

        //
        // It's an intro/end page, so get the title font from userdata
        // and use it on the title control
        //
        hwndControl = GetDlgItem(hwndDlg, IDC_TITLE);
        SetWindowFont(hwndControl,pdata->hTitleFont, TRUE);
        break;
    }

    case WM_NOTIFY :

        lpnm = (LPNMHDR)lParam;

        switch(lpnm->code) {

        case PSN_SETACTIVE :
            //
            // Enable the correct buttons for the active page
            //
            PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_FINISH);

            //
            // Doesn't make sense to have Cancel button enabled here
            //
            EnableWindow(GetDlgItem(GetParent(hwndDlg),  IDCANCEL), FALSE);

            //
            // If we didn't find any currently-present devices, then prompt
            // the user to insert their device now.
            //
            if(!pdata->HwInsertedFirst) {

                WCHAR TempString[LINE_LEN];

                if(LoadString(g_hInstance,
                              IDS_PROMPT_FOR_HW,
                              TempString,
                              sizeof(TempString) / sizeof(WCHAR))) {

                    SetDlgItemText(hwndDlg, IDC_FINISH_TEXT, TempString);
                }
            }

            break;

        case PSN_WIZBACK :
            //
            // Jumping back from this page, so turn Cancel button back on.
            //
            EnableWindow(GetDlgItem(GetParent(hwndDlg),  IDCANCEL), TRUE);
            break;

        default :
            break;
        }
        break;

    default:
        break;
    }

    return 0;
}
INT_PTR
CALLBACK
IntPage1DlgProc(
    _In_ HWND hwndDlg,
    _In_ UINT uMsg,
    _In_ WPARAM wParam,
    _In_ LPARAM lParam
)

/*++

Routine Description:

    This function is the dialog procedure for the first interior wizard page.
    This page updates the drivers for any existing (present) devices, or
    installs the INF if there aren't any present devices.

Arguments:

    hwndDlg - Supplies a handle to the dialog box window

    uMsg - Supplies the message

    wParam - Supplies the first message parameter

    lParam - Supplies the second message parameter

Return Value:

    This dialog procedure always returns zero.

--*/

{
    LPSHAREDWIZDATA pdata;
    LPNMHDR lpnm;
    HANDLE hThread;
    HKEY hKey;
    DWORD UserPrompted;

    UNREFERENCED_PARAMETER( wParam );

    //
    // Retrieve the shared user data from GWL_USERDATA
    //
    pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

    switch(uMsg) {

    case WM_INITDIALOG :
        //
        // Get the PROPSHEETPAGE lParam value and load it into GWL_USERDATA
        //
        pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
        SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
        break;

    case WM_NOTIFY :

        lpnm = (LPNMHDR)lParam;

        switch(lpnm->code) {

        case PSN_SETACTIVE :
            //
            // If we're coming here from the intro page, then disable
            // the Back and Next buttons (we're going to be busy for a
            // little bit updating drivers).
            //
            // If we're coming to this page from anywhere else,
            // immediately jump to the intro page.
            //
            if(pdata->DoDriverUpdatePage) {
                //
                // Reset our flag so that we won't try this again if we
                // go to later pages, then come back to this one.  (We
                // only do anything when the wizard page is accessed in
                // the forward direction, from the Intro page.)
                //
                pdata->DoDriverUpdatePage = FALSE;

                //
                // Set our "UserPrompted" registry flag so the
                // co-installer won't popup its own value-add software
                // chooser page during driver update.
                //
                if(ERROR_SUCCESS == RegCreateKeyEx(
                            HKEY_LOCAL_MACHINE,
                            TEXT("SOFTWARE\\Microsoft\\Toaster"),
                            0,
                            NULL,
                            REG_OPTION_NON_VOLATILE,
                            KEY_READ | KEY_WRITE,
                            NULL,
                            &hKey,
                            NULL)) {

                    UserPrompted = 1;
                    RegSetValueEx(hKey,
                                  TEXT("User Prompted"),
                                  0,
                                  REG_DWORD,
                                  (PBYTE)&UserPrompted,
                                  sizeof(UserPrompted)
                                 );

                    RegCloseKey(hKey);
                }

                //
                // Disable Next, Back, and Cancel
                //
                PropSheet_SetWizButtons(GetParent(hwndDlg), 0);
                EnableWindow(GetDlgItem(GetParent(hwndDlg), IDCANCEL), FALSE);

                //
                // Show "searching" animation...
                //
                ShowWindow(GetDlgItem(hwndDlg, IDC_ANIMATE1), SW_SHOW);
                Animate_Open(GetDlgItem(hwndDlg, IDC_ANIMATE1), MAKEINTRESOURCE(IDA_SEARCHING));
                Animate_Play(GetDlgItem(hwndDlg, IDC_ANIMATE1), 0, -1, -1);

                //
                // Create a thread to do the work of updating the
                // driver, etc.
                //
                pdata->hwndDlg = hwndDlg;

                hThread = CreateThread(NULL,
                                       0,
                                       UpdateDriverThreadProc,
                                       pdata,
                                       0,
                                       NULL
                                      );

                if(hThread) {
                    //
                    // Thread launched successfully--close the handle,
                    // then just wait to be notified of thread's
                    // completion.
                    //
                    CloseHandle(hThread);

                } else {
                    //
                    // Couldn't launch the thread--just move on to the
                    // value-add software page.
                    //
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
                    PropSheet_PressButton(GetParent(hwndDlg), PSBTN_NEXT);
                }

            } else {
                //
                // We're coming "back" to this page.  Skip it, and go
                // to the intro page.
                //
                PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
                PropSheet_PressButton(GetParent(hwndDlg), PSBTN_BACK);
            }
            break;

        case PSN_WIZNEXT :
            //Handle a Next button click, if necessary
            break;

        case PSN_WIZBACK :
            //Handle a Back button click, if necessary
            break;

        case PSN_RESET :
            //Handle a Cancel button click, if necessary
            break;

        default :
            break;
        }
        break;

    case WMX_UPDATE_DRIVER_DONE :
        //
        // Stop "searching" animation...
        //
        Animate_Stop(GetDlgItem(hwndDlg, IDC_ANIMATE1));
        ShowWindow(GetDlgItem(hwndDlg, IDC_ANIMATE1), SW_HIDE);

        //
        // Regardless of whether we succeeded in upgrading any drivers, we'll
        // go ahead and proceed to the value-add software page.
        //
        PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
        EnableWindow(GetDlgItem(GetParent(hwndDlg), IDCANCEL), TRUE);

        PropSheet_PressButton(GetParent(hwndDlg), PSBTN_NEXT);

        break;

    default:
        break;
    }

    return 0;
}
INT_PTR
CALLBACK
IntroDlgProc(
    _In_ HWND hwndDlg,
    _In_ UINT uMsg,
    _In_ WPARAM wParam,
    _In_ LPARAM lParam
)

/*++

Routine Description:

    This function is the dialog procedure for the Welcome page of the wizard.

Arguments:

    hwndDlg - Supplies a handle to the dialog box window

    uMsg - Supplies the message

    wParam - Supplies the first message parameter

    lParam - Supplies the second message parameter

Return Value:

    This dialog procedure always returns zero.

--*/

{
    LPSHAREDWIZDATA pdata;
    LPNMHDR lpnm;

    UNREFERENCED_PARAMETER( wParam );

    //
    // Retrieve the shared user data from GWL_USERDATA
    //
    pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

    switch(uMsg) {

    case WM_INITDIALOG :
    {
        HWND hwndControl;

        //
        // Get the shared data from PROPSHEETPAGE lParam valueand load
        // it into GWL_USERDATA
        //
        pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;

        SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);

        //
        // It's an intro/end page, so get the title font from the
        // shared data and use it for the title control
        //
        hwndControl = GetDlgItem(hwndDlg, IDC_TITLE);
        SetWindowFont(hwndControl,pdata->hTitleFont, TRUE);
        break;
    }

    case WM_NOTIFY :

        lpnm = (LPNMHDR)lParam;

        switch(lpnm->code) {

        case PSN_SETACTIVE :
            //
            // Enable the Next button
            //
            PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);

            //
            // When we're moving forward through the wizard, we want
            // the driver update page to do its work.
            //
            pdata->DoDriverUpdatePage = TRUE;
            break;

        case PSN_WIZNEXT :
            //Handle a Next button click here
            break;

        case PSN_RESET :
            //Handle a Cancel button click, if necessary
            break;

        default :
            break;
        }
        break;

    default:
        break;
    }

    return 0;
}
Exemple #19
0
static INT_PTR CALLBACK
ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    INT Index;

    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            pDeviceStatusText = (PWSTR)HeapAlloc(hProcessHeap, 0, MAX_STR_SIZE);
            InitProbeListPage(hwndDlg);
        }
        break;

        case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR)lParam;

            switch (lpnm->code)
            {
                case PSN_SETACTIVE:
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
                }
                break;

                case PSN_WIZNEXT:
                {
                    Index = (INT) SendMessage(GetDlgItem(hwndDlg, IDC_PROBELIST), LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
                    if (Index == -1) Index = 0;

                    if (Index == 0)
                    {
                        SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_SELECTWAYPAGE);
                    }
                    else
                    {
                        LVITEM Item;
                        PWSTR pts;

                        ZeroMemory(&Item, sizeof(LV_ITEM));
                        Item.mask = LVIF_PARAM;
                        Item.iItem = Index;
                        (VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
                        pts = (PWSTR) Item.lParam;
                        wcscpy(pDeviceStatusText, pts);

                        SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_HWSTATUSPAGE);
                    }
                    return TRUE;
                }
            }
        }
        break;

        case WM_DESTROY:
        {
            INT Index;
            LVITEM Item;

            for (Index = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_PROBELIST)); --Index > 0;)
            {
                ZeroMemory(&Item, sizeof(LV_ITEM));
                Item.mask = LVIF_PARAM;
                Item.iItem = Index;
                (VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
                HeapFree(hProcessHeap, 0, (LPVOID) Item.lParam);
            }
            HeapFree(hProcessHeap, 0, (LPVOID) pDeviceStatusText);
        }
        break;
    }

    return FALSE;
}