|
Huh?
I thought the wrapper was in a separate DLL?
You need the C# DLL to be able to load the wrapper DLL which needs the C# DLL?
It still seems to me the wrapper should be doing the loading of the C# DLL, at which time
it can obtain the required class name.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
We use Managed C++ DLL to load the wrapper DLL which is C# DLL. This managed C++ DLL supplies the DLL name, class name to the wrapper DLL. The wrapper DLL loads the C# DLL. Creates the C# Class. The C# DLL uses another managed C++ DLL internally.
|
|
|
|
|
How many wrapper classes are there?
Which C++ DLL are you unable to delete, and which DLLs reference it and how?
The original appdomain shouldn't need anything besides the wrapper DLL.
Is the wrapper class derived from MarshalByRefObject?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am not able to delete the Managed C++ DLL referenced inside the C# DLL. I checked the loaded assembly list using GetAssemblies. Then I found out the the Managed C++ DLL used in C# DLL is also loaded in the default application domain even though I do not use it anywhere except the C# DLL.
|
|
|
|
|
We're going in circles now...
I still question your step 3:
3. Load the Pure C# DLL in the new applicaiton domain. This C# DLL uses
managed C++ DLL.
Seems to me that's the place it gets loaded into the "default" app domain.
Can you look at the loaded assembly list before and after step 3 to confirm?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you for your replies. I found the solution to my problem. The problem is because the Managed C++ DLL that has been used in C# DLL refers to native C++ DLLs that have already been loaded in the main application i.e. default application domain.
So when the managed C++ DLL is getting loaded via C# DLL, the framework instead of loading the native C++ DLL in the new applicaiton domain, uses the DLLs from the default application domain. This is causing the managed C++ DLL also to be loaded into the default application domain. Because of this reason I was not able to delete the managed C++ DLL.
|
|
|
|
|
Makes sense
Good job tracking it down and thanks for the update.
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a dataGridView control which I wish to
1) retrieve a date from
2) subtract days from the retrieved date
3) see if todays date is greater than the the result of item (2)
4) set an appropriate image in one of the dataGridView columns
I have tried:
int alertDays = 0;
foreach (DataGridViewRow row in keyEventsDataGridView.Rows)
{
DateTime alertDate = (DateTime) row.Cells[4].Value;
foreach (DebtorDataSet.KeyEventsRow eventRow in debtorDataSet.KeyEvents)
{
if(eventRow.Code.ToString() == row.Cells["KeyEventCode"].Value.ToString())
{
alertDays = ((int) eventRow.AlertDays);
}
}
alertDate.AddDays(0 - alertDays);
if (DateTime.Compare(DateTime.Now, alertDate) < 0)
{
row.Cells["Status"].Value = keyEventIconsImageList.Images[0];
}
else
row.Cells["Status"].Value = keyEventIconsImageList.Images[1];
}
the line
DateTime alertDate = (DateTime) row.Cells[4].Value;
is giving me problems as it returns no value in debugging mode.
What should the correct syntax for this be please?
|
|
|
|
|
I believe the Value is a String, so you'll probably need to Parse the String into a DateTime object; try using DateTime.Parse() or DateTime.TryParse().
Keep It Simple Stupid! (KISS)
|
|
|
|
|
Maybe because it is the end of the week (for me), but I'm still having trouble with the line:
DateTime alertDate = (DateTime) row.Cells[4].Value;
row.Cells[4].Value does return the expected date as a string, but I need to find a way to assign this to the DateTime variable 'alertDays' so that I can then manipulate the date as the application demands. I tried DateTime.Parse() without success right now.
Any further suggestions would be very much appreciated please.
|
|
|
|
|
I finally figured it out. The power of coffee!!!
|
|
|
|
|
hi. this has been bothering me for quite some time and i still havent figured it out.
i want to calculate hours and minutes between two dates and two different times.
example - an employe signs in on 2.10.2008 at 11:51. he signs out the same day at 22:50.
example 2 - employe signs in on 29.1.2008 at 23:10 and signs out the other day and the other month which starts with the next day (here are two problems - time goes to a new day and a new month) at 5:40.
how can i solve this. ive tried time spant but i dont fully understand its functionality because as far as i know the timespan function returns (with compare) only which given DATE (not time) is over (1,0,-1) or something.
Any other simple ideas?
Thanks in front and sorry for my bad english
Greets,
Matjaz
Força Barça!
|
|
|
|
|
Just subtract the first from the second. The timespan object will contain the number of days, hours, etc between them.
Timespan ts = DateTime2 - DateTime1
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Ok, i get the timespan... but which format do i have the DT1 and 2?
In my example the user has to set the date (selected by datetime component) by hand and also the time (time is set by two value changers... forgot how theyre called... (they have sidebars next to them to incr or decr the value).
Can u give me an example how this could work, as my user has to set his arrival time and date and also his going time and date.
Im sorry for the complications... maybe im just stupid while not understanding :S
Força Barça!
|
|
|
|
|
The resulting timespan structure have all the info that you need.
class Program
{
static void Main(string[] args)
{
DateTime entry = new DateTime(2008, 10, 2, 11, 51, 0);
DateTime exit = new DateTime(2008, 10, 2, 22, 50, 0);
TimeSpan difference = exit - entry;
Console.WriteLine("Hours : {0} - Minutes : {1} - Seconds : {2}", difference.Hours, difference.Minutes, difference.Seconds);
Console.ReadLine();
}
}
Hope this helps.
|
|
|
|
|
How to check, from C#, are files for complex script and rtl languages (Regional and Language settings) installed?
Thanks
|
|
|
|
|
I don't know if there it is built-in class (SystemInformation class might contain this information) for this but I suspect the settings are stored in system registry.
|
|
|
|
|
I did not find it there
Thank you for your answer
Edit: Or is there another way of checking whether right to left text will display correctly on my form?
modified on Thursday, October 30, 2008 11:29 AM
|
|
|
|
|
Hello everyone,
Suppose an exe is linked (referenced) with a couple of DLLs, and both the exe and the DLLs have their own app.config file. My question is, when we call API to load application configuration values, are there any confusion about which config to be loaded since both exe and DLL have app.config files?
thanks in advance,
George
|
|
|
|
|
There is only one config file associated with current AppDomain.
|
|
|
|
|
Thanks Giorgi,
But from IDE, we can add one app.config for DLL and another app.config for application, suppose the application loads the DLL into one application domain, then there should be two app.config?
regards,
George
|
|
|
|
|
If the application loads dll in its appdomain then the dll will read from its own config file. On the other hand, if the dll is in the same domain as executable, then the dll will read applications config file.
|
|
|
|
|
Thanks Giorgi,
You claimed one application domain could only have one application configuration file, do you have any related document mentions this?
regards,
George
|
|
|
|
|
|
Thanks Giorgi!
It take me time to read them all and have some try. I think the final conclusion should be DLL can not have its own config file and must use the exe's application configuration file, correct?
regards,
George
|
|
|
|