Jump to content
Tuts 4 You

Edit Visual Basic


Scale

Recommended Posts

Posted

I have a nice tool that i use but it has the nasty property of always on top (topmost),

I reasonably experienced with assembly but i always have a hard time with VB.

Anybody know how i could remove the top most,

No idea where to start or how to trace it.

Thanks

Posted

try compiling one test form app. with top most turned on, and the same witout it, then check bytes around form caption in hexeditor for differences..

Posted (edited)

You would use the SetWindowPos api with HWND_NOTOPMOST

Example:

Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Declare Sub 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)Private Sub Form_Activate()
SetWindowPos Me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub
Edited by Pimp.exe
Posted

vb6 forms dont come standard with topmost, so your little tool you wrote must have code for being on top, remove that and you form wont be topmost....

I first thought you wanted topmost but i read your post again, does'nt make sence because there is no topmost in vb6 unless you write code to do so

Posted
vb6 forms dont come standard with topmost, so your little tool you wrote must have code for being on top, remove that and you form wont be topmost....

I first thought you wanted topmost but i read your post again, does'nt make sence because there is no topmost in vb6 unless you write code to do so

Ye but how do you find that code?

I have no idea how to trace or find it stupid VB :S

Posted

So i placed a break point on the SetWindowsPos and createwindow API,

And looked for a TOPMOST flag but i didnt see it :S

Posted (edited)

From what I read, he didnt code the tool. He has a tool that puts itself TOPMOST.

Edited by Pimp.exe
Posted (edited)

settel down pork chops, I dont know where you get that from ( 4th time I have done something to you). I never corrected anyone, I was'nt sure if he wanted topmost in vb for a tool he was writting after seeing his second post I relized he want to remove topmost from an external vb6 app,

The reason I thought it was for his own app is the code you supplied.

Private Const HWND_NOTOPMOST = -2

Private Const SWP_NOSIZE = &H1

Private Const SWP_NOMOVE = &H2

Private Const SWP_NOACTIVATE = &H10

Private Const SWP_SHOWWINDOW = &H40

Private Declare Sub 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)

Private Sub Form_Activate()

SetWindowPos Me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE

End Sub

The misconfusion was when you wrote "Me.hWnd" meaning the app he has written in vb, because from what I understand he would need to find the handel of the external app then call setwindowpos api. Sorry if I missunderstood but the code given was clearly for the app written to be topmost not an external app.

P.s sorry if that upset you that was'nt my intention.......... Peace pimp

Edited by Departure
Posted

Well my code was an example of how to use the API and the concept. I see where u got that though.

Perhaps I have read some of your posts wrong Departure. No problems then. :)

  • 1 month later...
Posted

Search for text string "SetWindowPos" post-32239-1200549873_thumb.jpgpost-32239-1200549873_thumb.jpg

Find Where this address gets Pushed, should be around MSVBVM60.DllFunctionCall

post-32239-1200549979_thumb.jpg

Goto the location where this gets called from and up above there should be Push -1

Change to Push -2

post-32239-1200550143_thumb.jpg

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...