I am looking for an event to hook into that occurss after aform has been created, but, before the form is displayed. In MFC I would use OnInitDlg().
My Main Window is essentially aSplash Screen. I want to display a LogIn Screen op top of that.
If I do that in the constructor, the login box isnaturally displayed first, followed by the splash screen. The Splash Screen does not create events to hook into.
Furthermore, How do I call the Base Class version in a handler I override. Below is how I woulddo thisin CPP. but this code will not compile in C#.
publicpartialclass MainWnd : Form
protectedoverridevoid OnXXX(EventArgs e)
// Let the Base Class handle the event
// Now handle the event for our selves
LogOn logon=new LogOn();
The MSDN Ref you point me to is quite sparse, and does not realy cover the topic. (it covers events sent by a button click. It purports to document the Load event, but is silent about this in it's explanations)(not your fault, I blame Steve Balmer). I'd say a lot is missing. primarily the 'HowTo' hook into a 'Load'event. To prove the point, I did as the sample specified, and pasted the code in to a form, according to instructions. Unsurprisingly, nothing happened when the button was clicked. In MFC terms, the message map entry is missing, in SDK terms, the message is not intercepted in the WndProc, I suppose, in .NET terms, the handler delegate has in the example, not registered with the event.
Unfortunately MSDN is a travesty of reorganisation. It used to be very easy to locate stuff without leaving the site. Nowadays, you have to rely on an external search site to find stuff on the microsoft site.
Luckily I don't have such a problem, as I still have early versions of MSDN on DVD, so I'll see what I can dig up on this issue.
In many ways, although the syntax looks similar there are fundamental differences between C# and C++, so you will find the behaviour quite strange at times. Look at the various events available on the System.Windows.Forms.Form class[^]. I don't know the details of your splash screen but if it's based on a Form then it should have all the same events.
Thanks for your reply, and, good to hear from you again. The differences between C++ and C# I'm acutely aware of. It brings me new surprises every day. Strange behaviour I have seen indeed. The differences between MFC and .NET are even bigger. Whereas in mho MFC acted as a convenient thin (sometimes a very thick) Object Oriented wrapper around Windows SDK, NET is an entirely new departure. Our reason for changing to .NET is to become OS independent. Our software runs without any hitches or security issues on very many XP terminals, (none of which is connected to the internet). There are too many issues for it to run properly under Vista and above. The main flee in the ointment is the paranoid security system in Vista+, which is entirely supurfluous to our requirements.
The original incarnation was written for Win3.1, (1 elderly customer is still using this on two terminals) in the then revolutionary new MFC. MFC at the time binned about a 100 books by Petzhold. Porting to Win98 was painless, actually it simplified matters greatly. No more worries about far, near, and burgomasters. (one could no longer look at another process though! (ouch!) That was a major issue at the time).
The performance requirement for the product is identical under MFC or .NET . Paint a screen, Let the user fill in data, wait for a button click, and respond to the click by doing things like accessing a database, or, painting another screen. As the whole suite of programs is Dialog based, there are very few programming 'High-Stands', the most involved part being the provision of 'Progress Dialogs' for lengthy Database enquiries. In MFC and SDK we monitor messages, in .NET we use events. Different Mechanics, but similar overal end results.
As for the Database, Version 1.XX (Win 3.1+) and Version 2.XX( Win95 to Win XP) used a proprietory DB system, with much of the DB Code dealing with atomicity of transactions, ending up in the middle of the Dlg procedures, i.e. the Presentation code. We intent to use SQL for V3.00 (Win7 and after)
Thanks for the Link. It gave a method listing which included an 'OnLoad' method. The help system on my version of VS2012 sent me to a similar help page which did not contain any event handlers. This latter fact added to my confusion. We had a 'Load' event, but not an 'OnLoad' event handler. The so called 'Intellisense' (I rather have a decent paper manual)was also quiet on 'OnLoad'
Thanks for your kind words, Bram. I have found that the online MSDN documentation is usually the best source of information. It can be a bit daunting at first, and occasionally leads you down blind alleys, but overall it is still high quality.
either use the constructor to do a method call where you do the stuff you need to do, or use the Form.Load Event[^] which occurs before the form is shown the first time (for example, location of the form on the screen can be set there).
That's kind of the definition of a Windows Service application. They run when Windows starts, not when a user logs in.
If you were thinking that you were going to write a service application that puts up a user interface the user can see, forget it. That's not allowed for security reasons. If you wanted to do something like that, you'd be writing TWO applications. One would be the service that is constantly running and the other would be a normal application that runs when the user logs in and communicates with the service over an IPC method of your choice.