|
There doesn't seem to be anything unusual in your code. There are some odd bits in that splasher article though.
1) In the close method the code just totally swallows up all exceptions. This is very bad. something maybe going wrong and you won't know about it. Put some code in here to do something. (At the very very least, write to a log file so you know something went wrong. Ideally, Display an error message and shutdown the application)
2) The article uses Application.Run to start a new message pump from inside a separate thread. Seems a bit weird, not sure what impact this will have. .ShowDialog may have been a better way of doing it. This creates a nested message pump. (Maybe there is no difference, I'm not sure about this)
3) It uses reflection to manage the splash screen. Again, bit weird, he knows it's a form, why not just use a form object. Don't think this has any real problems though, it's just a bit of an odd way of doing things.
Let me try the Splasher stuff out and I'll get back to you in a bit.
[Edit: Yes, I get exactly the same issue with that splasher article code...Hang on...]
[Edit 2: Think you just need to abandon this article's method. The problem is something to do with having two message pumps running. When the first closes, the focus returns to the explorer window, even if you ensure the main form is fully loaded and displayed before letting the first message pump stop. I played around with it a bit, but it always causes exactly the same issue.
The reason that all those active/bring to front methods don't work is because they all rely on an api call that was changed with windows XP. It was decided that applications should not be allowed to steal focus because it annoys the user if they are working on something else.
I would suggest reading this[^] article. It describes a technique of using a ApplicationContext object to load two forms. Ignore all the stuff in there about reading/writing the window state to disk. Just use the appcontext to show your splash screen, do your initialising, show your main form and close your splash screen.]
Simon
modified on Thursday, June 19, 2008 4:56 AM
|
|
|
|
|
Hi Simon,
Thank you for the effort that you put into this. At least now I know why, I'll really have to fix this, but in the meantime I stopped showing the splash screen altogether
Rafferty
|
|
|
|
|
No prob.
It wasn't entirely selfless. One of our apps uses a similar technique for showing a message pumping splash screen, and has a similar issue. We'd never noticed it before because the app auto runs at start up, fullscreen and on a dedicated PC that is only used via a touch screen (no keyboard/mouse), but at some point we are going to convert it to a desktop user version so things like that will start to cause problems then.
Simon
|
|
|
|
|
Hi!
this[^] MSDN page told me, I couldn't unload assemblies except I load them into an extra AppDomain and then unload the whole AppDomain. But how to do this? Can someone might give me a little example?
EDIT: I want to load the assembly from a file.
Thanks in advance, Eric
|
|
|
|
|
|
In "How to load assemblies into..." I can only read how to load assemblies into the current AppDomain, which isn't very helpful..
|
|
|
|
|
It's not very obvious I'll admit:
"Methods such as CreateInstance and CreateInstanceAndUnwrap of the AppDomain class can load assemblies into an application domain."
Simon
|
|
|
|
|
If you look in the method details for CreateInstanceAndUnwrap it includes an example for running code in a different appdomain.
(You should note that the assembly that contains the object you create with CreateInstanceAndUnwrap will be loaded into both appdomains, but you can use the object to load further assembiles only into the domain the code is running in. See the CreateInstanceAndUnwrap[^] page)
Simon
|
|
|
|
|
Great! Works now... Thx
|
|
|
|
|
public class DownloadQueue<TCallBack>
{
} In the above code, I need to allow only delegate types for TCallBack . I am not able find System.Delegate in the "where" condition. I tried this
public class DownloadQueue<TCallBack> where TCallBack : System.Delegate
{
} But it's not allowing to write so. Any other methods for this ?
|
|
|
|
|
Certain types are restricted from being used as generic constraints. Unfortunately, this is one of them (enum is another).
|
|
|
|
|
Thanks Pete. Any alternative method to ensure it ?
|
|
|
|
|
How does typing a generic parameter to System.Delegate help? It might be that you have a design issue that needs a different solution or perhaps requires a better understanding of the problem to begin with.
led mike
|
|
|
|
|
Yes you are correct. I had a design issue and I solved it. Your help is much appreciated.
|
|
|
|
|
Hello everyone,
I debugged the sample carefully. But one question I can not find from MSDN, who calls method IFormatProvider.GetFormat of class AnyRadix? When we call String.Format, this function is called?
http://msdn.microsoft.com/en-us/library/system.iformatprovider.getformat(VS.80).aspx
thanks in advance,
George
|
|
|
|
|
This line passes the format provider to the String.Format method
Console.WriteLine( String.Format( provider, messageStr, argToConvert ) );
String.Format calls the GetFormat method on the provider to get the formatter. You can look at the Code in for String.Format in reflector to see what's going on. (Haven't tried this myself)
You can see this in the debugger by sticking a breakpoint in the GetFormat method and waiting till it is hit then looking at the call stack. (Debug->Windows->CallStack (Ctrl+D,C))
Simon
|
|
|
|
|
Thanks Simon!
My study result is, when calling String.Format( provider, messageStr, argToConvert ),
1.
provider.GetFormat is called and returned an intance of AnyRadix;
2.
Then Format method is called on the returned instance of AnyRadix, and messageStr/argToConvert are passed as formatString/argToBeFormatted parameter, and a string is returned from Format method -- the returned string is also treated as the result of String.Format call -- String.Format( provider, messageStr, argToConvert ).
My analysis correct?
regards,
George
|
|
|
|
|
Sounds about right. Like I say, I haven't looked in reflector myself.
Simon
|
|
|
|
|
Thanks for your help, Simon!
regards,
George
|
|
|
|
|
I have to deploy my application which uses MS SQL Express as a database. I have to deploy my program to end-user who knows nothing about database configuration. How can I deploy my project and MSSQL express with one MSI installation package. I've found an answer in expert-exchange, but they won't let me in, as I have to pay. Thanks you guys
|
|
|
|
|
1st, try the databases forum. This one is for c# questions.
2nd. If you scroll to the very very very bottom of the experts exchange page, they have all the answers uncovered for free. (Yes, I know it's weird, it's some kind of advertising con to get people to pay them for free content)
Good luck
Simon
|
|
|
|
|
hi!
i m using c# , i used EXpTreeLib.dll , tree view and one more dll Emmaculate.dll , thumbnelview , the
probelm is that when i making a setup using Setup&deployment wizard i added both dll , project is working
fine but when i open this form then the unhandeled exception occured Error path not found etc in other
system not mine , in my pc when i running the project is working fine , may its not getting control path
what should i do .................plz help me
i think i should register the dll in other system on which i m running the exe but ,
when i register the both dll , ExpTreeLib.dll , emmaculate.dll in other system in which i m running exe
after making setup
error occure dll not register entry point not found.
in my pc project running fine , setup complete fine and also exe running fine but when i deploy in other
system then its making a problem in that form that is using both dll.
Entry point not found ..............
on run :
regsvr32 c:\ExpTreeLib.dll
error occure entry point not found may i registed that dll so its resolve the above problems.
Love is Life & Life is Love!
|
|
|
|
|
nomi wrote: entry point not found
Likely cause might be that method Main is missing.
|
|
|
|
|
dani thanks to reply , yar i wanna know that y its running fine in my system and when i deploy on other system then this form is generate a error , path is not missing unhadeled exception etc in this form i just use two dll that i define earlier so what should i do , should i register the dll or what can i do , and how to know where is the error , means main cause of the error ......
Love is Life & Life is Love!
|
|
|
|
|
Are you providing right function name and passing right arguments while calling the function of the dll?
|
|
|
|