Hi All!!
Could you please help me with three problems:
1.
I would like to have a procedure that returned true if the file is
writtable=delet able.. I tried everything but so far the only way I can
really tell if the file can be delete is to actually try to delete it and
catch an exception.. Trying to open a file with StreamReader in write mode
didn't work as expected.
2:
I know how to create shortcut, using COM API, but I can't seem to find
parameter for setting shortcuts name when put for example on Start Meni.. if
I don't set this, then the name of link is just the name of file, which is a
little bit ugly.
my code is here.. note the line, marked with ###
public static void CreateShortcut( string name, string shortcut_dir, string
app_path, string description)
{
// Get the app path and filename
//string app = app_path;
try
{
// Create a Windows Script Host Shell class
IWshShell_Class shell = new IWshShell_Class Class();
//get application executable from entire path
string app_file = Path.GetFileNam e(app_path);
// Define the shortcut file
IWshShortcut_Cl ass shortcut = shell.CreateSho rtcut(shortcut_ dir + "\\" +
app_file + ".lnk") as
IWshShortcut_Cl ass;
// Set all its properties
//### I thought the following line was what I was looking for.. but when
I tried to set this,
//compiler says it is only readonly field.. so.. my question is: is this
the field and this is the bug, or should I do something else to set the real
name of the shortcut which user sees?
//shortcut.FullNa me = name;
shortcut.Workin gDirectory = Path.GetDirecto ryName(app_path );
shortcut.Target Path = app_path;
shortcut.IconLo cation = app_path + ",0";
if(description != null)
{
shortcut.Descri ption = description;
}
// Save it
shortcut.Save() ;
}
catch(COMExcept ion ex)
{
Console.WriteLi ne(ex.Message);
}
}
3.
I would like to periodically make a backup copy of all .mdb files while the
application is running in the background (it is database server .. c#
remoting, ADO.NET).
The thing is that not all the recent changes are in those .mdb files, when I
copy them.. if I reset the server, then the files are up-to-date.
I see the solution in two possible ways:
somehow get all the data from ADO.NET objects and create new mdb files.
or..somehow forcing ADO, to write all the pending actions before physically
copying .mdb files.
I am currently traveling, so my access to internet, book and other
information is restricted.. I've been fighting with those problems for some
time, but then I came to blind alley. Your help would be greatly
appreciated.
Thank you so much!!!
David Krmpotic