Results 1 to 8 of 8

Thread: VB6 Gurus - API and hooks?

  1. #1
    Low Bitrate Juliemac's Avatar
    Join Date
    Apr 2004
    Location
    Upstate NY
    Posts
    107

    VB6 Gurus - API and hooks?

    I am trying to control apps running on the system via keypad.
    "/" starts the MP3/Video Player.
    "*" starts the GPS Mapping.
    "-" starts the Engine Management (spark and fuel) software.

    What I need to do is:
    1) if its not running, to start the app
    2) if running and minimised, to maximise the app.

    I can see 2 ways of accomplishing my goal.
    1) Run external apps within a VB form container (like the webbrowser control)
    2) Attach to the apps running in the tool bar.

    Clear as mud? Got any ideas?
    1981 VW Scirocco, 2L 16v turbo. EEEPC 1000 running Mega Squirt and music.
    Http://www.menloparkrandd.com/scirocco

  2. #2
    Zac
    Zac is offline
    Constant Bitrate
    Join Date
    Feb 2004
    Location
    VA
    Posts
    192
    I don't know VB but thats VERY easy to do in C++...search for SendKeys I believe it is with VB. That'll show you how to find a window and then it's a simple matter of running it if you don't find the window.

  3. #3
    FLAC PatO's Avatar
    Join Date
    Dec 2000
    Location
    Afton MN
    Posts
    1,120
    Google for "vb sendmessage tutorial".
    Couple of promising hits:
    http://cu.imt.net/~joe/matt/program/vb/Tutorials/
    http://www.geocities.com/SiliconVall.../apitutor.html

    Play with it for a bit - it's not too difficult to do.
    http://www.jeepmp3.com/
    CarPC Stolen. Starting over.
    Ne1 recognize the avatar?

  4. #4
    Mobile Impact Creator reddeath30's Avatar
    Join Date
    Mar 2005
    Location
    Placentia, California
    Posts
    1,140
    Its actually easier than all that, here is the code. Just make sure that the focus returns to Text1 with every function, or run this in a timer.

    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    'The KeyCode (111) = "/"
    If KeyCode = (111) Then
    'Place Your Code Here
    End If

    'The KeyCode (106) = "*"
    If KeyCode = (106) Then
    'Place Your Code Here
    End If

    'The KeyCode (109) = "-"
    If KeyCode = (109) Then
    'Place Your Code Here
    End If
    Text1.Setfocus
    End Sub
    Mobile Impact
    Highly innovative car computer multimedia/entertainment system software.
    http://mobileimpact.biz.tm

  5. #5
    Raw Wave
    Join Date
    Jun 2004
    Location
    On the beach
    Posts
    2,225
    But that only works if the app has focus

  6. #6
    Mobile Impact Creator reddeath30's Avatar
    Join Date
    Mar 2005
    Location
    Placentia, California
    Posts
    1,140
    True, and now that I think about it, the form would have to stay on top, but then the focus would leave it when the other program is used so he would have to click back on the form. Oh well, it was late when I posted, heh heh. Maybe he can use the code somehow.
    Mobile Impact
    Highly innovative car computer multimedia/entertainment system software.
    http://mobileimpact.biz.tm

  7. #7
    FLAC PURDooM's Avatar
    Join Date
    Jun 2005
    Location
    Anoka County, MN
    Posts
    1,021
    GetASyncKeyState will give you the state of any key on the keyboard regardless of focus. Make a really fast timer and constantly check all the relavent keys and your good to go

    Google for more, I just woke up and have to get to work and don't have time to make a function for ya.

    Oh and if you need something that finds a process by name and gives it focus to send it keypresses, I got some code to pm ya if you need it.

    Check out http://www.thescarms.com/vbasic/DefaultNav.asp
    Current projects: iGmod reloaded (Latest release) (put on hiatus indefinatly)

    Unlimited Internet and gps tracking for $6 a month with boost mobile!

    Carputer 2: www.lmaocar.com

  8. #8
    Low Bitrate Juliemac's Avatar
    Join Date
    Apr 2004
    Location
    Upstate NY
    Posts
    107
    I used the Asynckeystate API.
    Now the MDI form (MP3/Video & Fuel/Spark management) can easily switch between each other using the /,*,- keys on the mini keypad.
    The 2,4,6,8 keys move with in the form displayed.
    Using the keys 1,3,5,7,9 I can start or switch between outside programs running on the system.

    Now I can switch Apps with out having to look at the screen while driving.

    Thanks a lot guys!
    1981 VW Scirocco, 2L 16v turbo. EEEPC 1000 running Mega Squirt and music.
    Http://www.menloparkrandd.com/scirocco

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
  •