Click here to Skip to main content
15,918,889 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Cannot create Enum Type from Type.GetType("EnumName") Pin
Dallas Matthews13-Feb-04 9:08
Dallas Matthews13-Feb-04 9:08 
GeneralRe: Cannot create Enum Type from Type.GetType("EnumName") Pin
Matthew Hazlett13-Feb-04 9:56
Matthew Hazlett13-Feb-04 9:56 
GeneralRe: Cannot create Enum Type from Type.GetType("EnumName") Pin
Dallas Matthews14-Feb-04 7:23
Dallas Matthews14-Feb-04 7:23 
GeneralRe: Cannot create Enum Type from Type.GetType("EnumName") Pin
Matthew Hazlett14-Feb-04 7:44
Matthew Hazlett14-Feb-04 7:44 
GeneralRe: Cannot create Enum Type from Type.GetType("EnumName") Pin
Dallas Matthews16-Feb-04 3:38
Dallas Matthews16-Feb-04 3:38 
Generalkeyboard hooking in VB.net Pin
matthew kelly13-Feb-04 6:01
matthew kelly13-Feb-04 6:01 
GeneralRe: keyboard hooking in VB.net Pin
Dave Kreskowiak13-Feb-04 9:46
mveDave Kreskowiak13-Feb-04 9:46 
GeneralRe: keyboard hooking in VB.net Pin
matthew kelly18-Feb-04 13:48
matthew kelly18-Feb-04 13:48 
I am currently using the vb.net module included in the above article. The code works really well. I am trying to add to this project a new class “CurrentWindowWithKeyboardFocus” , which will include variables and functions that will determine

Handle to window with keyboard focus
window x position
window y position
window width
window height

What I am confused about is how I can get the handle of the window that has the keyboard focus. Is it a handle to a process??

I have attached a preliminary copy of my new class. I am looking for recommendations?? Should the class inherit from "System.Windows.Forms.Control"??

Thanks for your time and attention.



Public Class CurrentWindowWithKeyboardFocus

Inherits System.Windows.Forms.Control

Public CurrentWindow As Control

Private CWXPosition As Integer
Private CWYPosition As Integer
Private CWWidth As Integer
Private CWHeight As Integer
Private CWHandle As IntPtr


Public Sub New()
'gets the handle to the window
CWHandle = HandleOfCurrentWindow()

'gets the x postion of the window
CWXPosition = XPositionOfCurrentWindow(CWHandle)

'gets the y position of the window
CWYPosition = YPositionOfCurrentWindow(CWHandle)

'gets the width of the window
CWWidth = WidthOfCurrentWindow(CWHandle)

'gets the height of the window
CWHeight = HeightOfCurrentWindow(CWHandle)

End Sub

Public Function HandleOfCurrentWindow()
Dim WindowHandle As Integer
Dim p As Process
p = Process.GetCurrentProcess
WindowHandle = Process.GetCurrentProcess.Handle.ToInt32
'get handle of current window
'return handle
Return WindowHandle

End Function


Public Function XPositionOfCurrentWindow(ByRef intptr)
Dim xpos
'get x position of current window
'return integer
Return xpos

End Function

Public Function YPositionOfCurrentWindow(ByRef intptr)
Dim Ypos
'get y position of current window
'return integer
Return Ypos

End Function
Public Function WidthOfCurrentWindow(ByRef intptr)
Dim Width
'get width of current window
'return integer
Return Width

End Function

Public Function HeightOfCurrentWindow(ByRef intptr)
Dim Height
'get width of current window
'return integer
Return Height

End Function




End Class

GeneralRe: keyboard hooking in VB.net Pin
Dave Kreskowiak18-Feb-04 19:29
mveDave Kreskowiak18-Feb-04 19:29 
GeneralRe: keyboard hooking in VB.net Pin
Matthew Hazlett13-Feb-04 10:20
Matthew Hazlett13-Feb-04 10:20 
QuestionHow can i make or modify a .cpl file Control panel applet Pin
Saeed Tabrizi13-Feb-04 5:55
Saeed Tabrizi13-Feb-04 5:55 
AnswerRe: How can i make or modify a .cpl file Control panel applet Pin
Dave Kreskowiak13-Feb-04 10:22
mveDave Kreskowiak13-Feb-04 10:22 
Generalcreating checkboxes dynamically Pin
gamerPotatoe13-Feb-04 4:09
gamerPotatoe13-Feb-04 4:09 
GeneralRe: creating checkboxes dynamically Pin
-Dr_X-13-Feb-04 7:52
-Dr_X-13-Feb-04 7:52 
GeneralRe: creating checkboxes dynamically Pin
zaheer Asif14-Feb-04 9:47
zaheer Asif14-Feb-04 9:47 
GeneralRe: creating checkboxes dynamically Pin
zaheer Asif14-Feb-04 9:47
zaheer Asif14-Feb-04 9:47 
GeneralQuestion on pure visual basic Pin
rajrajeshwar13-Feb-04 2:51
rajrajeshwar13-Feb-04 2:51 
GeneralRe: Question on pure visual basic Pin
Dave Kreskowiak13-Feb-04 10:44
mveDave Kreskowiak13-Feb-04 10:44 
QuestionHow Handel other Application in VB project Pin
shashishukla13-Feb-04 1:07
shashishukla13-Feb-04 1:07 
GeneralMy Network Places Pin
EmjGels12-Feb-04 23:08
EmjGels12-Feb-04 23:08 
GeneralRe: My Network Places Pin
John Kuhn13-Feb-04 15:54
John Kuhn13-Feb-04 15:54 
GeneralRe: My Network Places Pin
EmjGels13-Feb-04 16:03
EmjGels13-Feb-04 16:03 
GeneralRe: My Network Places Pin
John Kuhn13-Feb-04 16:31
John Kuhn13-Feb-04 16:31 
GeneralRe: My Network Places Pin
LokmanHakim16-Feb-04 17:02
LokmanHakim16-Feb-04 17:02 
GeneralNeed help on monthview control Pin
gamerPotatoe12-Feb-04 19:47
gamerPotatoe12-Feb-04 19:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.