Click here to Skip to main content
15,896,314 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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);

GeneralTimer handler for 1 ms Pin
Member 202517628-Jul-05 22:02
Member 202517628-Jul-05 22:02 
GeneralRe: Timer handler for 1 ms Pin
Marc Soleda28-Jul-05 22:15
Marc Soleda28-Jul-05 22:15 
GeneralRe: Timer handler for 1 ms Pin
peterchen28-Jul-05 23:40
peterchen28-Jul-05 23:40 
Generalbscmake crashing at #import <mshtml.tlb> Pin
rrrado28-Jul-05 22:00
rrrado28-Jul-05 22:00 
Generalsolved Pin
rrrado29-Jul-05 2:39
rrrado29-Jul-05 2:39 
GeneralDisabling CROSS button on dialog Pin
Shailesh Halankar28-Jul-05 21:14
sussShailesh Halankar28-Jul-05 21:14 
GeneralRe: Disabling CROSS button on dialog Pin
Stlan28-Jul-05 21:19
Stlan28-Jul-05 21:19 
GeneralRe: Disabling CROSS button on dialog Pin
ThatsAlok30-Jul-05 4:26
ThatsAlok30-Jul-05 4:26 
GeneralRe: Disabling CROSS button on dialog Pin
Stlan31-Jul-05 19:33
Stlan31-Jul-05 19:33 
GeneralWho can help me(resize a bitmap) Pin
Abd.Eskandari28-Jul-05 20:35
Abd.Eskandari28-Jul-05 20:35 
GeneralRe: Who can help me(resize a bitmap) Pin
Halawlaws28-Jul-05 20:42
Halawlaws28-Jul-05 20:42 
GeneralRe: Who can help me(resize a bitmap) Pin
Russell'29-Jul-05 0:06
Russell'29-Jul-05 0:06 
GeneralMapping views of a MMF Pin
Bob Stanneveld28-Jul-05 20:02
Bob Stanneveld28-Jul-05 20:02 
GeneralSolved. Pin
Bob Stanneveld28-Jul-05 20:46
Bob Stanneveld28-Jul-05 20:46 
Generalreading data from a data file Pin
a_david12328-Jul-05 19:34
a_david12328-Jul-05 19:34 
GeneralRe: reading data from a data file Pin
Christian Graus28-Jul-05 19:50
protectorChristian Graus28-Jul-05 19:50 
GeneralRe: reading data from a data file Pin
David Crow29-Jul-05 6:00
David Crow29-Jul-05 6:00 

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.