MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / FileMRUDlgProc

Function FileMRUDlgProc

src/Dialogs.c:873–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

871
872
873INT_PTR CALLBACK FileMRUDlgProc ( HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam )
874{
875 switch ( umsg ) {
876 case WM_INITDIALOG: {
877 SHFILEINFO shfi;
878 LVCOLUMN lvc = { LVCF_FMT | LVCF_TEXT, LVCFMT_LEFT, 0, L"", -1, 0, 0, 0 };
879 LPICONTHREADINFO lpit = ( LPVOID ) GlobalAlloc ( GPTR, sizeof ( ICONTHREADINFO ) );
880 SetProp ( hwnd, L"it", ( HANDLE ) lpit );
881 lpit->hwnd = GetDlgItem ( hwnd, IDC_FILEMRU );
882 lpit->hExitThread = CreateEvent ( NULL, TRUE, FALSE, NULL );
883 lpit->hTerminatedThread = CreateEvent ( NULL, TRUE, TRUE, NULL );
884 SetWindowLongPtr ( hwnd, DWLP_USER, ( LONG_PTR ) lParam );
885 ResizeDlg_Init ( hwnd, cxFileMRUDlg, cyFileMRUDlg, IDC_RESIZEGRIP );
886 ListView_SetImageList ( GetDlgItem ( hwnd, IDC_FILEMRU ),
887 ( HIMAGELIST ) SHGetFileInfo ( L"C:\\", 0, &shfi, sizeof ( SHFILEINFO ), SHGFI_SMALLICON | SHGFI_SYSICONINDEX ),
888 LVSIL_SMALL );
889 ListView_SetImageList ( GetDlgItem ( hwnd, IDC_FILEMRU ),
890 ( HIMAGELIST ) SHGetFileInfo ( L"C:\\", 0, &shfi, sizeof ( SHFILEINFO ), SHGFI_LARGEICON | SHGFI_SYSICONINDEX ),
891 LVSIL_NORMAL );
892 //SetExplorerTheme(GetDlgItem(hwnd,IDC_FILEMRU));
893 ListView_SetExtendedListViewStyle ( GetDlgItem ( hwnd, IDC_FILEMRU ),/*LVS_EX_FULLROWSELECT|*/LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP );
894 ListView_InsertColumn ( GetDlgItem ( hwnd, IDC_FILEMRU ), 0, &lvc );
895 // Update view
896 SendMessage ( hwnd, WM_COMMAND, MAKELONG ( 0x00A0, 1 ), 0 );
897 if ( bSaveRecentFiles ) {
898 CheckDlgButton ( hwnd, IDC_SAVEMRU, BST_CHECKED );
899 }
900 CenterDlgInParent ( hwnd );
901 }
902 return TRUE;
903 case WM_DESTROY: {
904 LPICONTHREADINFO lpit = ( LPVOID ) GetProp ( hwnd, L"it" );
905 SetEvent ( lpit->hExitThread );
906 while ( WaitForSingleObject ( lpit->hTerminatedThread, 0 ) != WAIT_OBJECT_0 ) {
907 MSG msg;
908 if ( PeekMessage ( &msg, NULL, 0, 0, PM_REMOVE ) ) {
909 TranslateMessage ( &msg );
910 DispatchMessage ( &msg );
911 }
912 }
913 CloseHandle ( lpit->hExitThread );
914 CloseHandle ( lpit->hTerminatedThread );
915 RemoveProp ( hwnd, L"it" );
916 GlobalFree ( lpit );
917 bSaveRecentFiles = ( IsDlgButtonChecked ( hwnd, IDC_SAVEMRU ) ) ? 1 : 0;
918 ResizeDlg_Destroy ( hwnd, &cxFileMRUDlg, &cyFileMRUDlg );
919 }
920 return FALSE;
921 case WM_SIZE: {
922 int dx;
923 int dy;
924 HDWP hdwp;
925 ResizeDlg_Size ( hwnd, lParam, &dx, &dy );
926 hdwp = BeginDeferWindowPos ( 5 );
927 hdwp = DeferCtlPos ( hdwp, hwnd, IDC_RESIZEGRIP, dx, dy, SWP_NOSIZE );
928 hdwp = DeferCtlPos ( hdwp, hwnd, IDOK, dx, dy, SWP_NOSIZE );
929 hdwp = DeferCtlPos ( hdwp, hwnd, IDCANCEL, dx, dy, SWP_NOSIZE );
930 hdwp = DeferCtlPos ( hdwp, hwnd, IDC_FILEMRU, dx, dy, SWP_NOMOVE );

Callers

nothing calls this directly

Calls 13

SetWindowLongPtrFunction · 0.85
ResizeDlg_InitFunction · 0.85
CenterDlgInParentFunction · 0.85
ResizeDlg_DestroyFunction · 0.85
ResizeDlg_SizeFunction · 0.85
DeferCtlPosFunction · 0.85
ResizeDlg_GetMinMaxInfoFunction · 0.85
MRU_EnumFunction · 0.85
PathAbsoluteFromAppFunction · 0.85
MsgBoxFunction · 0.85
MRU_DeleteFunction · 0.85
MRU_DeleteFileFromStoreFunction · 0.85

Tested by

no test coverage detected