FF_CloseForm Info

Started by Haakon Birkeland, October 11, 2005, 01:58:24 AM

Previous topic - Next topic

Haakon Birkeland

I am getting confused on how to terminate a program. From what I gather you should not or cannot terminate the program in WM_Create. I load a datafile in WM_CREATE and if the file is either corrupted or not existing I want to display a msgbox telling of the reason why the program is terminated. I intended to put FF_CloseForm there but after reading some threads,it seems to not be the right place.
So where should I call FF_CloseForm from and not get any problems.

Bert
Haakon 8o)

TechSupport

Putting FF_CloseForm int he WM_CREATE message does not seem to cause any trouble.

If Dir$("paul.txt") = "" Then  
  FF_CloseForm hWndForm
  Exit Function
End If


If you are checking the integrity of the data file when your program first loads then you can do it in the FF_WINMAIN special function. Just return TRUE from that function to end your program.

Make sure you have the latest FireFly version just in case the functionality had changed over the last year since you read those posts.

Haakon Birkeland

You in early?
thanx I tried it and it worked but ready all the posts just confused me. No point getting in trouble later.

Bert
Haakon 8o)

Roger Garstang

I always thought it wasn't good to close/destroy the window during that message, especially since CreateWindow isn't returned from at that point, and FF's generated code expects a return value of a window handle too.  The FF_CloseForm Function calls DestroyWindow.  I would think PostMessage with WM_CLOSE would be the better method of closing properly.

Also, this note is for Paul:

FF's code expects a hWnd return from CreateWindow, and this could create a problem when users look up WM_CREATE for a solution to this and find that if they return -1 it should close the window and passes back a NULL handle.