Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: AboutDataGridView Pin
DaveyM691-Jul-09 22:45
professionalDaveyM691-Jul-09 22:45 
AnswerRe: AboutDataGridView Pin
Manas Bhardwaj1-Jul-09 22:46
professionalManas Bhardwaj1-Jul-09 22:46 
AnswerRe: [Message Deleted] Pin
creend1-Jul-09 22:53
creend1-Jul-09 22:53 
Question[Message Deleted] Pin
creend1-Jul-09 22:38
creend1-Jul-09 22:38 
AnswerRe: AboutWinform Pin
DaveyM691-Jul-09 22:43
professionalDaveyM691-Jul-09 22:43 
AnswerRe: [Message Deleted] Pin
creend1-Jul-09 22:53
creend1-Jul-09 22:53 
QuestionOpen File Dialog Box Pin
Satish Pai1-Jul-09 20:20
Satish Pai1-Jul-09 20:20 
AnswerRe: Open File Dialog Box Pin
OriginalGriff1-Jul-09 23:02
mveOriginalGriff1-Jul-09 23:02 
If I read you correctly, what you want to do is modify the "Places" pane of the standard windows "Open" and "Save" dialogs, to include custom locations rather than just the standard "My Documents" and "My Computer" etc.

You can do this in two ways, but they both mean editing the registry, either by hand or by software.
This works in XP, don't know about Vista Dead | X|
Note that Office has its own set of "Places" pane settings, which varies depending on which version you are using (Thanks, Microsoft! Standards! Lovely!).

The key you are interested in is:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\ComDlg32\PlacesBar

If it does not exist, create it. WARNING: the existance of this key overrides standard Windows behaviour and removes all items from the "Places" pane - you can delete this key to restore them.
You now need to create up to five values, named "Place0" to "Place4" inclusive, and items will be displayed in this order, with Place0 at the top of the pane.
The values can be string as in "E:\Correspondance", or DWORD as in the following table.
The DWORD values give you access to the standard items that existed before you started changing the registry - for example, if you set "Place0" to DWORD 5, the top item, in the pane will be "My Documents"
This list is (probably) not exhaustive, but if you find others that are useful, let me know. The list is (obviously) in Hex:

0 Desktop 
1 Internet Explorer 
2 Start Menu\Programs 
3 My Computer\Control Panel 
4 My Computer\Printers 
5 My Documents 
6 <user name>\Favorites 
7 Start Menu\Programs\Startup 
8 <user name>\Recent 
9 <user name>\SendTo 
a <desktop>\Recycle Bin 
b <user name>\Start Menu 
c logical "My Documents" desktop icon 
d "My Music" folder 
e "My Videos" folder 
10 <user name>\Desktop 
11 My Computer 
12 Network Neighborhood (My Network Places) 
13 <user name>\nethood 
14 Windows\Fonts 
16 All Users\Start Menu 
17 All Users\Start Menu\Programs 
18 All Users\Startup 
19 All Users\Desktop 
1a <user name>\Application Data 
1b <user name>\PrintHood 
1c <user name>\Local Settings\Applicaiton Data (nonroaming)0x001d // nonlocalized startup 
1e Nonlocalized common startup 
1f Common favorites 
20 Internet Cache 
21 Cookies 
22 History 
23 All Users\Application Data 
24 GetWindowsDirectory() 
25 GetSystemDirectory() 
26 C:\Program Files 
27 C:\Program Files\My Pictures 
28 USERPROFILE 
29 x86 system directory on RISC 
2a x86 C:\Program Files on RISC 
2b C:\Program Files\Common 
2c x86 Program Files\Common on RISC 
2d All Users\Templates 
2e All Users\Documents 
2f All Users\Start Menu\Programs\Administrative Tools 
30 <user name>\Start Menu\Programs\Administrative Tools 
31 Network and Dial-up Connections 
35 All Users\My Music 
36 All Users\My Pictures 
37 All Users\My Video 
38 Resource Directory 
39 Localized Resource Directory 
3a Links to All Users OEM specific apps 


To do this via REGEDIT is pretty obvious; I don't need to cover that.

Programmatically is pretty simple:
RegistryKey regKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\ComDlg32\PlacesBar");
try
    {
    regKey.SetValue("Place0", 6, RegistryValueKind.DWord);
    regKey.SetValue("Place1", @"E:\Correspondance", RegistryValueKind.String);
    }
catch (Exception ex)
    {
    Console.WriteLine(ex.Message);
    }
finally
    {
    regKey.Close();
    }

You will need to add the using for "Microsoft.Win32" - but you know how to do that, right!

This example sets the top two entries in the "Places" pane to "Favourites" and "E:\Correspondance".

No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.

This message is made of fully recyclable Zeros and Ones

QuestionAPI Hooking Pin
Satish Pai1-Jul-09 19:23
Satish Pai1-Jul-09 19:23 
AnswerRe: API Hooking Pin
Eddy Vluggen1-Jul-09 20:47
professionalEddy Vluggen1-Jul-09 20:47 
GeneralRe: API Hooking Pin
Satish Pai1-Jul-09 23:10
Satish Pai1-Jul-09 23:10 
GeneralRe: API Hooking Pin
Eddy Vluggen1-Jul-09 23:32
professionalEddy Vluggen1-Jul-09 23:32 
GeneralRe: API Hooking Pin
Satish Pai1-Jul-09 23:43
Satish Pai1-Jul-09 23:43 
GeneralRe: API Hooking Pin
Eddy Vluggen2-Jul-09 0:18
professionalEddy Vluggen2-Jul-09 0:18 
GeneralRe: API Hooking Pin
Henry Minute2-Jul-09 0:08
Henry Minute2-Jul-09 0:08 
QuestionIndex was out of range. Must be non-negative and less than the size of the collection while adding combo box control to listview control Pin
puppya1-Jul-09 18:17
puppya1-Jul-09 18:17 
AnswerRe: Index was out of range. Must be non-negative and less than the size of the collection while adding combo box control to listview control Pin
Not Active1-Jul-09 18:32
mentorNot Active1-Jul-09 18:32 
GeneralRe: Index was out of range. Must be non-negative and less than the size of the collection while adding combo box control to listview control Pin
puppya1-Jul-09 18:37
puppya1-Jul-09 18:37 
AnswerRe: Index was out of range. Must be non-negative and less than the size of the collection while adding combo box control to listview control Pin
Vikram A Punathambekar1-Jul-09 19:53
Vikram A Punathambekar1-Jul-09 19:53 
QuestionDirectX + Secondary monitor Pin
thomaxz.tc1-Jul-09 10:47
thomaxz.tc1-Jul-09 10:47 
AnswerRe: DirectX + Secondary monitor Pin
I Believe In GOD1-Jul-09 10:57
I Believe In GOD1-Jul-09 10:57 
GeneralRe: DirectX + Secondary monitor Pin
thomaxz.tc1-Jul-09 13:30
thomaxz.tc1-Jul-09 13:30 
Questionabout the usinhg Visual Studio 2010 beta 1 Pin
Seraph_summer1-Jul-09 10:23
Seraph_summer1-Jul-09 10:23 
AnswerRe: about the usinhg Visual Studio 2010 beta 1 Pin
Pete O'Hanlon1-Jul-09 10:30
mvePete O'Hanlon1-Jul-09 10:30 
GeneralRe: about the usinhg Visual Studio 2010 beta 1 Pin
Seraph_summer1-Jul-09 10:35
Seraph_summer1-Jul-09 10:35 

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.