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
How about using a timer?
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
FF_Control_Kill and FF_Control_Disable have nothing to do with timers. Timers are killed using the API function KillTimer.
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)
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
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
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