Results 1 to 8 of 8

Thread: TopMost In Visual Basic.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2009
    Posts
    23

    TopMost In Visual Basic.

    using either (vb2008 or vb2010)


    hello, I am here to ask how to make my Form show up above all other Programs.
    even full screen games.
    Ive searched all over the place and I did get a Code.
    which was this.

    Code:
       
         
    Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
             ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
        Public Const HWND_TOPMOST = -1
        Public Const HWND_NOTOPMOST = -2
        Public Const SWP_NOMOVE = &H2
        Public Const SWP_NOSIZE = &H1

    Code:
       
          Call SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)

    (Link to The thread of where i found this code)
    http://www.vbforums.com/showthread.php?t=352702

    but I get an error which is
    In the call event "Form1.hwnd"

    "hwnd" is not a member of 'topmostwindow.form1'

    (All other tutorials and guides were either Outdated. or did not work.)
    can someone point me in the right direction. is it even possible?
    I am trying to draw my form over Eve-Online which is a MMORPG.
    so i can run my own calculator/websearcher/notepad.

    the ingames Calculator/websearcher/and notepad is
    very slow and thats why i want to create my own, so thank you for listening.
    If my Advice Worked, Please Rate me

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: TopMost In Visual Basic.

    Hello Clod14,

    Are you sure you have posted in the correct forum?

    This is the ASP.Net Forum, and to me, it looks like you are creating a Windows Form application. Is that correct?

    Gary

  3. #3
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: TopMost In Visual Basic.

    Here ya go
    vb.net Code:
    1. Me.Topmost = True
    That's it. Nothing fancy.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  4. #4
    Fanatic Member
    Join Date
    Aug 2010
    Posts
    624

    Re: TopMost In Visual Basic.

    Quote Originally Posted by Radjesh Klauke View Post
    Here ya go
    vb.net Code:
    1. Me.Topmost = True
    That's it. Nothing fancy.
    While that works a treat on windowed programs, any full screen will simply render right over the top and you won't see so much as a flicker. There's no "simple" way to place your form over a DirectX game unless you hook the directX itself and draw to the program. How to do that, I have no idea. Perhaps someone else will post a better solution than that and actually help you draw it with DX.

  5. #5
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: TopMost In Visual Basic.

    Another point: Only the last window who asked to be topmost gets to be topmost. So even ignoring DirectX, you can't ever guarantee your window will always be on top. You may attempt to be clever and keep stealing the topmost status, but Raymond Chen explained why that's an evil act.

    It sounds like you're trying to make a game overlay so that point wouldn't really matter too much. DirectX and other GPU-accelerated graphics render on a "layer" above GDI. There's no way to use GDI to render in front of DirectX. I know it's possible to hook into games and create an overlay (Steam does this and I've used some other utilities with overlay) but I've never seen a tutorial or article about how to do it. My guess is it involves black magicks. Sorry I can't be of more help.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jan 2009
    Posts
    23

    Re: TopMost In Visual Basic.

    @ gep13
    to tell you the truth Im not sure if I did post in the correct forums
    I thought I posted in the right area, as I am using Visual basic 2008

    @ Radjesh Klauke
    That's not how I wanted to do it. as it doesn't go over the 'Full screen' Game

    @ J-Deezy
    yes you got it but I found a Semi Fix. I put the Game in Windowed Mode.
    (although Tedious it works for the most part it stays above the game)

    @ Sitten Spynne
    So It would be somewhat Hard to code is what Im guessing :/ But non the less.
    I got the Semi Fix. that I was talking about. thanks anyways.
    If my Advice Worked, Please Rate me

  7. #7
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    519

    Re: TopMost In Visual Basic.

    I got interested in the subject as I have created a program that also is "semi fixed".

    You might want to take a look at this library: http://directdrawoverlaylib.codeplex.com/

  8. #8
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: TopMost In Visual Basic.

    Quote Originally Posted by Clod14 View Post
    @ gep13
    to tell you the truth Im not sure if I did post in the correct forums
    I thought I posted in the right area, as I am using Visual basic 2008
    See, this is where I am a little confused. It looks to me like you did post in the right forum, as there is no mention of a moderator moving it. However, I really only look at the ASP.Net forum, and I am 100% convinced that I got to this thread from a thread in the ASP.Net forum, so I am really not sure that I understand what happened.

    No harm done though.

    Gary

Posting Permissions

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



Click Here to Expand Forum to Full Width