Click here to Skip to main content
15,920,602 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionkey press [modified] Pin
JAYRAJ GIRI7-Mar-09 17:43
JAYRAJ GIRI7-Mar-09 17:43 
AnswerRe: key press Pin
dan!sh 7-Mar-09 18:41
professional dan!sh 7-Mar-09 18:41 
JokeRe: key press Pin
ABitSmart7-Mar-09 19:21
ABitSmart7-Mar-09 19:21 
GeneralRe: key press Pin
Luc Pattyn8-Mar-09 1:15
sitebuilderLuc Pattyn8-Mar-09 1:15 
AnswerRe: key press Pin
0x3c08-Mar-09 2:23
0x3c08-Mar-09 2:23 
AnswerMove along. Nothing to see here... Pin
Dave Kreskowiak8-Mar-09 6:33
mveDave Kreskowiak8-Mar-09 6:33 
AnswerRe: key press Pin
Christian Graus8-Mar-09 17:13
protectorChristian Graus8-Mar-09 17:13 
QuestionWindows hook Pin
robertw0197-Mar-09 12:17
robertw0197-Mar-09 12:17 
Looking to create a global hook to intercept WM_WINDOWPOSCHANGED messages. So far all attempts to create a hook always end up not functioning properly. I create the hook then filter out messages that aren't what I'm looking for, but it always seems to make all non-system processes that are running crash.
My Code:
Public Class WM_WINDOWPOSCHANGED
       Shared Event WindowMoving(ByVal handle As IntPtr)
       Shared hookhandle As Integer
       Shared hookhandler As HookHandler
       Private Sub New()

       End Sub
       Public Shared Sub CreateTheHook()
           'If hookhandle = 0 Then
           '    hookhandle = User32Imports.SetWindowsHookEx(CInt(HookCodes.WH_CALLWNDPROC), hookhandler, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()(0)), CInt(0))
           '    MsgBox(hookhandle)
           'End If
           hookhandler = New HookHandler(AddressOf ChangeButtonHost)
           hookhandle = User32Imports.CreateSystemHook(Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()(0)), hookhandler)
           If hookhandle <> 0 Then MsgBox("hi")
       End Sub
       Shared Function ChangeButtonHost(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr)
           If nCode >= 0 Then
               Dim cwps As CWPSTRUCT = DirectCast(System.Runtime.InteropServices.Marshal.PtrToStructure(lParam, GetType(CWPSTRUCT)), CWPSTRUCT)
               Dim winfo As New WindowInfo(cwps.hwnd)
               If cwps.message = &H46 And WindowInfo.IsValid(cwps.hwnd) And winfo.ShowInTaskbar = True Then
                   RaiseEvent WindowMoving(cwps.hwnd)
               End If
           End If
           Return 0 'User32Imports.CallNextHookEx(hookhandle, nCode, wParam, lParam)
       End Function
   End Class


Friend Class User32Imports
       <DllImport("user32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
       Friend Shared Function SetWindowsHookEx(ByVal idHook As Integer, ByVal lpfn As HookHandler, ByVal hInstance As IntPtr, ByVal ThreadId As Integer) As Integer
       End Function
       <DllImport("user32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
       Friend Shared Function CallNextHookEx(ByVal idHook As Integer, ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lparam As IntPtr) As Integer
       End Function

   End Class>


EDIT: CreateSystemHook was my attempt at doing the hook code in C++, that also failed.
AnswerRe: Windows hook Pin
Dave Kreskowiak8-Mar-09 6:31
mveDave Kreskowiak8-Mar-09 6:31 
GeneralRe: Windows hook Pin
robertw0198-Mar-09 6:37
robertw0198-Mar-09 6:37 
AnswerRe: Windows hook Pin
scofflaw8-Mar-09 9:08
scofflaw8-Mar-09 9:08 
GeneralRe: Windows hook Pin
robertw0198-Mar-09 15:48
robertw0198-Mar-09 15:48 
QuestionFirefox style url texbox and tabs Pin
sphlynx7-Mar-09 10:34
sphlynx7-Mar-09 10:34 
AnswerRe: Firefox style url texbox and tabs Pin
Colin Angus Mackay7-Mar-09 14:45
Colin Angus Mackay7-Mar-09 14:45 
GeneralRe: Firefox style url texbox and tabs Pin
sphlynx7-Mar-09 23:15
sphlynx7-Mar-09 23:15 
GeneralRe: Firefox style url texbox and tabs Pin
Colin Angus Mackay8-Mar-09 2:14
Colin Angus Mackay8-Mar-09 2:14 
GeneralRe: Firefox style url texbox and tabs Pin
sphlynx9-Mar-09 7:14
sphlynx9-Mar-09 7:14 
QuestionDeleting a file with Administrator privileges in vista using vb.net Pin
David Jiboye7-Mar-09 8:38
David Jiboye7-Mar-09 8:38 
AnswerRe: Deleting a file with Administrator privileges in vista using vb.net Pin
Dave Kreskowiak8-Mar-09 6:20
mveDave Kreskowiak8-Mar-09 6:20 
QuestionProblem with show dialog box window. Pin
Pankaj Garg7-Mar-09 7:54
Pankaj Garg7-Mar-09 7:54 
AnswerRe: Problem with show dialog box window. Pin
Dave Kreskowiak8-Mar-09 6:18
mveDave Kreskowiak8-Mar-09 6:18 
GeneralRe: Problem with show dialog box window. Pin
Pankaj Garg8-Mar-09 6:23
Pankaj Garg8-Mar-09 6:23 
GeneralRe: Problem with show dialog box window. [modified] Pin
Dave Kreskowiak8-Mar-09 6:39
mveDave Kreskowiak8-Mar-09 6:39 
GeneralRe: Problem with show dialog box window. [modified] Pin
Pankaj Garg9-Mar-09 8:59
Pankaj Garg9-Mar-09 8:59 
QuestionHow to Capture the Back Button Pin
Thomas Wells7-Mar-09 7:46
Thomas Wells7-Mar-09 7:46 

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.