Announcement

Collapse
No announcement yet.

Keep App on top for LCD application

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

  • 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
    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 ?.

    Comment


    • #3
      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?

      Comment


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

        Comment


        • #5
          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

          Comment


          • #6
            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

            Comment


            • #7
              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.

              Comment


              • #8
                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."

                Comment


                • #9
                  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 ***

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      I just e-mailed it to you. Let me know if it worked OK for you.
                      Jason Johnson
                      Yorba Linda, California
                      http://www.m2pc.com

                      MPC Phase IV - *** PENDING ***

                      Comment


                      • #12
                        Well I'll be Dammed! I'm a MEMBER! Woo Hoo!
                        Ummm... sorry about that. I've waited for that for quite a while...

                        Thanks for the posts! I've tried most of the examples posted so far and they're on the right track, but still have a few problems...

                        Anyway, as far as my app goes, picure this:
                        Shell set to my app. My app starts Winamp. Guess who has focus/active? Winamp. I'd need a keyboard hook that stops keypresses from reaching Winamp.
                        One thing I've tried that works ok is a "starter" program. It is set to shell, starts Winamp on load, waits 5 sec, then starts my prog. Works fine, and would suffice for the other hooks posted so far, but this method would have the same occasional problems I'm experiencing now - Winamp occasionally gets on top.

                        Anyone have a keyboard hook (or keep on top app) that disables keypresses from getting to the active app?
                        http://www.jeepmp3.com/
                        CarPC Stolen. Starting over.
                        Ne1 recognize the avatar?

                        Comment

                        Working...
                        X