Results 1 to 9 of 9

Thread: Programming Question in VB

  1. #1
    Variable Bitrate
    Join Date
    Sep 2000
    Location
    LA, CA, USA
    Posts
    444

    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. #2
    Raw Wave
    Join Date
    Jun 2004
    Location
    On the beach
    Posts
    2,223
    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.

  3. #3
    FLAC Chairboy's Avatar
    Join Date
    Jan 2004
    Posts
    1,380
    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/

  4. #4
    Raw Wave
    Join Date
    Jun 2004
    Location
    On the beach
    Posts
    2,223
    I put 32bit XP ONLY! API Calls, I didn't say that Windows 98 wasn't 32 bit.

  5. #5
    Super Moderator xBrady's Avatar
    Join Date
    Apr 2004
    Location
    USA
    Posts
    3,687
    Quote 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.

  6. #6
    Variable Bitrate
    Join Date
    Sep 2000
    Location
    LA, CA, USA
    Posts
    444
    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.

  7. #7
    I'm sorry, and you are....? frodobaggins's Avatar
    Join Date
    Jan 2003
    Location
    Ruston, LA
    Posts
    8,846
    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!

  8. #8
    Variable Bitrate
    Join Date
    Sep 2000
    Location
    LA, CA, USA
    Posts
    444
    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?

  9. #9
    I'm sorry, and you are....? frodobaggins's Avatar
    Join Date
    Jan 2003
    Location
    Ruston, LA
    Posts
    8,846
    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!

Similar Threads

  1. This may be more of a programming question.. but here goes
    By bklynkaos in forum General Hardware Discussion
    Replies: 1
    Last Post: 02-09-2004, 11:11 PM
  2. Question for VB Developers
    By Seraph in forum Software & Software Development
    Replies: 3
    Last Post: 12-26-2003, 08:15 PM
  3. Programming help needed (DirectShow & VB)
    By All4Norway in forum Software & Software Development
    Replies: 0
    Last Post: 01-06-2003, 06:42 PM
  4. Question abou thte different VB interfaces ppl have.
    By Red95GST in forum Software & Software Development
    Replies: 1
    Last Post: 08-02-2002, 01:12 AM
  5. Out of topic programming question (VB)
    By darkwingduck in forum Software & Software Development
    Replies: 5
    Last Post: 09-01-2000, 07:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •