Announcement

Collapse
No announcement yet.

Sygic and senkey command

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sygic and senkey command

    I try to create a RR dll that interface Sygic , Ig4 , Gmpc , AutoMapa with Google Maps .

    But for now i look for the key that control Sygic

    I have found ,f1,left,right,up,down,enter and all numbers .

    So i can to use for to go to the menu:
    Code:
    ACTIVATE;Sygic Drive||SENDKEY;{f1}
    A KeyMap.ini exist into the sygic folder that configure the control by keys.
    But into the menu 'Enter Gps Position' , on the right bottom exist a 'done' button.

    Who know what key command i can send for to simulate this button?



    Thanks for all help

  • #2
    I would assume ENTER should be it.. I'm assuming that if you ENTER does not work, you have pressed the "done" button with the mouse and verified that it works ? in which case, you'd have to simulate a mouse button click there.
    Ride Runner RR's Myspace

    "Being happy is not about having what you want, it's about wanting what you have."
    "The best things in life are always free - but that doesn't mean money can't buy you good things."

    Comment


    • #3
      If i don't found the sendkey command , my other idea is to simulate a mouse click on the coordinates , x=780 and y=520 by example , with the dll.

      How can i do that easly please in vb6.

      Thanks

      Comment


      • #4
        OOps thanks Guino, for your help that i haven't seen.

        If you can to help me with an example .

        I have found this class but i don't know how to use it .

        Code:
        Option Explicit
        
        Private Type POINTAPI
           x As Long
           y As Long
        End Type
        
        Private Declare Sub mouse_event Lib "user32" ( _
           ByVal dwFlags As Long, _
           ByVal dx As Long, ByVal dy As Long, _
           ByVal cButtons As Long, _
           ByVal dwExtraInfo As Long)
        Private Const MOUSEEVENTF_ABSOLUTE = &H8000 '  absolute move
        Private Const MOUSEEVENTF_LEFTDOWN = &H2 '  left button down
        Private Const MOUSEEVENTF_LEFTUP = &H4 '  left button up
        Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 '  middle button down
        Private Const MOUSEEVENTF_MIDDLEUP = &H40 '  middle button up
        Private Const MOUSEEVENTF_MOVE = &H1 '  mouse move
        Private Const MOUSEEVENTF_RIGHTDOWN = &H8 '  right button down
        Private Const MOUSEEVENTF_RIGHTUP = &H10 '  right button up
        Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
        
        Public Property Get x() As Long
        Dim tP As POINTAPI
           GetCursorPos tP
           x = tP.x
        End Property
        Public Property Get y() As Long
        Dim tP As POINTAPI
           GetCursorPos tP
           y = tP.y
        End Property
        Public Property Let x(ByVal x As Long)
           MoveTo x, y ' y from property get
        End Property
        Public Property Let y(ByVal y As Long)
           MoveTo x, y ' x from property get
        End Property
        
        Public Sub MoveTo(ByVal x As Long, ByVal y As Long)
        Dim xl As Double
        Dim yl As Double
        Dim xMax As Long
        Dim yMax As Long
           
           ' mouse_event ABSOLUTE coords run from 0 to 65535:
           xMax = Screen.Width \ Screen.TwipsPerPixelX
           yMax = Screen.Height \ Screen.TwipsPerPixelY
           xl = x * 65535 / xMax
           yl = y * 65535 / yMax
           ' Move the mouse:
           mouse_event MOUSEEVENTF_MOVE Or MOUSEEVENTF_ABSOLUTE, xl, yl, 0, 0
           
        End Sub
        
        Public Sub Click(Optional ByVal eButton As MouseButtonConstants = vbLeftButton)
        Dim lFlagDown As Long
        Dim lFlagUp As Long
           Select Case eButton
           Case vbRightButton
              lFlagDown = MOUSEEVENTF_RIGHTDOWN
              lFlagUp = MOUSEEVENTF_RIGHTUP
           Case vbMiddleButton
              lFlagDown = MOUSEEVENTF_MIDDLEDOWN
              lFlagUp = MOUSEEVENTF_MIDDLEUP
           Case Else
              lFlagDown = MOUSEEVENTF_LEFTDOWN
              lFlagUp = MOUSEEVENTF_LEFTUP
           End Select
           ' A click = down then up
           mouse_event lFlagDown Or MOUSEEVENTF_ABSOLUTE, 0, 0, 0, 0
           mouse_event lFlagUp Or MOUSEEVENTF_ABSOLUTE, 0, 0, 0, 0
        End Sub
        This class are named 'CMouse'

        Then i know that i do to write :
        Code:
        Private m_cMouse As CMouse
        But where on my script

        and where needed call the click

        use 'm_cMouse.Click' but where also

        Thanks for your help

        Comment


        • #5
          Ok,

          I have found a solution !

          I have found this module (.bas)
          Code:
          Dim iniFile As New ClsIniFile
          Dim tmpFile As New ClsIniFile
          Dim Longitude As String
          Dim Latitude As String
          
          Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
          Public Declare Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
          
          
          Public Const MOUSEEVENTF_LEFTDOWN = &H2
          Public Const MOUSEEVENTF_LEFTUP = &H4
          
          
          Public Sub Mouse_LeftClick(xIni, yIni)
              Dim x As Integer
              Dim y As Integer
              x = xIni ' where to move and click the mouse
              y = yIni
          mouse_event MOUSEEVENTF_ABSOLUTE, x, y, 0, 0
          mouse_event MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
          mouse_event MOUSEEVENTF_LEFTUP, x, y, 0, 0
          End Sub
          and i call this module like that,
          Code:
          Public Function ProcessCommand(CMD As String, frm As Object) As Integer
                      iniFile.FileName = App.Path & "/NavCMD.ini"
                      tmpFile.FileName = App.Path & "/NavCMD.tmp"
          
              Select Case LCase(CMD)
                  Case "sygicmenu" 'acces au menu: "Menu principal"
                      iniFile.ApplicationKey = "SYGIC"
                      RRSDK.Execute (iniFile.GetValue("SYGICMENU", ""))
                      ProcessCommand = 2
                      
                  Case "sygicdefposgps" 'acces au menu: "Définir Position GPS"
                      iniFile.ApplicationKey = "SYGIC"
                      tmpFile.ApplicationKey = "GPS COORDINATES"
                      RRSDK.Execute (iniFile.GetValue("SYGICDEFPOSGPS", "") & "||ACTIVATE;Sygic DRIVE||SENDKEY;" & tmpFile.GetValue("Longitude", ""))
                      Sleep 500
                      iniFile.ApplicationKey = "MOUSECLICK"
                      Call Mouse_LeftClick(iniFile.GetValue("XMOUSE", ""), iniFile.GetValue("YMOUSE", "")) ' click mouse on XMOUSE and YMOUSE position
          
                      Sleep 500
                      RRSDK.Execute ("ACTIVATE;Sygic DRIVE||SENDKEY;" & tmpFile.GetValue("Latitude", ""))
                      ProcessCommand = 2
              End Select
          
          End Function

          With the 'sygicdefposgps', i send the latitude and after the longitude found into NavCMD.tmp file .

          NavCMD.ini
          Code:
          [SYGIC]
          SYGICMENU="ACTIVATE;Sygic Drive||SENDKEY;{F1}"
          SYGICDEFPOSGPS="ACTIVATE;Sygic Drive||SENDKEY;{F1}{ENTER}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{ENTER}"
          
          [MOUSECLICK]
          XMOUSE=780
          yMOUSE=530
          NavCMD.tmp
          Code:
          [GPS COORDINATES]
          Longitude = 2.318459
          Latitude = 48.863064
          The mouse click well on the good position, but i have some issue that i don't understand,
          but the command is send sevral times

          Comment


          • #6
            Either post or email me your sources and I can take a look at it for you.

            Your code seems very close to it.. if the command is being sent several times it may be some sort of focus/event issue.. I would try the following change:

            Instead of:

            mouse_event MOUSEEVENTF_ABSOLUTE, x, y, 0, 0
            mouse_event MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
            mouse_event MOUSEEVENTF_LEFTUP, x, y, 0, 0

            Try:

            mouse_event MOUSEEVENTF_ABSOLUTE+MOUSEEVENTF_MOVE, x, y, 0, 0
            mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
            mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0

            Or:
            mouse_event MOUSEEVENTF_ABSOLUTE+MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
            mouse_event MOUSEEVENTF_ABSOLUTE+MOUSEEVENTF_LEFTUP, x, y, 0, 0

            Or even:

            mouse_event MOUSEEVENTF_ABSOLUTE+MOUSEEVENTF_LEFTDOWN+MOUSEEVE NTF_LEFTUP, x, y, 0, 0

            Just a few suggestions.. some applications may act differently upon the above calls.
            Ride Runner RR's Myspace

            "Being happy is not about having what you want, it's about wanting what you have."
            "The best things in life are always free - but that doesn't mean money can't buy you good things."

            Comment

            Working...
            X