Getting an Error #419 When I Attempt to Read The "Form.hWnd" Handle When The Form Is Closed.

Oct 27, 2009
2 Posts

Getting an error #419 when I attempt to read the "Form.hWnd" handle when the form is closed.

Error Message: Run-time error #419 : 'Object is null'
Question: How can I test to see if a Form is closed?

DrATEasy (Ron Y.)
Mission Viejo,

Oct 27, 2009
235 Posts

Re: Getting an error #419 when I attempt to read the "Form.hWnd" handle when the form is closed.

You first need to check if the for variable (frm in this example) is not Nothing. Here is an example:

bFormOpen=False
If frm then if frm.hWnd then bFormOpen=TRUE

Oct 28, 2009
2 Posts

Re: Getting an error #419 when I attempt to read the "Form.hWnd" handle when the form is closed.

I am running ATEasy 6.0 Build 134.
The Form object variable does not get set to "Nothing" when you "Unload" a form. The programmer has to manually in code set "FormName = Nothing".
Here is my real problem. In my application I want my program to load forms in the modeless mode so I can continue to run program code while the forms are loaded. I need the modeless mode so I can write data to my forms. I have Form1 (modeless mode) loaded. I then load Form2 (modeless mode), followed by loading Form3 (modeless mode). When I close Form2 in the same subroutine as the one I "loaded Form3", ATEasy 6 unloads both Form2 & Form3! In my Form3 load subroutine I am in a "While(Form3 <> Nothing)/Endwhile" loop waiting for the Form3 object variable to get set to "Nothing" before exiting. But when ATEasy unloads the Form3, it does not set the Form3 variable to "Nothing". I am now stuck in an endless loop!

Question: How do I prevent ATEasy from unloading my Forms when I do not want them unloaded? Once the FormName object is set to "Nothing" you cannot test for "FormName.hWnd = 0" because it gives you the "Run-time error #419: 'Objefct is null'".
Why can't I test for the windows handle after the form object is set to Nothing? Why should it matter! In my application it is form intensive. I cannot have ATEasy closing my forms, because I require operator input & periodic data updates that I cannot track. Also I do not want to have to write code to monitor my forms to make sure they are loaded & there data is up to date!

DrATEasy (Ron Y.)
Mission Viejo,

Oct 28, 2009
235 Posts

Re: Getting an error #419 when I attempt to read the "Form.hWnd" handle when the form is closed.

You should probably open a Magic incident for this.



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]