|
Luc Pattyn wrote: prefer to have the delegate as an instance member... have a static list of devices
That's what I meant, I just didn't describe it that well! This code is to be consumed elsewhere so the using would be tricky to implement here - but easy for the consumer.
The Close from the finalizer is a strange issue. It works fine (I think) if the finalizer is called during normal execution, but if called when a consuming application closes (and so releases all references) it causes the problems. I don't have the code with me right now but will post a snippet later when I get home (this is a hobby not work project - the best kind ).
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I just made a complete sample ready to post here, and calling Close in the finalizer is working without error!
Must have something else causing the problem in the original code - thanks for your time anyway!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
perseverance is king!
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
im right now working on codedom. im supposed to create a appdomain n let the resulting code (the output code) of my program run in the appdomain, how do i do it??? also how do i unload the appdomain once my work is done!!! please help me out.... am lost!!!
|
|
|
|
|
yams2510 wrote: im supposed to create a appdomain n let the resulting code (the output code) of my program run in the appdomain, how do i do it???
As shown in example here [^]at MSDN.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Not that trivial this. You can create an AppDomain easily enough (CreateDomain method on static AppDomain if I remember rightly). Not sure how you inject your codedom stuff in there, but I'm sure there's examples on the net.
You then need to marshal your calls to the stuff in the new app domain. You'll probably need to create a stub class in the new AppDomain and derive from MarshalByRefObject to do this.
You can dispose of an AppDomain by calling Unload.
Make any sense?
Regards,
Rob Philpott.
|
|
|
|
|
hey thanks..... it did make some sense.... the problem is am new to asp.net c# programming..... so new dat i just heard datsome thing called CODEDOm existed 4 days ago...some how dealt with it n now am sorta programmin in it... n yestday i was asked to work on appdomain... n im kinda lost... so it would be very very helpful if u could elaborate ..... thnx a lot ...inadvance...
|
|
|
|
|
Is there a WMI namespace, class and properties to get the time on a machine?
Thanks
|
|
|
|
|
Look at this[^].
Did you try even once to find the answer yourself?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi,
Try Win32_LocalTime, or Win32_UTCTime and Win32_TimeZone.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
|
System.TimeZone for the current time zone.
DateTime.Now for the current time.
Anything else?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Nagy Vilmos wrote: Anything else?
for remote queries WMI may work better.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
woteva
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
akármi?
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
igen.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
rendben!
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
hello,
I use Microsoft.Office.Interop.Excel to creat excell file-I create it and in the end of the work with it i close it using
Microsoft.Office.Interop.Excel.Application ExcelApp
But the problem is that even after i close the application the excell still appears in the task manager(in processes).
How can i kill it in the program (when i finish working with excell)?
|
|
|
|
|
I did it this way :
ApplicationClass app = new ApplicationClass();
Workbook workBook = app.Workbooks.Open(filename, 0, true, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
...
app.Workbooks.Close();
app.Quit();
Marshal.FinalReleaseComObject(app);
|
|
|
|
|
It doesn't help.
I still have the process of EXCELL running (in task manager)
|
|
|
|
|
Does anyone know what the problem may be?
|
|
|
|
|
Have you tried to release the Workbook, Worksheets, Ranges etc? The below works for me. I finally force the Garbadge collector to collect.
System.Runtime.InteropServices.Marshal.ReleaseComObject(objRange);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objSheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objBook);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcel);
GC.Collect();
These work fine for me.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
I don't have excell range object
i only do objsheet.getrange.... or something like that
so i did the ReleaseComObject only to the application (objexcel), the sheet and the book.
Anyway,
The program still doesn't release the Excell process and i have it in task manager. What can be the problem?
|
|
|
|
|
I want to copy a font file to the fonts directory on windows vista, but currently i fail to get the right permissions.
Everytime I try to copy the font from its current folder to the font-directory (c:\windows\fonts) I get an "UnauthorisedAccessException"
My code looks like this at the moment:
if (System.IO.File.Exists(fontPath))
{
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, "C:\\Windows\\Fonts\\");
f2.AddPathList(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, fontPath);
if (SecurityManager.IsGranted(f2) == true)
MessageBox.Show("Its fine!!");
else
MessageBox.Show("No Permissions");
try
{
f2.Demand();
MessageBox.Show(fontPath);
System.IO.File.Copy(fontPath, destination);
}
catch (SecurityException se)
{
MessageBox.Show(se.ToString());
}
catch (UnauthorizedAccessException ex)
{
MessageBox.Show(ex.ToString());
}
}
<pre>
Thanks for your help
|
|
|
|
|
Do you have rights to access the Fonts folder?
Which line throws the exception? That would help knowing where the problem is.
जय हिंद
|
|
|
|