Announcement

Collapse
No announcement yet.

Programming Question in VB

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

  • Programming Question in VB

    So I wrote some code to take the map window in routis and embed it into the app i'm using without the menu and button bar etc...

    Anyway, i just changed the parent of that window using setparent api call. It works great when testing on my desktop running xp but when i move it to the car which is running 98 it doesn't work. the map window disappears and the only two functions that could be causing it are movewindow or setparent. any ideas?

  • #2
    Hi,

    Never used the setparent or moveparent functions myself but could they be 32Bit XP only API calls?? If so, they won't work under '98.

    Comment


    • #3
      98 is 32bit.

      Run depends.exe on your application on XP and figure out which external files it's using. You probably need to update some component on your 98 machine.
      Chrysler 300 - Fabricating
      http://hallert.net/

      Comment


      • #4
        I put 32bit XP ONLY! API Calls, I didn't say that Windows 98 wasn't 32 bit.

        Comment


        • #5
          Originally posted by UK_MP3Car
          I put 32bit XP ONLY! API Calls, I didn't say that Windows 98 wasn't 32 bit.
          Try this: XP only, API calls.
          AMD XP 2600+/512MB RAM/120GB hard drive
          Opus 150W/DVD/GPS/7" Lilliput TS/802.11g/Bluetooth
          Installed.


          -GPSSecure- - GPS Tracking
          -AltTabber2.2.2- - Handy touchscreen utility.

          Comment


          • #6
            Now that we are done with grammar discussions, ....

            SetParent Function
            Minimum DLL Version user32.dll
            Header Declared in Winuser.h, include Windows.h
            Import library User32.lib
            Minimum operating systems Windows 95, Windows NT 3.1

            MoveWindow Function
            Minimum DLL Version user32.dll
            Header Declared in Winuser.h, include Windows.h
            Import library User32.lib
            Minimum operating systems Windows 95, Windows NT 3.1

            Here is the code:
            Code:
            Option Explicit
            Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
            Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
            Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
            Private Declare Function ShellExecute Lib "shell32" Alias "ShellExecuteA" (ByVal hwnd As Long, _
                ByVal lpOperation As String, _
                ByVal lpFile As String, _
                ByVal lpParameters As String, _
                ByVal lpDirectory As String, _
                ByVal nShowCmd As Long) As Long
            Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
            Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
            Private Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
            Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Boolean) As Long
            Private Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
            
            
            Private Const WM_LBUTTONDOWN As Long = &H201
            Private Const WM_CLOSE As Long = &H10
            Private Const WM_LBUTTONUP As Long = &H202
            Private Const WM_KEYDOWN = &H100
            Private Const WM_KEYUP = &H101
            Private Const VK_SPACE = &H20
            
            Private rHwnd As Long
            Private okHwnd As Long
            
            Private Sub Form_Load()
            On Error GoTo errortrap
                
                ShellExecute 0, vbNullString, "c:\program files\routis\routis.exe", vbNullString, "c:\program files\routis", 1
                Form1.Width = Screen.Width
                Form1.Height = Screen.Height
                Form1.Top = 0
                Form1.Left = 0
                Timer1.Interval = 500
                Timer2.Interval = 500
                Timer1.Enabled = True
            
            errortrap:
            End Sub
            
            
            Private Sub Form_Unload(Cancel As Integer)
            Call SendMessageLong(rHwnd, &H10, 0&, 0&)
            End Sub
            
            Private Sub Timer1_Timer()
                Timer1.Enabled = False
                
                rHwnd = FindWindow("#32770", "Warning")
                okHwnd = FindWindowEx(rHwnd, 0&, "button", "OK")
                SendMessage okHwnd, WM_LBUTTONDOWN, 0, 10
                SendMessage okHwnd, WM_LBUTTONUP, 0, 10
                
                Timer2.Enabled = True
            End Sub
            Private Sub Timer2_Timer()
                Timer2.Enabled = False
                
                If FindWindow("#32770", "Warning") <> 0 Then
                    rHwnd = FindWindow("#32770", "Warning")
                    okHwnd = FindWindowEx(rHwnd, 0&, "button", "OK")
                    Call PostMessage(okHwnd, WM_KEYDOWN, VK_SPACE, 0&)
                    Call PostMessage(okHwnd, WM_KEYUP, VK_SPACE, 0&)
                End If
                embed
                
            End Sub
            
            Private Sub embed()
                rHwnd = FindWindow("intellinavwcls", "Routis")
                okHwnd = FindWindowEx(rHwnd, 0&, "afx:400000:b:10011:6:0", vbNullString)
                Call SetParent(okHwnd, Me.hwnd)
                MoveWindow okHwnd, 0, 0, Screen.Width / Screen.TwipsPerPixelX, 7 / 8 * Screen.Height / Screen.TwipsPerPixelY, True
                Call ShowWindow(rHwnd, 0)
            End Sub
            I don't think it really matters that much cause i like copilot better but it would be nice to figure out.

            Comment


            • #7
              Hey some of that code is mine
              [H]4 Life
              My next generation Front End is right on schedule.
              It will be done sometime in the next generation.
              I'm a lesbian too.
              I am for hire!

              Comment


              • #8
                yeah true i based it on your source for routis launcher but it is heavily modified

                Do you see any reason it wouldn't work on a 98 based system?

                Comment


                • #9
                  Add some debug code to print out your handles. See what's happening.
                  [H]4 Life
                  My next generation Front End is right on schedule.
                  It will be done sometime in the next generation.
                  I'm a lesbian too.
                  I am for hire!

                  Comment

                  Working...
                  X