|
An example would be when the client tells the server to perform some task and waits for return. While the server is performing some task, it will throw an exception. The client catches the exception, but doesn't tell me the exception type, message, stack trace, etc. and tells me to enable custom errors on the server if I want more information.
#include "witty_sig.h"
|
|
|
|
|
What I mentioned before is close, but now that I understand your client/server app a little better, I can tell you that you need to configure pretty much the same thing, except instead of using <system.web> use <system.runtime.remoting> and set the mode attribute to "on" (lower-case "o", for some reason - not very consistent).
This .config file would be named the same as your client application + .config at the end. The RemotingConfiguration.CustomErrorsEnabled method is merely a way to determine if custom errors are displayed based on the locality of the remote call.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you Heath I'll give that a whirl.
#include "witty_sig.h"
|
|
|
|
|
Did this actually work? Could you post an example or emial it to me. I am having the same problem and I am not having any success getting it to work. Currently, I am also not using a config file.
C LaMorticella
Client Instant Access
|
|
|
|
|
I have a form that is being maximized. The form is a child form of an MDI parent and there is another child form docked on the left as a menu. Therefore, when the form is maximized it needs to be maximized to (for instance location 256, 0, 200, 200 instead of 0,0,456,200 (where above is x, y, width, height). I'm having a real issue finding an event that fires BEFORE a maximize command to set the bounds and the maximizedbounds property doesn't seem to be doing any good. Any ideas, events, etc.?
Brian
"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." - Douglas Adams
|
|
|
|
|
Override WndProc and handle the WM_SIZING (0x0214) message. This is sent to a window procedure (and keep in mind that almost all Windows Forms controls encapsulate native controls and dialogs) before being resized. The Message.WParam specifies the edge that is being resized and the Message.LParam specifies the RECT (which you must define in managed code - a System.Drawing.Rectangle will not suffice because it stores coordinates differently).
Set the Message.Result to new IntPtr(1) to signal that you've processed it and don't want your Form to be resized.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is it possible to get a reference to the object that is calling a method (maybe through something like Reflection)?
i.e. something like:
<br />
public class A<br />
{<br />
private B b;<br />
<br />
public A()<br />
{<br />
b.SomeMethod()<br />
}<br />
}<br />
<br />
public class B<br />
{<br />
public void SomeMethod()<br />
{<br />
if(callingInstance.Type == typeof(A)<br />
}<br />
}<br />
|
|
|
|
|
You can get the calling assembly using Assembly.GetCallingAssembly , but not the calling type. Since this is an object-oriented development platform, a more appropriate implementation would accept the caller as a parameter to the method, typically declared as an abstract class or an interface. The caller would have to implement that interface or extend that abstract base class and override whatever members are appropriate to call, so that your method or class can call those methods without knowing about a specific implementation of those methods.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello!
I want to check if a program is installed. For instance I want to see if the Visual C++ Toolkit 2003 is installed on my computer. How can I do this in C#?
Thank you for helping me!
|
|
|
|
|
|
Even after enumerating and possibly finsing the correct registry key, you should check for the exsistence of the dll or exe. Windows applications are infamous for not removing all registry entries after an un-install or even people will delete directories without using the un-install. Top and bottom is even if it has a registry key, don't assume that it's there.
Just expanding on what Heath mentioned.
Yes, I program in VB, but only to feed my addiction to a warm place to sleep and food to eat!
Visit my Code Project blog (Mobile Audio project)[^]
|
|
|
|
|
True to a point (although he didn't ask about files - merely products), but Windows Installer - unless you explicitly change the execution sequence from the default or change the Component table attributes or transitive condition to keep the component installed during uninstall - will remove all files it placed there originally. Windows Installer really is a powerful package distribution system, something I've been working with since it's 1.0 beta days and am currently beta testing for 3.0. If you're interested, you should take a look at the Windows Installer SDK on MSDN.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
[original posting]I want to check if a program is installed. For instance I want to see if the Visual C++ Toolkit 2003 is installed on my computer. How can I do this in C#?
The point I'm refering to is that just because something has a registry entry, doesn't mean it exists, only that it was installed at some point in time. I know from experience not to take anything for granted if it has a registry entry.
Heath Stewart wrote:
(although he didn't ask about files - merely products),
He wants to see if a specific product is installed. I merely wanted to point out that an un-install may have failed or been un-installed incorrectly (like deleting directory - infamous in users ) and still have left registry entries that may be included in the enum.
Regards,
Eric C. Tomlinson
P.S. Haven't used Windows Installer yet, all the clients I work for have subjected me to Installshield Maybe someday I'll be able to use it on something that I write (and actually finish)
Yes, I program in VB, but only to feed my addiction to a warm place to sleep and food to eat!
Visit my Code Project blog (Mobile Audio project)[^]
|
|
|
|
|
I know that non-Windows Installer products are notorious for this, but Window Installer packages are actually transacted - you won't see this behavior (except, perhaps, from poorly-written custom actions where the developer doesn't take rollbacks into account or simply can't).
It's Windows Installer I'm defending, not installs. Regarding installs in general, I wholy agree with you...except for one problem: proprietary installs are just that - proprietary. There may be no way to determine where to even look for a product if the install information (or, rather, the uninstall information) doesn't tell you. This is another reason why Windows Installer kicks butt: it's a relational database and tracks everything from files, registry entries, and feature and component installation states.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
First I want to thank you all for your great help.
All I wanted to do is to check if the Visual C++ Toolkit 2003 is installed on a system. I give my programs only to users who uses the Uninstall packages. So there won't be problems with deleting program directories or something.
But there is only interesting thing:
When I open my Control Panel and double click "Software" (in German) or "Add Or Remove Programs" (something like that in English). However, I got a list with all currently installed programs. How is this?
|
|
|
|
|
Add/Remove Programs uses the IAppPublisher shell interface, a COM interface not available in .NET, though you can declare it in managed code. COM servers containing implementations of IAppPublisher are in the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\AppManagement\Publishers registry key. Unfortunately, COM interop with .NET requires that you import the typelibs - if available - from each of these before you can create an instance of them.
So, I recommend reading about the IAppPublisher interface in the MSDN Online Library[^] and creating a mixed-mode Managed C++ assembly. This way, you can work with native COM and expose the functionality you need to managed code. Writing an MC++ assembly this way allows you to reference it in your other managed projects, like a C# project.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
does anyone know where to find (if possible) how to implement a web service running on a Pocket PC and make an application that uses it on the same Pocket PC (in C#)?
thanks
|
|
|
|
|
I think you might run into the issue of not having a web server running on your pocket PC. Probably impossible to get IIS on the pocket PC.
Yes, I program in VB, but only to feed my addiction to a warm place to sleep and food to eat!
Visit my Code Project blog (Mobile Audio project)[^]
|
|
|
|
|
well, you're right! It seems that the only way to deal with it is to handle SOAP requests manually.. (damn'!)
I'll use replication instead!
thanx!
|
|
|
|
|
Hi all,
I'm just getting into writing unit tests - can see the benefits of them for sure.
I get the impression that there is quite a bit of skill and know-how in writing decent tests that are worth their salt. The tests are only as good as the coder writing them, eh?
It would be great to see some examples beyond the example of the bank account that is given with nunit.
I wondered if anyone here knows of any good examples of some unit tests on a more involved real world application? Or if anyone has any thought or advice on this matter it would be great to hear too.
Sorry it's a bit of a vague question - But very much looking forward to your replies.
Best wishes
Steven
|
|
|
|
|
Not really got any examples I could share but some ideas to help you out:
* Test with good input
* Test with bad input
* Test with input at the edge of valid ranges. e.g. If your method can accept an integer in the range 1 to 100 test that 0 and 101 fail properly (throwing the correct exception, or returning the appropriate success indicator), and test that 1 and 100 work.
* Test different combinations of data. e.g. if it doesn't matter which order two parameters are given, then check that by testing with these parameters in a different order.
* Look at the possible code paths inside your method and try and construct tests that will take the code through each of the possible paths.
Probably other people will reply also with other ideas, but these are some that immediately spring to mind.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Thanks Colin, That's great.
Makes sense and I'll give it a go.
Cheers
Steven
|
|
|
|
|
|
I want read data from Serial Device COM1. Is there an example, how to do it?
Ariadne
|
|
|
|
|