Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Keep App on top for LCD application

  1. #1
    FLAC PatO's Avatar
    Join Date
    Dec 2000
    Location
    Afton MN
    Posts
    1,120

    Question Keep App on top for LCD application

    I have a VB app (external to Winamp) that communicates with Winamp to display data to an LCD and control playlist functions, eq, etc...
    My biggest problem with this is keeping the program focused. As I don't have a monitor, this can be a cause for great frustration! (hauling the computer inside to a monitor is no quick task)
    VB has a few "keep on top" api's that usually work in win95, but can occasionally fail. They don't work at all in 98/NT/ME.
    Does anyone know of a plugin that would send keys to a VB app? Do C++ or Delphi have routines that would keep a program locked active?

    I know I could do it with a Winamp plugin, but I don't have the time or energy to learn C++ or Delphi...

    Any tips would be appreciated!
    http://www.jeepmp3.com/
    CarPC Stolen. Starting over.
    Ne1 recognize the avatar?

  2. #2
    Constant Bitrate
    Join Date
    Nov 2000
    Location
    VA , USA
    Posts
    193

    Post

    ok let me make sure I have it straight before I go tring to look for any answers. you are using a standard 10? key keyboard and you are trying to make sure that your VB app gets all the keystrokes that are sent to the computer right ?.

  3. #3
    FLAC PatO's Avatar
    Join Date
    Dec 2000
    Location
    Afton MN
    Posts
    1,120

    Post

    Yup,
    It's a 10-key keypad. PS/2 style so it functions the same as a regular keyboard.
    I do not want Winamp to notice these keypresses, rather, I want them to go to my app and only my app.
    http://www.jeepmp3.com/
    CarPC Stolen. Starting over.
    Ne1 recognize the avatar?

  4. #4
    FLAC PatO's Avatar
    Join Date
    Dec 2000
    Location
    Afton MN
    Posts
    1,120

    Post

    uh....
    Sorry, it's a 17-key keypad...
    (it has + - * / <cr>.....)
    http://www.jeepmp3.com/
    CarPC Stolen. Starting over.
    Ne1 recognize the avatar?

  5. #5
    FLAC
    Join Date
    Aug 1999
    Location
    Upper Marlboro, MD 20772
    Posts
    1,311

    Post

    this is what u do.... I had to also do something like this for CobraII/III. You could put a timer on ur app..say every 1 sec issue this API call.
    SetForegroundWindow( <handle to ur app OR window> )

    Note that Setforgroundwindow is in the USER32.DLL library and i believe u know what to do from here. Also one other thing u could do is make ur window a pop up window this sometimes work. But that API call will do the trick.
    If you need more help let me know.

    ------------------
    abcd-1
    Author of CobraI and CobraII.
    For more information on the COBRA Application's please visit the link. For the latest or updated info on CobraII please click on the link. Get new updated files for CobraII here. ftp://pictures[email protected]/d:/newdlls
    You can contact me on AOL instant messenger....nick is Cenwesi
    Webpage comming soon!

    Official Cobra Page
    abcd-1
    Author of CobraI,II,III and now CobraIV.
    You can contact me on AOL instant messenger....nick is cenwesi or cenwesi3

  6. #6
    Constant Bitrate
    Join Date
    Nov 2000
    Location
    VA , USA
    Posts
    193

    Post

    I would say you would want to do some kind of keyboard hook for your app. I dont know if these will discard the keypresses after bringing them to your app but you might want to take a look at these examples I found
    some of them are full VB apps others are a .dll written in C++ or delphi that can be accessed by VB.

    http://www.planetsourcecode.com/xq/A...s/ShowCode.htm

    http://www.freevbcode.com/ShowCode.Asp?ID=728

    http://www.planetsourcecode.com/xq/A...s/ShowCode.htm


  7. #7
    Newbie
    Join Date
    May 2000
    Location
    Cary, NC, USA
    Posts
    39

    Post

    If setforegroundwindow behaves in VB like it does in Delphi and C, then it doesnt work on Win 98. In windows 98 Setforeground window just makes the taskbar icon (and title bar) blink. What I had to do for MP3it was add an ondeactivate)iirc) mehtod, and do a Minimizewindow/restore window.. Which popped it into the front. Works like a charm.



    ------------------
    -Jason
    mp3it - MP3 Software for Small LCD Screens for use in the car.
    and
    <A HREF="http://www.mp3mystic.com" TARGET=_blank>
    MP3Mystic</A> - a personal MP3 Server software for windows.
    -Jason
    mp3it - MP3 Software for Small LCD Screens for use in the car.
    and
    <A HREF="http://www.mp3mystic.com" TARGET=_blank>
    MP3Mystic</A> - a personal MP3 Server software for windows.

  8. #8
    Retired Admin Aaron Cake's Avatar
    Join Date
    Jan 2000
    Location
    London, Ontario, Canada
    Posts
    2,464

    Cool

    The reason those APIs work differently in 98/ME is because users complained to MS that windows were constantly popping up when they were deep in the start menu. It was printed in MSDN somewhere....

    Anyway, there are new APIs, but they follow the MS rule that one window can no longer steal the focus from another windows. A keyboard hook is a much more reliable method under these OSs.

    That said, I use the SetWindow... API in my player to keep it in focus, but of course mine is Win95.

    ------------------
    Aaron Cake
    London, Ontario, Canada

    Player: Cyrix 200, 32MB RAM, 10.2Gig Quantum HD, Onboard EtherNet/Sound/Video, Custom Lexan Case, Arise DC-DC, Win95 Kernal w/Custom Player
    Car: '86 Mazda RX-7 w/Basic Performance Upgrades
    Player: Pentium 166MMX, Amptron 598LMR MB w/onboard Sound, Video, LAN, 10.2 Gig Fujitsu Laptop HD, Arise 865 DC-DC Converter, Lexan Case, Custom Software w/Voice Interface, MS Access Based Playlists
    Car: 1986 Mazda RX-7 Turbo (highly modded), 1978 RX-7 Beater (Dead, parting out), 2001 Honda Insight
    "If one more body-kitted, cut-spring-lowered, farty-exhausted Civic revs on me at an intersection, I swear I'm going to get out of my car and cram their ridiculous double-decker aluminium wing firmly up their rump."

  9. #9
    Variable Bitrate
    Join Date
    Aug 1999
    Location
    Yorba Linda, CA
    Posts
    323

    Post

    I use a keyboard hook for my app... it's basically a DLL file that the app loads into memory at runtime and it "hooks" into the Windows messaging system and monitors keyboard events. The DLL does the actual event trapping and calls a method in the main app to pass they key value to it.

    It doesn't stop the event from reaching its destination, so it won't steal keystrokes bound for other apps.

    ...but it's in Delphi so I don't know how much hacking it would take to do in VB... I have the DLL if anyone is interested, and I can give some example Delphi code. You should be able to translate it pretty easily as it uses API calls.

    --Jason
    Jason Johnson
    Yorba Linda, California
    http://www.m2pc.com

    MPC Phase IV - *** PENDING ***

  10. #10
    FLAC
    Join Date
    Aug 1999
    Location
    Upper Marlboro, MD 20772
    Posts
    1,311

    Post

    yo...send it to me....curious to see if i can trap keys for PowerDVD/Cinemaster as well as media player and some other apps.

    ------------------
    abcd-1
    Author of CobraI and CobraII.
    For more information on the COBRA Application's please visit the link. For the latest or updated info on CobraII please click on the link. Get new updated files for CobraII here. ftp://pictures[email protected]/d:/newdlls
    You can contact me on AOL instant messenger....nick is Cenwesi
    Webpage comming soon!

    Official Cobra Page
    abcd-1
    Author of CobraI,II,III and now CobraIV.
    You can contact me on AOL instant messenger....nick is cenwesi or cenwesi3

Page 1 of 2 12 LastLast

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
  •