How do I set a Startup Function other than Form1?
In VB6, I always used a function called VBMain() which would then initialize my environment and then open user windows as necessary and when the last window closed it would un-itialize and shut down.
I would like to do something similar using FireFly.
In the FF Workspace [F9]
View the explorer tab
At the bottom there is a section called FF_WinMain
This function executes before the first form.
I have the following in mine when I want to prevent running the application twice.
I plan on updating to bring the application to the top.
if ff_previnstance <> 0 then
msgbox "Application is already running."
function = %True
else
function = %False
end if
Brian, Excellent code snippet. I always did this in my VB apps and put this in my program.
I am still looking to run the application and maybe NOT open any windows if the application is run in an unattended mode. I think the best way to accomplish this is to run a function or subroutine which controls the app and opens the main user window as necessary.
Quote from: Peter House on August 06, 2010, 12:07:34 PM
I am still looking to run the application and maybe NOT open any windows if the application is run in an unattended mode.
I would run the code from FF_WinMain (or a sub/function called from FF_WinMain). If your program's logic then dictates that you do not want the main startup form to show, then simply set FUNCTION = %TRUE in FF_WinMain and the application will end without displaying the main form.
Here is some pseudo code for what I am looking to accomplish.
Function MyMain()
' Called after FireFly startup and BEFORE any Forms are loaded or opened.
' Initialize my Application
MyInit()
If SomeCondition Then
' Open Main User Form
Form1.Show Modeless
Else
' No Main Form
Do Some Processing
End If
' Loop While Windows are Open
Do While DoEvents()
Sleep()
Loop
' Shutdown My Application
MyShutDown()
' Return to FireFly Shutdown
Return
End Function/Subroutine
Paul, You da Man. This pseudo code is a throwback to VB6. If you think I should do it as you suggested earlier in this thread, I will take your advice. Otherwise, I am open to suggestions.
Thanks.