PlanetSquires Forums

Support Forums => General Board => Topic started by: Douglas McDonald on April 19, 2010, 12:53:21 PM

Title: application startup
Post by: Douglas McDonald on April 19, 2010, 12:53:21 PM
This is probably a stupid question. I need to show a dialog then run a routine without any user action, no button clicks ext.....This sounds easy but I can't make it work. No matter where I put the call to the sub I need to call the dialog won't show and if I show the dialog first then how do I call the sub without any operator action?

That I need is something like a windows message saying "Dialog loaded"

example..... Case  %WM_Dialog-Loaded  'completed loading dialog now you can do stuff

Thanks
Doug
                             call xxx sub
Title: Re: application startup
Post by: Rolf Brandt on April 19, 2010, 01:06:56 PM
How about using a timer?
Title: Re: application startup
Post by: Douglas McDonald on April 19, 2010, 01:42:55 PM
Thank Rolf,

I tried that in straight PB and it didn't work but using the timer function in FF# it works for the most part.

The problem is I can't turn the timer off

FF_Control_Kill( HWND_FORM1_TIMER1 )
FF_Control_Disable( HWND_FORM1_TIMER1 )

Nether of these seem to work so I have to use a flag.

Function FORM1_TIMER1_WM_TIMER ( _
                               hWndForm      As Dword, _  ' handle of Form
                               wTimerID      As Dword  _  ' the timer identifier
                               ) As Long
Static tFlag As Long                           
FF_Control_Kill( HWND_FORM1_TIMER1 )
FF_Control_Disable( HWND_FORM1_TIMER1 )
If tFlag = 0 Then
  tFlag = 1
  startup
End If
End Function


Thanks again

Title: Re: application startup
Post by: José Roca on April 19, 2010, 01:51:44 PM
FF_Control_Kill and FF_Control_Disable have nothing to do with timers. Timers are killed using the API function KillTimer.
Title: Re: application startup
Post by: Rolf Brandt on April 19, 2010, 03:15:46 PM
As Josè said, use the API KillTimer Function. Supposed the name of the dialog is Form2 and the name of the timer is Timer1 you would call it like this:

KillTimer HWND_FORM2, IDC_FORM2_TIMER1
or
res& = KillTimer (HWND_FORM2, IDC_FORM2_TIMER1)

Title: Re: application startup
Post by: Paul Squires on April 19, 2010, 08:37:38 PM
Post a user defined message at the end of the WM_CREATE message handler. By using a PostMessage we ensure that the window gets shown (SendMessage would wait until the user message returns... we don't want that.).



%USRMSG_WINDOWISDISPLAYED = %WM_USER + 1000

'------------------------------------------------------------------------------------------------------------------------
Function FORM1_CUSTOM ( _
                      hWndForm      As Dword, _  ' handle of Form
                      wMsg          As Long,  _  ' type of message
                      wParam        As Dword, _  ' first message parameter
                      lParam        As Long   _  ' second message parameter
                      ) As Long


   Select Case wMsg
         
      Case %USRMSG_WINDOWISDISPLAYED
         ' the window should now be visible... do whatever you like.       
         'MsgBox "user message has fired"
     
   End Select

End Function

Title: Re: application startup
Post by: Douglas McDonald on April 23, 2010, 11:37:28 AM
Thank you Paul.

Regarding the timer, I wrongly assumed the time as a control which is why I tried the FF functions. now I know better
Title: Re: application startup
Post by: David Kenny on April 23, 2010, 12:17:05 PM
Well Douglas, it is in the Standard Controls List in the FF workspace, which could be misleading to people new to FF.  I think it's more obvious to people who had experience using timers with PB before FF.

David