|
I am really sorry if my answer was not reasonable. I have seen your code and it is really excellent! But lot of times and i mean (lot of times) i have installed a product of mine which worked perfectly in all of the previous installations on a computer and simply on that computer didn't play, after lot of time on debuging my code for the problem i have seen, i found that the user has deleted some keys from the registry himself and this was the problem!!!!!! My answer was not a programming one and i am sorry, but it is true that sometimes you need to go that way!!!
From Greece:
Dimitris Iliopoulos
dimilio@yahoo.com
|
|
|
|
|
Then why don't you reinstall your product? Your installation should be responsible for setting default registry keys as well as removing them during uninstall. Formatting and reinstalling the OS is a last-ditch effort. It's your application that was screwed up more than likely - thorugh no fault of your own, just the users - so it's your application that should be repaired first. There are many other things one could do before resorting to reinstalling the OS.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath,
I appreciate your insight and expertise but your talking to someone who only has a very basic understanding of this type of development environment. Please forgive my ignorance. To be honest I'm not completely sure I understand how to use it. Whenever the screen size is changed do I run all my Text boxes and labels through the scaling functions to reposition them? I did incorporated this class into my code. I instantiate a Display object when I bring up my application and the Update service is called when I change the screen dimensions. I did have to make a few changes to get it to work (as I'm sure you expected). I had to add the following at the appropriate places...are they ok?
static int logsPerPixelX,logsPerPixelY;
IntPtr eightyEight = new IntPtr(88);
IntPtr ninety = new IntPtr(90);
value = GetDeviceCaps(hdc, eightyEight); // LOGPIXELSX
logsPerPixelX = 1440 / value.ToInt32();
value = GetDeviceCaps(hdc, ninety); // LOGPIXELSY
logsPerPixelY = 1440 / value.ToInt32();
ReleaseDC(IntPtr.Zero, hdc);
Because I'm not real sure how to use it, I don't understand why the logsPerPixelX and logsPerPixelY are setup but never used and why twipsPerPixelX and twipsPerPixelY are never setup?
I also don't understand why it is only one tab page out of 7 that has this problem? I have numerous other Forms that display properly. If you could just grit your teeth and drop kick me into the right areas I would be most appreciative.
If it jams, force it!!
Parrish Pope
|
|
|
|
|
You don't instantiate the Display class as I presented it - it defines static methods and properties: there is no need to instantiate it (which is why I made it sealed and the default constructor private ).
Yes, when your display changes you would need to run the sizes and locations of the controls through these methods. If you don't understand them, read the other links I gave you.
There is more information about programming for different resolutions at http://msdn.microsoft.com[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
I designed one process, multi appdomain system.
One process is Main.exe.
Multi AppDomain execute assembly(A.exe, B.exe, C.exe ...)
ex >
Thread newThread = new Thread(new ThreadStart(OpenSystem));
newThread.ApartmentState = ApartmentState.STA;
newThread.Name = currentSystemID;
newThread.Start();
private void OpenSystem()
{
try
{
AppDomain domain = AppDomain.CreateDomain(currentSystemID);
//According To Current SystemsID A.exe, B.exe, C.exe Run
domain.ExecuteAssembly(asmName, null, args);
AppDomain.Unload(domain);
}
catch(Exception e)
{
Debug.WriteLine("OpenSystemError=" + e.Message);
}
}
However,
When error occurred in A.exe, .Net Framework showed MessageBox.
when i pressed close button in MessageBox, Main.exe process killed.
I think .Net Framework kills Process.
I want to stop only A.exe AppDomain, when error occurs in A.exe.
Is there good way to do that?
|
|
|
|
|
Assembly A is the process. When your entry point method terminates, so does the program. This is why facilities like Application.Run and message pumps exist - to keep the application running. If creating your second AppDomain and executing an assembly fails, then your method continues and terminates, thus your application terminates. That's the way it works. And since you executed assembly B in a new thread, when the exception is thrown the thread is aborted if it's not handled. Since you are handling, then threaded method continues and terminates.
If you want to execute assembly A and B independently of each other, then you should create a new AppDomain for each assembly and launch them from a separate process with a little better exception handling.
You also need to consider a loop that keeps methods running until you want them stopped. If you're working with Windows Forms, Application.Run creates a message pump that translates and dispatches Windows message which are still at the heart of Windows Forms. If you're not using Windows Forms, you'll have to have your own loop and be sure to perform good exception handling since you don't want your app stuck in an infinite loop, forcing the client to kill it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
The .NET BCL doesn't know anything about a PDF file, so no, you can't use it to print one. You'd have to use a 3rd party control, ranging from one of the projects on SourceForge.net (free), to very expensive versions costing a couple thousand $.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The question is simple:
How is it possible to control the sound volume.
I suppose its something with winmm.dll or whatever...
thanks
----------------------
I think war is a dangerous place.
George W. Bush - Washington DC, May 7th 2003
|
|
|
|
|
I can successfully load an assembly dynamically at runtime. But what if I want to unload it and load another one without having to shutdown my application. Does anyone know how to do that? I use Activator.CreateInstance to load assemblies. But I have not found anything that I can use to unload one.
|
|
|
|
|
Assemblies are loaded into an AppDomain when you Type they define is required. You cannot unload assemblies from an AppDomain without shutting down the AppDomain (closing/killing the process is one way of doing this).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Similar to what Heath said, but you can create your own AppDomain's and load the assemblies into there. Then, when you want to unload the assembly, destroy the AppDomain. I think there's some article on MSDN about doing that.
Marc
Microsoft MVP, Visual C#
MyXaml
MyXaml Blog
|
|
|
|
|
Well I did try following that example and it worked up to a point. I get Serialization exceptions because .NET is trying to serialize System.Threading.Thread and other System classes. I can only modify my own classes to meed serialization requirements. What do I do about the System classes I need objects of sever System types in the assembly that I am trying to load into a separate AppDomain.
For more than 2 years I did not have any such issue because I was loading assemblies into the default AppDomain. But I now have a need to dynamically load and unload them. Do you know of a solutions that will not try to serialize System classes. I can only modify my classes with MarshalByRefObject or [Serializable].
Thanks
Robert
|
|
|
|
|
Why can't I have two functions with the same name and the same input paramters, but different return types. The two functions are obviously different. I did this in C++ with no problems. Is there any way to do it in c#?
Gary Kirkham
A working Program is one that has only unobserved bugs
He is no fool who gives what he cannot keep to gain what he cannot lose. - Jim Elliot
Who you are in Christ
|
|
|
|
|
It's not allowed by the CLI. See ECMA 335, section 10.2 (Overloading), with one exception: overloaded operator methods can differ only by return type.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks...I wonder why the C# development team thought that capability wasn't useful? O' Well, maybe I am the only one who used it in C++.
Gary Kirkham
A working Program is one that has only unobserved bugs
He is no fool who gives what he cannot keep to gain what he cannot lose. - Jim Elliot
Who you are in Christ
|
|
|
|
|
It's not C#: it's the CLI - the Common Language Infrastructure (sometimes Interface), which describes assembly and type metadata (Common Type System, or CTS), as well as the Common Intermediate Language (CIL) and a few other things. It's what makes the language independence possible.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You can't because C# doesn't support it. Overloading selections are done only on functions names and argument lists only. Return types are not considered by the compiler.
7.4.2 Overload Resolution[^]
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Since no one else said it, I guess I will:
You did NOT do this in C++.
class A
{
int doSomething() {}
void doSomething() {} // causes an error
};
Here's the first error it will cause:
error C2556: 'void A::doSomething(void)' : overloaded function differs only by return type from 'int A::doSomething(void)'
It will also cause other errors indirectly, when/if the compiler fails to recover from the error and continue analysis.
The C++ standards forbid this, just as C# does.
|
|
|
|
|
I stand corrected, I must be getting senile in my old age.
Gary Kirkham
A working Program is one that has only unobserved bugs
He is no fool who gives what he cannot keep to gain what he cannot lose. - Jim Elliot
Who you are in Christ
|
|
|
|
|
Not a big deal. I just couldn't have you bad-mouthing C#'s overloading.
|
|
|
|
|
Hello world!
I have a class and I wish to get a reference to one of its member variables at runtime.
class foo
{
public string bar1;
public string bar2;
..
}
I have called foo.GetFields() and I am the proud owner of an array of FieldInfo structures giving me information about all of the type's member variables. I can see my strings (checkboxes/bears) in the list.
My question is: How can I take this FieldInfo data, and get a reference to the desired variable and hence manipulate it??
Many thanks in advance,
Charlie (C:=
|
|
|
|
|
You've already got it: the FieldInfo . If you want to get or set a field's value, use FieldInfo.GetValue and FieldInfo.SetValue . If the fields are instance fields, you must pass the object whos fields you want to retreive.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Where does foo and bar come from, as it seems to be standard in using in examples?
Does it come from FUBAR?
Thanks
|
|
|
|