|
-
Sep 28th, 2004, 12:38 PM
#1
Thread Starter
Hyperactive Member
Subclassing window in other process (winXP)
Ya guys,
i used an old VB6 algorithm to subclass a window and made a few changes at the 'hook method' to make it work in .NET.
Code:
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As delWindowProc) As Integer
Private Delegate Function delWindowProc(ByVal hwnd As Integer, ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private lpPrevWndProc As Integer
Public Sub New()
Dim procAddress As delWindowProc = AddressOf WindowProc
lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, procAddress)
End Sub
Public Function WindowProc(ByVal hwnd As Integer, ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
If uMsg = ..... Then
Return CallWindowProc(lpPrevWndProc, hwnd, WM_CANCELMODE, wParam, lParam)
Else
Return CallWindowProc(lpPrevWndProc, hwnd, uMsg, wParam, lParam)
End If
End Function
everything is working now, but only at certain windows. i can only subclass windows from the process where my program is located. this is what i conclude from the following helpmessage:
SetWindowLong:
GWL_WNDPROC: Sets a new address for the window procedure.
Windows NT/2000/XP: You cannot change this attribute if the window does not belong to the same process as the calling thread.
now all the fun of subclassing is gone. how can I make it work on other windows?
Thanks,
-
Sep 28th, 2004, 01:58 PM
#2
yay gay
It's quite complicated to do what you want in c++, in VB.NET it's even worse
Search about Dll Injection
\m/  \m/
-
Oct 3rd, 2011, 02:04 PM
#3
Re: Subclassing window in other process (winXP)
Here is a method of "subclassing" external process windows. It was written for VB6, and then converted to VB.NET. It relies on a dll written in C++ that is supplied in both source code and compiled.
http://www.vbforums.com/showthread.p...51#post2383351
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|