Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. modal form and timer

modal form and timer

Scheduled Pinned Locked Moved Visual Basic
databasequestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • N 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

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      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 Long

      Private Sub Command1_Click()
      Dim str
      str = "This should work"
      TextOut GetWindowDC(GetActiveWindow), 50, 50, str, Len(str)
      End Sub

      HTH Nick Parker
      **So like children pointers should be left to grown ups. - Norm Alomond


      **

      N 1 Reply Last reply
      0
      • N Nick Parker

        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 Long

        Private Sub Command1_Click()
        Dim str
        str = "This should work"
        TextOut GetWindowDC(GetActiveWindow), 50, 50, str, Len(str)
        End Sub

        HTH Nick Parker
        **So like children pointers should be left to grown ups. - Norm Alomond


        **

        N Offline
        N Offline
        ns
        wrote on last edited by
        #3

        This is amazing! It worked! Many many many thanks! Thanks, ns

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups