modal form and timer
-
I did
Private Sub Command1_Click() Timer1.Interval = 40 Form2.Show vbModal End Sub Private Sub Timer1_Timer() Dim rc As Long Dim opstr As String opstr = "fff" rc = TextOut(Form2.hdc, 6, 20, opstr, Len(opstr)) Timer1.Interval = 0 End Sub
and was trying to step into. After timer1.interval I expected the execution to g into the timer function, but it didnt and just showed the modal form instead. But a msgbox in timer function does trigger so i know its going in there> But it totallly disregards the textout and i dont see anything on form2. Doesnt textout "force" write stuff to where you say to write? Thanks, ns
-
I did
Private Sub Command1_Click() Timer1.Interval = 40 Form2.Show vbModal End Sub Private Sub Timer1_Timer() Dim rc As Long Dim opstr As String opstr = "fff" rc = TextOut(Form2.hdc, 6, 20, opstr, Len(opstr)) Timer1.Interval = 0 End Sub
and was trying to step into. After timer1.interval I expected the execution to g into the timer function, but it didnt and just showed the modal form instead. But a msgbox in timer function does trigger so i know its going in there> But it totallly disregards the textout and i dont see anything on form2. Doesnt textout "force" write stuff to where you say to write? Thanks, ns
This should work:
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As LongPrivate Sub Command1_Click()
Dim str
str = "This should work"
TextOut GetWindowDC(GetActiveWindow), 50, 50, str, Len(str)
End SubHTH Nick Parker
**So like children pointers should be left to grown ups. - Norm Alomond
**
-
This should work:
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As LongPrivate Sub Command1_Click()
Dim str
str = "This should work"
TextOut GetWindowDC(GetActiveWindow), 50, 50, str, Len(str)
End SubHTH Nick Parker
**So like children pointers should be left to grown ups. - Norm Alomond
**