I wrote the file manager on C# and I've got couple of problems ( 1. all the hidden files or folders are visible 2. If you hide hidden their are not visible!)) But when i unhide hidden they look like regular files or folders! (( 3. when I cut the files or folders
are not a visual effect is not observed ( thanks a lot!))
just to clarify....you did this in Asp.Net or Winforms? If Winforms you will want to head over to the MSDN forums or such, as you are in the Wrong place.
Have you read the book? - ASP.Net 3.5 CMS Development (now on Kindle)
v5.1 of iTracker (Inventory Tracker Starter Kit) is out, Download it now!
Marked as answer by Figo Fei - MSFT on Jun 11, 2009 06:42 AM
You have Options in Registry,just fallow these steps
Open your registry and find or create the key below.
Create a new DWORD value, or modify the existing value, called "Hidden" and set it according to the value data below.
Exit your registry; you may need to restart or log out of Windows for the change to take effect.
Registry Settings
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\
Advanced]
Value Name: Hidden
Data Type: REG_DWORD (DWORD Value)
Value Data: (1 = show hidden, 2 = do not show)
So About steps can be automated through c# or vb.net.
Use below functions to read or write to Registry
public
string SubKey
{
get {
return subKey; }
set { subKey =
value; }
}
private RegistryKey baseRegistryKey = Registry.LocalMachine;
///
<summary>
/// A property to set the BaseRegistryKey value.
/// (default = Registry.LocalMachine)
///
</summary>
public RegistryKey BaseRegistryKey
{
get {
return baseRegistryKey; }set { baseRegistryKey
= value; }
}
///
<summary>
/// To read a registry key.
/// input: KeyName (string)
/// output: value (string)
///
</summary>
public
string Read(string KeyName)
{
// Opening the registry key
RegistryKey rk = baseRegistryKey;
// Open a subKey as read-only
RegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistrySubKey doesn't exist -> (null)
if (sk1 ==
null)
{
return
null;
}
else
{
try
{
// If the RegistryKey exists I get its value
// or null is returned.
return (string)sk1.GetValue(KeyName.ToUpper());
///
<summary>
/// To write into a registry key.
/// input: KeyName (string) , Value (object)
/// output: true or false
///
</summary>
public
bool Write(string KeyName,
object Value)
{
try
{
// Setting
RegistryKey rk = baseRegistryKey;
// I have to use CreateSubKey
// (create or open it if already exits),
// 'cause OpenSubKey open a subKey as read-only
BOBnUR
0 Points
1 Post
C# file manager
Jun 05, 2009 12:30 PM|LINK
Curt_C
All-Star
66014 Points
7639 Posts
Moderator
Re: C# file manager
Jun 05, 2009 12:47 PM|LINK
just to clarify....you did this in Asp.Net or Winforms? If Winforms you will want to head over to the MSDN forums or such, as you are in the Wrong place.
v5.1 of iTracker (Inventory Tracker Starter Kit) is out, Download it now!
Paul Linton
Star
13403 Points
2531 Posts
Re: C# file manager
Jun 07, 2009 02:52 AM|LINK
It is very hard to find the bugs in your code if you don't event show us the code!
shabirhakim1
Star
13496 Points
2145 Posts
Re: C# file manager
Jun 11, 2009 05:39 AM|LINK
Hi,
You have Options in Registry,just fallow these steps
Open your registry and find or create the key below.
Create a new DWORD value, or modify the existing value, called "Hidden" and set it according to the value data below.
Exit your registry; you may need to restart or log out of Windows for the change to take effect.
Registry Settings
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\
Advanced]
Value Name: Hidden
Data Type: REG_DWORD (DWORD Value)
Value Data: (1 = show hidden, 2 = do not show)
So About steps can be automated through c# or vb.net.
Use below functions to read or write to Registry
public string SubKey{
get { return subKey; } set { subKey = value; }}
private RegistryKey baseRegistryKey = Registry.LocalMachine; /// <summary> /// A property to set the BaseRegistryKey value. /// (default = Registry.LocalMachine) /// </summary> public RegistryKey BaseRegistryKey{
get { return baseRegistryKey; }set { baseRegistryKey = value; }}
/// <summary> /// To read a registry key. /// input: KeyName (string) /// output: value (string) /// </summary> public string Read(string KeyName){
// Opening the registry keyRegistryKey rk = baseRegistryKey;
// Open a subKey as read-onlyRegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistrySubKey doesn't exist -> (null) if (sk1 == null){
return null;}
else{
try{
// If the RegistryKey exists I get its value // or null is returned. return (string)sk1.GetValue(KeyName.ToUpper());}
catch (Exception e){
// AAAAAAAAAAARGH, an error! ShowErrorMessage(e, "Reading registry " + KeyName.ToUpper());return null;}
}
}
/// <summary> /// To write into a registry key. /// input: KeyName (string) , Value (object) /// output: true or false /// </summary> public bool Write(string KeyName, object Value){
try{
// SettingRegistryKey rk = baseRegistryKey;
// I have to use CreateSubKey // (create or open it if already exits), // 'cause OpenSubKey open a subKey as read-onlyRegistryKey sk1 = rk.CreateSubKey(subKey);
// Save the valuesk1.SetValue(KeyName.ToUpper(), Value);
return true;}
catch (Exception e){
// AAAAAAAAAAARGH, an error! ShowErrorMessage(e, "Writing registry " + KeyName.ToUpper());return false;}
}
/// <summary> /// To delete a registry key. /// input: KeyName (string) /// output: true or false /// </summary> public bool DeleteKey(string KeyName){
try{
// SettingRegistryKey rk = baseRegistryKey;
RegistryKey sk1 = rk.CreateSubKey(subKey);
// If the RegistrySubKey doesn't exists -> (true) if (sk1 == null) return true; elsesk1.DeleteValue(KeyName);
return true;}
catch (Exception e){
// AAAAAAAAAAARGH, an error! ShowErrorMessage(e, "Deleting SubKey " + subKey); return false;}
Thanks
shabir hakim