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; }
LRESULT CVideoMarkup::OnCreate(UINT, WPARAM, LPARAM, BOOL& ) { // create graphics structures for video and examples HDC hdc = GetDC(); hdcmem = CreateCompatibleDC(hdc); hdcmemExamples = CreateCompatibleDC(hdc); hbm = CreateCompatibleBitmap(hdc,WINDOW_X,WINDOW_Y); hbmExamples = CreateCompatibleBitmap(hdc,EXAMPLEWINDOW_WIDTH,EXAMPLEWINDOW_HEIGHT); SelectObject(hdcmem,hbm); SelectObject(hdcmemExamples,hbmExamples); ReleaseDC(hdc); graphics = new Graphics(hdcmem); graphicsExamples = new Graphics(hdcmemExamples); graphics->SetSmoothingMode(SmoothingModeAntiAlias); graphics->Clear(Color(255,255,255)); graphicsExamples->Clear(Color(255,255,255)); // create the active window region to invalidate HRGN filterRgn = CreateRectRgnIndirect(&m_filterRect); HRGN videoRgn = CreateRectRgnIndirect(&m_videoRect); activeRgn = CreateRectRgnIndirect(&m_filterRect); CombineRgn(activeRgn, filterRgn, videoRgn, RGN_OR); DeleteObject(filterRgn); DeleteObject(videoRgn); hTrashCursor = LoadCursor(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDC_TRASHCURSOR)); hDropCursor = LoadCursor(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDC_DROPCURSOR)); // Create the list of samples m_sampleListView.Create(m_hWnd, CRect(VIDEO_X,0,WINDOW_X-5,VIDEO_Y-50), _T(""), WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | LVS_ICON | LVS_AUTOARRANGE); // create the list of example images m_hImageList = ImageList_Create(LISTVIEW_SAMPLE_X, LISTVIEW_SAMPLE_Y, ILC_COLOR32 | ILC_MASK, 0, MAX_SAMPLES); ListView_SetImageList(m_sampleListView, m_hImageList, LVSIL_NORMAL); // ListView_SetIconSpacing(m_sampleListView, LISTVIEW_SAMPLE_X*2, LISTVIEW_SAMPLE_Y*1.5); ListView_SetIconSpacing(m_sampleListView, LISTVIEW_SAMPLE_X+20, LISTVIEW_SAMPLE_Y+20); ListView_EnableGroupView(m_sampleListView, TRUE); ListView_SetExtendedListViewStyle(m_sampleListView, LVS_EX_DOUBLEBUFFER | LVS_EX_BORDERSELECT | LVS_EX_FLATSB); // create an image list for the group header images //hGroupHeaderImages = ImageList_Create(400,50,ILC_COLOR32 | ILC_MASK,2,2); //HBITMAP hbmPos = LoadBitmap(_Module.get_m_hInst(), MAKEINTRESOURCE(IDB_THUMBSUP)); //HBITMAP hbmNeg = LoadBitmap(_Module.get_m_hInst(), MAKEINTRESOURCE(IDB_THUMBSDOWN)); //ImageList_Add(hGroupHeaderImages, hbmPos, NULL); //ImageList_Add(hGroupHeaderImages, hbmNeg, NULL); //DeleteObject(hbmPos); //DeleteObject(hbmNeg); //ListView_SetGroupHeaderImageList(m_sampleListView, hGroupHeaderImages); // add the "positive" and "negative" groups AddListViewGroup(m_sampleListView, L"Positive Image Examples", GROUPID_POSSAMPLES); AddListViewGroup(m_sampleListView, L"Negative Image Examples", GROUPID_NEGSAMPLES); AddListViewGroup(m_sampleListView, L"Motion Examples", GROUPID_MOTIONSAMPLES); AddListViewGroup(m_sampleListView, L"Video Range Examples", GROUPID_RANGESAMPLES); AddListViewGroup(m_sampleListView, L"Trash", GROUPID_TRASH); // Create the video slider m_videoControl.Create(m_hWnd, WS_CHILD | WS_VISIBLE | WS_DISABLED ); m_videoControl.MoveWindow(0,VIDEO_Y,VIDEO_X,SLIDER_Y); m_videoControl.ShowWindow(TRUE); m_videoControl.EnableWindow(FALSE); m_videoControl.EnableSelectionRange(false); // Create the filter selector m_filterSelect.Create(m_hWnd, WS_CHILD | WS_VISIBLE | WS_DISABLED); m_filterSelect.MoveWindow(VIDEO_X, VIDEO_Y-50, WINDOW_X-VIDEO_X, WINDOW_Y-VIDEO_Y+50); // Start with "Color" mode selected m_filterSelect.SelectFilter(COLOR_FILTER); m_filterSelect.ShowWindow(TRUE); m_filterSelect.EnableWindow(FALSE); return 0; }