J
José Manuel
Hi, I'm trying to translate an application from eVB to Visual Basic .Net
where I have custom keyboards implemented as is described in
http://www.devbuzz.com/content/zinc_evb_skinnable_keyboard_pg1.asp
But I've many problems:
1.- There isn't a Handle propertie for Form class? I can't get it.
Then I use next workaround:
<...>
Public Declare Function FindWindow Lib "Coredll" Alias "FindWindowW" (ByVal
lpClassName As Char(), ByVal lpWindowName As Char()) As IntPtr
<...>
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim nWnd As IntPtr
nWnd = FindWindow(Nothing, Me.Text)
<...>
This seems return the window handle
2.- When I've got the Form handle I call "SetWindowPos" but it raises an
exception:
Public Declare Function mdiSetWindowPos Lib "Coredll" Alias "SetWindowPos" _
(ByVal hwnd As IntPtr, 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 Boolean
Public Const mdiHWND_NOTOPMOST = -2
Public Const mdiSWP_NOACTIVATE = &H10
Public Const mdiSWP_NOSIZE = &H1
Public Const mdiSWP_NOMOVE = &H2
<...>
Dim nWnd As IntPtr
nWnd = FindWindow(Nothing, Me.Text)
mdiSetWindowPos(nWnd, mdiHWND_NOTOPMOST, 0, 0, 0, 0, mdiSWP_NOMOVE Or
mdiSWP_NOSIZE Or mdiSWP_NOACTIVATE)
' Here I get Unrecognized exception
============================================================================
==========================
Can I use this external functions with Visual Basic .Net?
If yes, what is wrong in my code?
Tanks a lot in advance.
where I have custom keyboards implemented as is described in
http://www.devbuzz.com/content/zinc_evb_skinnable_keyboard_pg1.asp
But I've many problems:
1.- There isn't a Handle propertie for Form class? I can't get it.
Then I use next workaround:
<...>
Public Declare Function FindWindow Lib "Coredll" Alias "FindWindowW" (ByVal
lpClassName As Char(), ByVal lpWindowName As Char()) As IntPtr
<...>
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim nWnd As IntPtr
nWnd = FindWindow(Nothing, Me.Text)
<...>
This seems return the window handle
2.- When I've got the Form handle I call "SetWindowPos" but it raises an
exception:
Public Declare Function mdiSetWindowPos Lib "Coredll" Alias "SetWindowPos" _
(ByVal hwnd As IntPtr, 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 Boolean
Public Const mdiHWND_NOTOPMOST = -2
Public Const mdiSWP_NOACTIVATE = &H10
Public Const mdiSWP_NOSIZE = &H1
Public Const mdiSWP_NOMOVE = &H2
<...>
Dim nWnd As IntPtr
nWnd = FindWindow(Nothing, Me.Text)
mdiSetWindowPos(nWnd, mdiHWND_NOTOPMOST, 0, 0, 0, 0, mdiSWP_NOMOVE Or
mdiSWP_NOSIZE Or mdiSWP_NOACTIVATE)
' Here I get Unrecognized exception
============================================================================
==========================
Can I use this external functions with Visual Basic .Net?
If yes, what is wrong in my code?
Tanks a lot in advance.