|
No, on the client (after connecting and calling DoSomething ). Maybe I'm not understanding your code snippets, though.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ok, yes, I am disconnecting all client-published objects (which I didn't mention in the code snippet). I cannot disconnect server proxy objects on the client side of course.
This is one of the strangest problems I've ever seen, given it occurs only during certain instances of the client application. Hard to debug too with multiple threads running across application and machine boundaries. :-p
Judah Himango
|
|
|
|
|
Without more hints (or code) I have no idea how the objects are configured or even guess how they behave during their life time. Just dropping an object into a thread and assuming it will be "thread safe" is dangerous. Just dropping an object into the remoting framework and assuming it will be "multiple client safe" is equally as dangerous.
|
|
|
|
|
You're right. It is bizaare. I think you will agree that the key piece of information is that the reconnect fails only when the main thread is blocked on the first call to Console.ReadLine. What would the Console class be doing that would have any impact on your remoting object anyway? Is DoSomething using the Console class in any way? Can you whip up the smallest program that demonstrates the problem and post the code? Maybe in the process of working on that you'll discover the problem, but if not then you'll have something complete that all of us can take a look at.
|
|
|
|
|
Is there any easy way to convert .rc (C++ resource) files to .resx (C# resource) files? I have a C++ project which I'm converting to C# and don't want to have to write my own utility to convert the old resource files over.
BRCKCC
|
|
|
|
|
Hi,
Where can I find a sample code for passing array or VARIANT from ATL COM control to C# .NET?
Thanks,
Alex
|
|
|
|
|
Search CodeProject.
The important thing is developing your .NET code correctly. Use the MarshalAsAttribute with the appropriate UnmanagedType enumeration member. For an object[] array, you can use a myriad of choices but commonly - if you're passing an array of variants - you'll either use UnmanagedType.LPArray or UnmanagedType.SafeArray . A SAFEARRAY in unmanaged code stores information for each elements (what VARTYPE it is).
Read about the MarshalAsAttribute in the .NET Framework SDK to start. You should also read Interoperating with Unmanaged Code[^] in the .NET Framework SDK, specifically Marshalling Data with COM Interop[^]. This presents a lot of information you must understand, as well as some examples.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi, I'm trying to pass a custom object to a web service as a web method parameter. For this, I had to modify the References.cs file and delete the simplified version of the class, so I can pass directly my objects.
The problem is that when I check the object in the web service, the collection that includes is empty. Do you know what can be happening?
I don`t know how to solve this.
|
|
|
|
|
Diego F. wrote:
For this, I had to modify the References.cs file and delete the simplified version of the class, so I can pass directly my objects.
You will have to add some XmlSerializer attributes for that to work I think. See how the other members are handled, and be warned, never edit generated code.
top secret xacc-ide 0.0.1
|
|
|
|
|
I tried using object arrays, but the only way I could make it work was using a Dataset. I added a method that returns a DataSet with the attributes mapped, and it works without modifying the References.cs file.
I think I'll leave now, because it is taking so long.
|
|
|
|
|
What do I have to do, in order to hand over a parameter to a function, which was compiled before by (ICodeCompiler CreateCompiler())?
I know, that I need the „InvokeMember“, which only permits the type Object, but I need the type HttpContext.
What do I do wrong, or is there something I forgot, or is there another way?
Yours,
Patrick
|
|
|
|
|
Every type in .NET derives from System.Object , so when a parameter, properties, etc. takes an Object , you can pass anything (including value types like structs, the primatives, etc., but that performs boxing and unboxing which is a performance penalty, mind you). This is VERY important to understand.
This means that every type inherits the members of Object and may override some (like ToString , GetHashCode , and Equals ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I would like to create a logon page, but I didn't want the names store in a COTs datebase. Can I create a file store the names in it, then compare want is in the file to to want the user types in the textboxes?
|
|
|
|
|
bthumber wrote:
Can I create a file store the names in it, then compare want is in the file to to want the user types in the textboxes?
Yes, if you have a specific question in terms of C# feel free to post it.
- Nick Parker My Blog | My Articles
|
|
|
|
|
The next question is how do you compare those two strings?
|
|
|
|
|
bthumber wrote:
The next question is how do you compare those two strings?
Read about the String.Compare[^] method.
string s = "Nick";
string t = "Parker";
if(string.Compare(s, t) == 0)
Console.WriteLine("Equal");
else
Console.WriteLine("Not equal");
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hello, I'm creating a slider-like control based in UserControl. Since the UserControl can't receive keyboard events (At least not that I manage to catch), I use a button as the slider handle since that can receive focus (I want to be able to run the slider up/down with the keys that's what I need the key focus for...)
First I tried listening to the KeyDown event from the button, but that doesn't get fired, only the KeyUp.. Has it something to do with that the button filters away these events and fires Click instead?
So I grab the button and check what messages it receives with spy++, and it says both WM_KEYDOWN and WM_KEYUP (repeated WM_KEYDOWN when key is held down as would be expected). So I override the button and it's wndproc to listen for these events, and also override the onpaint to get rid of the 'click' effect that I don't want.
BUT: the wndproc doesn't reveice any WM_KEYDOWN (0x0100) messages. So where are they going and how can I get them? Is there some kind of preprocessmessage-like function that receives and filters these events?
Or is there another control I can override instead of a button, that can get keyboard focus. Also, the button still has it's click behaviour that I don't want...
Can anyone help me with the right way to go??
|
|
|
|
|
A UserControl is for composite controls (i.e., controls made-up of other controls). It's not really a good base class in this case, and is designed to receive notifications from its children.
There are lots of articles here on CodeProject about custom slider controls. I recommend taking a look at some to get some better ideas (without going into a long, unnecessary discussion here) to help you along.
http://www.codeproject.com/info/search.asp?cats=3&cats=5&searchkw=slider[^]
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I've got a custom control (button using rounded .gif image with transparent corners) on top of a panel. The panel has a .wmf file as its background image. When I place my control on my panel the background COLOR of the panel shows through my transparent corners instead of the background IMAGE of the panel. If I make the panel's background color transparent the background color of the form shows through the corners.
Is there any way to force the panel's background image to show up in the transparent sections of my control?
thanks!
Deanna
|
|
|
|
|
A little more info... In my control's OnPaint I'm trying to clear the background using :
g.Clear(Parent.BackColor); where g is my Graphics object
I'm wondering if that line is incorrect.
|
|
|
|
|
The best way is to use clipping regions. Transparency is only supported in Win2K and newer (flavors of Windows NT only; i.e., Windows ME does not support transparency), so if you want to support all .NET-supported Windows platforms, use clipping regions.
You can do this a number of ways, such as overriding OnPaint and setting PaintEventArgs.Graphics.Clip to a Region that contains only the portions to draw. You can construct an adequate Region using the GraphicsPath class in the .NET BCL.
Clipping regions is how most applications handle non-rectangular windows (controls are windows, too). It works on any Windows platform.
You can find a nice little library to assist you - even graphically in VS.NET - written by a Microsoftie at http://windowsforms.net/articles/usingregionmastercontrols.aspx[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
i have developed a web service and it needs load a certificate from disc (i am using CAPICOM). In that moment the program throws a FileNotFoundException. I know that this operation uses the temp files of winnt so i have tried succesfully to create a file there from the ASP application. What´s happening then? How can i solve it?
I have read that the problem can come from XmlSerializer...but i find it very strange.
Thanks a lot.
PD: hey Heath...i am not pelos, it is just coincidence!
|
|
|
|
|
What I said to pelos still applies, though: quit using the CAPICOM interop assembly. Why marshal and use .NET-unfriendly APIs (more so than what's in the BCL, at least) when .NET can only load X.509 cert files and PKCS12 structures from disk?
The problem here is that ASP.NET Web Application (in which XML Web Services run) have additional restrictions (especially in .NET 1.1 and newer) and don't always use the same environment as assemblies loaded with the executable loader in Windows. Additionally, ASP.NET - by default - runs under the restricted user ASPNET, though you can configure this to run as SYSTEM (extremely bad idea) or as another user of your liking (has to then use a coded password in the machine.config or root Web.config file, though).
Files don't also resolve the same as they would in web applications. Be sure to use MapPath (several classes expose this, like the HttpServerUtility and the Page classes) to map the file to a physical path. The virtual path - depending on a number of factors - won't map to the right file path.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ReSharper is an add-in for Microsoft Visual Studio .NET 2003™ that brings intelligent C# coding assistance, real-time error highlighting and quick fixing, and advanced refactoring features to this popular development platform.
ReSharper provides C# developers with many of the same powerful productivity-boosting capabilities that thousands of Java™ developers worldwide have come to rely on every day with IntelliJ IDEA.
To learn more check out: http://www.jetbrains.com/resharper
|
|
|
|
|
before you try that tool , please see
http://www.codeproject.com/lounge.asp?msg=889398#xx889398xx[^]
(for your own sake)
some other small notes about the addin
it increases loading time for your projects with , well lets say 5000% or so
and the template system is nothing compared to the "quickcode" addin (the only addin i personally use nowdays)
//Roger
|
|
|
|