Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
how do i make a program that will know what program is running and will 'splash' buttons onto the screen. And also have hotkey respond? plus is there a way for vb to send commands to a program like, sendkeys.sendwait("") to a programt hats not maximized?
  • *Experts*
Posted

Could you explain in detail what precisely you mean by "splash buttons onto the screen" an "have hotkey respond"?

 

As for your second question, you will need to use [api]SetForegroundWindow[/api] and possibly [api]SetFocus[/api] APIs to focus the window before SendKeys'ing to it; there's no way to send commands to a program regardless of focus state. SendKeys simply blindly emulates you typing on the keyboard in hopes that the correct window is focused.

 

 

 

800th post! :)

Posted

'splash buttons' make buttons at liek 300, 650 without a window

'hotkey respond' like have the program in the background, but when say when "f12" is pressed it will do something

  • *Experts*
Posted

Well, there is no built in .NET way that I know of to use global hotkeys, so you'll need Windows hooks for that; I not only don't know much about windows hooks, global keyhooks are an easily misused item, and so you probably won't find much help here (forum policy).

 

To make a button "float", you can use the [api]SetParent[/api]() API to set the button's parent window to that of the desktop (you can get this with the [api]GetDesktopWindow[/api]() API).

  • *Experts*
Posted

Ok, the first one is: SetParent()

The declaration is as follows:

Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As Integer, ByVal hWndNewParent As Integer) As Integer

This will set the parent of your control.

 

The one GetDesktopWindow() will get the handle to the desktop window which you need to set the desktop as the parent of the control.

Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Integer

 

Put those two declarations in your form class.

Then do this:

Dim DesktopHanlde As Integer = GetDesktopWindow()
SetParent(Button1.Handle.ToInt32, DesktopHandle)

First declare a variable that will store the handle of the desktop

and then SetParent using the Button1 handle and then DesktopHandle you just got.

 

:)

Posted

i get most of that except the last line

First declare a variable that will store the handle of the desktop

and then SetParent using the Button1 handle and then DesktopHandle you just got.

how do i do that?

and also once i got that how do i make the text/button appear on the screen?

  • *Experts*
Posted

Those two lines refer to the code right above them :)

This is all you need to show the button on the desktop, nothing else is required.

Posted (edited)
thanks i figured it out just a while ago, buttttttt, there is still a window.... how do i have no window?and the objects that i 'splash' on the screen apprear as sepparet windows down on the taskbar. Is there any way to remove those without removing the objects? Edited by starcraft

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...