|
Is it possible to share static variables across AppDomains?
I want to write an application like NUnit (for a different purpose). I wanted to replicate NUnit's ability to recognize test fixtures and tests by just placing attributes over my classes and methods. But my application has some variables that I'd like the dynamically loaded assembly (loaded in a different AppDomain) to be able to use. I can pass them as MBR objects, but then for that I've to force implementors of the dynamically loaded assembly to implement a particular interface.
It would be nice if I could just "inject" my static variables into the newly created AppDomain so that the loaded assembly can use it directly. Is there any way I can do it?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi
I have a set a breakpoint on a method in which a Thread is being started,after stepping through,its giving error
An unhandled exception of type 'System.Threading.ThreadStopException' occurred in mscorlib.dll
Additional information: Thread was being stopped.
and this is giving on line where its accessing TextBox,most prolly unable to access MainThread?
how could i resolve this?
Thanks
MyBlogs
http://weblogs.com.pk/kadnan
|
|
|
|
|
|
Please show me you code. I can help if I can see you code that is giving you these exceptions.
|
|
|
|
|
Once a user edits the label in my listview control, I need to make sure that the label is in all upper case. So I'm using the AfterLabelEdit event to view what the new label is and to change it to upper case if I need to. Here is the code I've written:
private void AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
{
string labelText;
int ItemIndex;
labelText = e.Label;
ItemIndex = e.Item;
listView1.Items[ItemIndex].Text = labelText.ToUpper();
}
Unfortunately, this does not work. The label still will have lower case letters. Does anybody know what I'm missing here?
Frustrated Detroit Tiger Fan
|
|
|
|
|
Using .NET Reflector, I found this code (in ListView.WmReflectNotify ):
this.inLabelEdit = false;
NativeMethods.NMLVDISPINFO nmlvdispinfo1 = (NativeMethods.NMLVDISPINFO) m.GetLParam(typeof(NativeMethods.NMLVDISPINFO));
LabelEditEventArgs args2 = new LabelEditEventArgs(nmlvdispinfo1.item.iItem, nmlvdispinfo1.item.pszText);
this.OnAfterLabelEdit(args2);
m.Result = args2.CancelEdit ? IntPtr.Zero : ((IntPtr) 1);
if (!args2.CancelEdit && (nmlvdispinfo1.item.pszText != null))
{
this.Items[nmlvdispinfo1.item.iItem].Text = nmlvdispinfo1.item.pszText;
}
return;
As you can see, the new text of the ListViewItem is set after the AfterLabelEdit event, so any changes you make in the event handler will be overwritten.
I know I'm not solving your problem, but at least I'm telling you why it happens.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
That definitely explains why my text is still in lower case.....but, thanks to Luis, I figured out how to do it. I was missing one line of code. After I set the label text in the listview control so that all the text is in upper case, I then cancel the edit so that the text that I want is not overwritten.
listView1.Items[ItemIndex].Text = LabelText.ToUpper();
e.CancelEdit = true;
Thanks for the help!!!
A not so frustrated Detroit Tiger Fan
|
|
|
|
|
As has been already mentioned, the reason why that happens is because the label text is set after the event.
To counter that you just need to add one more line at the end of your code:
e.CancelEdit = true;
So your new code will look like:
private void listView1_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
{
string labelText;
int ItemIndex;
labelText = e.Label;
ItemIndex = e.Item;
listView1.Items[ItemIndex].Text = labelText.ToUpper();
e.CancelEdit = true;
}
--Aditya
|
|
|
|
|
In a C# application, I want to kill another application. If I use the Process.Kill method, I get unpredictable behaviour on my PC that even forces me to re-logon.
Probably, the killed application leaves open resources.
If I use the Process.CloseMainWindow, the application displays a dialog asking for confirmation to exit. How do I respond to that from my C# application?
Are there other solutions?
Thanks in advance.
Meo
|
|
|
|
|
In the past I've always used the Process.Kill method and it never gave me any problems. Try posting some of your code so we can find out what you might be doing wrong. Here's how I've done it in the past:
Suppose you want to write a method that takes a string as a parameter and that sting is the name of the process you'd want to kill:
<br />
private void KillProcess(string processName)<br />
{<br />
Process[] processes = Process.GetProcessesByName(processName);<br />
<br />
foreach (Process p in processes)<br />
{<br />
p.kill()<br />
}<br />
}<br />
|
|
|
|
|
I have stripped my code as much as possible to isolate the problem.
If I try to kill another application, say notebook, it works fine.
So I think it must be rtrobo.exe leaving resources that causes troubles.
Note: this code is only used in debug mode.
static void Main(string[] args)
{
Process robotProcess = new Process();
robotProcess.StartInfo.FileName = @"C:\Program Files\Rational\Rational Test\rtrobo.exe";
robotProcess.StartInfo.Arguments = @"Test_001 /user admin /project e:\Sobek\TestcasesNew\Testcases.rsp /build 'Build 1' /NoLoginServices /logfolder Default /play /log Mylog /nolog";
robotProcess.Start();
// In debug mode, wait until rtrobo finishes startup.
Process [] procs = Process.GetProcessesByName( "rtrobo" );
for (int i=0; i
|
|
|
|
|
Hi,
I'm newbie in c# and I create a windows Application.
I want to call a c function in my program.
(I want to call libTiff function)
How can I do this?
Regards.
Have a nice day
bibax en fait un max!
|
|
|
|
|
|
Thx for reply, it seems to be what I search.
Now I have to understand it and use it.
thx
Have a nice day.
bibax en fait un max!
|
|
|
|
|
HI,
I need to get the value of Address from XML file and want to display this Attribute value on Label
Pls tell me the XPATH for Retriveing value of Address
I also need the valie of lastjob
How should i do validation the values from XML file because there can be multiple enrty from user into XMl file how can i select a particular node from XML file
Fomat of this file is as given below
-----------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
- <root>
- <farm-config>
- <farm name="dev1">
- <connection address="192.168.1.3" user="ohm" selectedConnection="1" password="sanjeev">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
- <database state="0" name="bd_house1" sourceType="Monkey">
- <tables state="0" name="CAT">
<columns state="0" name="DATE" />
<columns state="0" name="TIME" />
<columns state="0" name="DAY" />
<columns state="0" name="MONTH" />
<columns state="0" name="YEAR" />
<columns state="0" name="PRODWEEK" />
<columns state="0" name="PRODDAY" />
<columns state="0" name="WEEKDAY" />
<columns state="0" name="SILO" />
<columns state="0" name="CAR" />
<columns state="0" name="PRODUCT" />
<columns state="0" name="VOLUME" />
</tables>
- <tables state="0" name="DOG">
<columns state="0" name="DATE" />
<columns state="0" name="TIME" />
<columns state="0" name="DAY" />
<columns state="0" name="MONTH" />
<columns state="0" name="YEAR" />
<columns state="0" name="PRODWEEK" />
<columns state="0" name="PRODDAY" />
<columns state="0" name="WEEKDAY" />
<columns state="0" name="SILO" />
<columns state="0" name="CAR" />
<columns state="0" name="PRODUCT" />
<columns state="0" name="VOLUME" />
</tables>
</database>
</farm>
</farm-config>
</root>
Regards
sanjeev
|
|
|
|
|
Delete both of these posts and then repost your question, but this time, check the little box under the message window that says "Do not treat <'s as HTML tags".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Guys,
I’m trying to determine when files are being copied on my system.
I started off with the File System Watcher component in .NET, but a copy can’t be inferred from any combination of create or change events. So that won’t work.
I wanted to try Copy Hook Handlers next, but it turns out that Copy Hook Handlers only work with folders or printer objects.
So my question is: Are there any API calls or anything else for that matter, which can be used to monitor copy events?
Thank you
|
|
|
|
|
A Copy operation from any source to your machine is no different than a Create file and Write to it. So, no, there's no way to tell the difference between a file Copy and an application just saving a document to the hard drive.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Any suggestion or link to any forum documentation but in .NET ?
|
|
|
|
|
|
I need to change image (logo)on the my reports (C#) .What is the best load to the image into the report.
Thanks for any help
|
|
|
|
|
Hi all!
I have a small Interop question:
I have a COM object that takes a structure as in-parameter. One of the fields in the structure is an IID*. When doing this in C++ the code:
GUID rrid = __uuidof( _InterfaceName );
parStruct.riid = &rrid;
works fine.
How would I do this in C#? I have tried several things, but can´t get it to work. The type of the struct-field in C# is intPtr. And the only way I can find such a type, that I can think of, is:
Type t = typeof( _InterfaceName );
System.RuntimeTypeHandle h = t.TypeHandle;
parStruct.riid = h.Value;
But I guess that I am way off here.
Any one that can give me a hand here?
Regards
Mikke
Added info:
Hi again!
I tried to create a C++ .Net project instead, just to try and find a work-around. When I took the COM objects needed and tried to import them into my brand new cpp project i got this error message:
TlbImp warning: The type library importer could not convert the signature for the member 'RobEventParams.riid'.
And a couple of other ones like this one for other similar parameter-structs with riid fields. What does that mean for me? Is it impossible to marshal something from .Net into this COM? The purpose is to set up a sink and recieve events from the COM object, to do this I should send a ref to an object that should recieve the events and the signature of an interface implemented in the receiver. It is the interface "signature" that is the riid, and also the problem here. When I execute my C# code above I get an exception telling me that "No such interface supported". Do I have to submit a non-.net method as a sink here?
Best regards again / Mikke
|
|
|
|
|
Hi! I have a listview, let's say with 4 columns, with fullrow selection.
When i select one row, i want to get the element from the second column.
Can you tell me how to do that?
I know how to get the element from the first column, but to get the other element's of the row selected is kind of a problem for me.
Thanks!
|
|
|
|
|
|
How to use C++ style cast ( reinterpret_cast ) in C# ???
In C++ context :
NMHDR* pNMHDR;
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
Please give me the answer.
Thanks.
trannampro@yahoo.com
|
|
|
|