Click here to Skip to main content
15,905,874 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDate Time Picker Pin
tiniv29-Jul-05 1:41
tiniv29-Jul-05 1:41 
GeneralRe: Date Time Picker Pin
David Crow29-Jul-05 5:40
David Crow29-Jul-05 5:40 
Questionhow to show controls covered by CTabCtrl Pin
markoot29-Jul-05 0:50
markoot29-Jul-05 0:50 
AnswerRe: how to show controls covered by CTabCtrl Pin
Alexander M.,29-Jul-05 4:11
Alexander M.,29-Jul-05 4:11 
GeneralRe: how to show controls covered by CTabCtrl Pin
markoot29-Jul-05 5:14
markoot29-Jul-05 5:14 
Generalconverting my MFC .exe project to DLL file Pin
bees202429-Jul-05 0:19
bees202429-Jul-05 0:19 
GeneralRe: converting my MFC .exe project to DLL file Pin
Alexander M.,29-Jul-05 4:29
Alexander M.,29-Jul-05 4:29 
GeneralRe: converting my MFC .exe project to DLL file Pin
bees202431-Jul-05 21:31
bees202431-Jul-05 21:31 
GeneralTextOut function Pin
Abd.Eskandari29-Jul-05 0:11
Abd.Eskandari29-Jul-05 0:11 
GeneralRe: TextOut function Pin
Alexander M.,29-Jul-05 4:12
Alexander M.,29-Jul-05 4:12 
GeneralRe: TextOut function Pin
David Crow29-Jul-05 5:41
David Crow29-Jul-05 5:41 
GeneralVS.NET How to add overloaded MFC functions Pin
Adrian Metcalfe28-Jul-05 23:56
Adrian Metcalfe28-Jul-05 23:56 
GeneralRe: VS.NET How to add overloaded MFC functions Pin
Jack Puppy29-Jul-05 0:22
Jack Puppy29-Jul-05 0:22 
GeneralMDI-MainFrame REAL available client area Pin
Russell'28-Jul-05 23:35
Russell'28-Jul-05 23:35 
GeneralDLL + COM Question Pin
peterchen28-Jul-05 23:35
peterchen28-Jul-05 23:35 
GeneralRe: DLL + COM Question Pin
Alexander M.,29-Jul-05 4:20
Alexander M.,29-Jul-05 4:20 
GeneralCustom CFiledialog Pin
Thierry Lebrun28-Jul-05 23:29
Thierry Lebrun28-Jul-05 23:29 
GeneralRe: Custom CFiledialog Pin
Halawlaws29-Jul-05 1:11
Halawlaws29-Jul-05 1:11 
GeneralRe: Custom CFiledialog Pin
Thierry Lebrun29-Jul-05 1:25
Thierry Lebrun29-Jul-05 1:25 
GeneralRe: Custom CFiledialog Pin
David Crow29-Jul-05 5:49
David Crow29-Jul-05 5:49 
GeneralRe: Custom CFiledialog Pin
Thierry Lebrun29-Jul-05 6:27
Thierry Lebrun29-Jul-05 6:27 
GeneralRe: Custom CFiledialog Pin
David Crow29-Jul-05 6:45
David Crow29-Jul-05 6:45 
GeneralRe: Custom CFiledialog Pin
Thierry Lebrun29-Jul-05 7:29
Thierry Lebrun29-Jul-05 7:29 
GeneralRe: Custom CFiledialog Pin
Thierry Lebrun10-Aug-05 3:52
Thierry Lebrun10-Aug-05 3:52 
GeneralRe: Custom CFiledialog Pin
Thierry Lebrun11-Aug-05 1:45
Thierry Lebrun11-Aug-05 1:45 
I have found the solution !!!!! Smile | :)

OPENFILENAME l_ofn; // common dialog box structure
char l_szFile[260]; // buffer for file name
HWND l_hwnd; // owner window
HANDLE l_hf; // file handle
char l_szBuf[80];
DWORD l_dwData;
HKEY l_hkMyCU;
HKEY l_hkPlaceBar;
CString l_Key_PlacesBar = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\ComDlg32\\PlacesBar";

RegCreateKey(HKEY_CURRENT_USER, "CALLuna", &l_hkMyCU);
RegOverridePredefKey(HKEY_CURRENT_USER, l_hkMyCU);

if (RegCreateKey(HKEY_CURRENT_USER, l_Key_PlacesBar, &l_hkPlaceBar) != ERROR_SUCCESS)
{
AfxMessageBox ("Could not create the registry key.");
}

/*
predefined decimal values
=========================
Windows Defined Folder Decimal Code
All Users Desktop 25
All Users Documents 46
All Users Programs 23
All Users Start Menu 22
All Users StartUp Folder 24
Common Files 43
Control Panel 3
Cookies 33
Current Users Programs 2
Current Users Start Menu 11
Current User StartUp Folder 7
Desktop 0
Documents and Settings 40
Favorites 6
Fonts 20
History 34
My Computer 17
My Documents 5
My Music 13
My Pictures 39
My Video 14
Network Neighborhood 18
Program Files 38
Recent Documents 8
Recycle Bin 10
System32 37
Temporary Internet Files 32
Windows 36

*/


// Disque C:
strcpy(l_szBuf, "c:\\");
if (RegSetValueEx(l_hkPlaceBar,
"Place0",
0,
REG_EXPAND_SZ,
(LPBYTE) l_szBuf,
strlen(l_szBuf) + 1)) AfxMessageBox("Could not set the event message file.");

// My Computer
l_dwData = 17;
if (RegSetValueEx(l_hkPlaceBar,
"Place1",
0,
REG_DWORD,
(LPBYTE) &l_dwData,
sizeof(DWORD))) AfxMessageBox("Could not set the supported types.");

// My Document
l_dwData = 5;
if (RegSetValueEx(l_hkPlaceBar, // subkey handle
"Place2", // value name
0, // must be zero
REG_DWORD, // value type
(LPBYTE) &l_dwData, // pointer to value data
sizeof(DWORD))) // length of value data
AfxMessageBox("Could not set the supported types.");

strcpy(l_szBuf, "d:\\Perso");
if (RegSetValueEx(l_hkPlaceBar, // subkey handle
"Place3", // value name
0, // must be zero
REG_EXPAND_SZ, // value type
(LPBYTE) l_szBuf, // pointer to value data
strlen(l_szBuf) + 1)) // length of value data
AfxMessageBox("Could not set the event message file.");

// Favorites
l_dwData = 6;
if (RegSetValueEx(l_hkPlaceBar, // subkey handle
"Place4", // value name
0, // must be zero
REG_DWORD, // value type
(LPBYTE) &l_dwData, // pointer to value data
sizeof(DWORD))) // length of value data
AfxMessageBox("Could not set the supported types.");



RegCloseKey(l_hkPlaceBar);


l_hwnd = GetSafeHwnd();
// Initialize OPENFILENAME
ZeroMemory(&l_ofn, sizeof(l_ofn));
l_ofn.lStructSize = sizeof(l_ofn);
l_ofn.hwndOwner = l_hwnd;
l_ofn.lpstrFile = l_szFile;
//
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of l_szFile to initialize itself.
//
l_ofn.lpstrFile[0] = '\0';
l_ofn.nMaxFile = sizeof(l_szFile);
l_ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
l_ofn.nFilterIndex = 1;
l_ofn.lpstrFileTitle = NULL;
l_ofn.nMaxFileTitle = 0;
l_ofn.lpstrInitialDir = NULL;
l_ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST ;

// Display the Open dialog box.

if (GetOpenFileName(&l_ofn)==TRUE)
l_hf = CreateFile(l_ofn.lpstrFile, GENERIC_READ,
0, (LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);



RegOverridePredefKey(HKEY_CURRENT_USER, NULL);
RegCloseKey(l_hkMyCU);

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.