예제 #1
0
static LPTSTR
CreateNewConsoleTitle(VOID)
{
    LPTSTR lpTitle;

    if (LoadAndFormatString(hAppInstance,
                            IDS_CONSOLETITLE,
                            &lpTitle,
                            ++NewConsoleCount) == 0)
    {
        lpTitle = NULL;
    }

    return lpTitle;
}
예제 #2
0
파일: hwpage.c 프로젝트: hoangduit/reactos
static VOID
UpdateControlStates(IN PHARDWARE_PAGE_DATA hpd)
{
    PHWDEVINFO HwDevInfo;
    HWND hBtnTroubleShoot, hBtnProperties;

    hBtnTroubleShoot = GetDlgItem(hpd->hWnd,
                                  IDC_TROUBLESHOOT);
    hBtnProperties = GetDlgItem(hpd->hWnd,
                                IDC_PROPERTIES);

    HwDevInfo = (PHWDEVINFO)ListViewGetSelectedItemData(hpd->hWndDevList);
    if (HwDevInfo != NULL)
    {
        /* update static controls */
        WCHAR szBuffer[256];
        LPWSTR szFormatted = NULL;

        /* get the manufacturer string */
        if (GetDeviceManufacturerString(HwDevInfo->ClassDevInfo->hDevInfo,
                                        &HwDevInfo->DevInfoData,
                                        szBuffer,
                                        sizeof(szBuffer) / sizeof(szBuffer[0])) &&
            LoadAndFormatString(hDllInstance,
                                IDS_MANUFACTURER,
                                &szFormatted,
                                szBuffer) != 0)
        {
            SetDlgItemText(hpd->hWnd,
                           IDC_MANUFACTURER,
                           szFormatted);
            LocalFree((HLOCAL)szFormatted);
        }

        /* get the location string */
        if (GetDeviceLocationString(HwDevInfo->ClassDevInfo->hDevInfo,
                                    &HwDevInfo->DevInfoData,
                                    0,
                                    szBuffer,
                                    sizeof(szBuffer) / sizeof(szBuffer[0])) &&
            LoadAndFormatString(hDllInstance,
                                IDS_LOCATION,
                                &szFormatted,
                                szBuffer) != 0)
        {
            SetDlgItemText(hpd->hWnd,
                           IDC_LOCATION,
                           szFormatted);
            LocalFree((HLOCAL)szFormatted);
        }

        if (GetDeviceStatusString(HwDevInfo->DevInfoData.DevInst,
                                  NULL,
                                  szBuffer,
                                  sizeof(szBuffer) / sizeof(szBuffer[0])) &&
            LoadAndFormatString(hDllInstance,
                                IDS_STATUS,
                                &szFormatted,
                                szBuffer) != 0)
        {
            SetDlgItemText(hpd->hWnd,
                           IDC_STATUS,
                           szFormatted);
            LocalFree((HLOCAL)szFormatted);
        }
    }
    else
    {
        /* clear static controls */
        SetDlgItemText(hpd->hWnd,
                       IDC_MANUFACTURER,
                       NULL);
        SetDlgItemText(hpd->hWnd,
                       IDC_LOCATION,
                       NULL);
        SetDlgItemText(hpd->hWnd,
                       IDC_STATUS,
                       NULL);
    }

    EnableWindow(hBtnTroubleShoot,
                 HwDevInfo != NULL);
    EnableWindow(hBtnProperties,
                 HwDevInfo != NULL);
}
예제 #3
0
파일: mainwnd.c 프로젝트: GYGit/reactos
static VOID
MainWndCommand(PMAIN_WND_INFO Info,
               WORD CmdId,
               HWND hControl)
{
    static TCHAR szFileName[MAX_PATH];
    static TCHAR szDocumentName[MAX_PATH];

    UNREFERENCED_PARAMETER(hControl);

    switch (CmdId)
    {
        case ID_NEW:
        {
            OPEN_EDIT_INFO OpenInfo;
            INT Ret;

            OpenInfo.CreateNew = TRUE;

            LoadAndFormatString(hInstance,
                                IDS_DEFAULT_NAME,
                                &OpenInfo.lpDocumentName,
                                ++Info->ImagesCreated);

            Ret = DialogBox(hInstance,
                            MAKEINTRESOURCE(IDD_NEWDOCSEL),
                            Info->hSelf,
                            NewDocSelDlgProc);
            if (Ret != -1)
            {
                OpenInfo.DocType = Ret;

                CreateEditWindow(Info,
                                 &OpenInfo);
            }

        }
        break;

        case ID_BOLD:
            MessageBox(NULL, _T("Bingo"), NULL, 0);
        break;

        case ID_OPEN:
        {
            OPEN_EDIT_INFO OpenInfo;

            if (DoOpenFile(Info->hSelf,
                           szFileName,   /* full file path */
                           szDocumentName)) /* file name */
            {
                OpenInfo.CreateNew = FALSE;

                OpenInfo.lpDocumentPath = szFileName;
                OpenInfo.lpDocumentName = szDocumentName;

                CreateEditWindow(Info,
                                 &OpenInfo);
            }

        }
        break;

        case ID_EXIT:
            SendMessage(Info->hSelf,
                        WM_CLOSE,
                        0,
                        0);
            break;

        /* Window Menu */
        case ID_WINDOW_TILE_HORZ:
            SendMessage(Info->hMdiClient,
                        WM_MDITILE,
                        MDITILE_HORIZONTAL,
                        0);
            break;

        case ID_WINDOW_TILE_VERT:
            SendMessage(Info->hMdiClient,
                        WM_MDITILE,
                        MDITILE_VERTICAL,
                        0);
            break;

        case ID_WINDOW_CASCADE:
            SendMessage(Info->hMdiClient,
                        WM_MDICASCADE,
                        0,
                        0);
            break;

        case ID_WINDOW_ARRANGE:
            SendMessage(Info->hMdiClient,
                        WM_MDIICONARRANGE,
                        0,
                        0);
            break;

        case ID_WINDOW_NEXT:
            SendMessage(Info->hMdiClient,
                        WM_MDINEXT,
                        0,
                        0);
            break;

        /* Help Menu */
        case ID_ABOUT:
            DialogBox(hInstance,
                      MAKEINTRESOURCE(IDD_ABOUTBOX),
                      Info->hSelf,
                      AboutDialogProc);
            break;
    }
}