reklama - zainteresowany?

Subclassing and Hooking with Visual Basic - Helion

Subclassing and Hooking with Visual Basic
ebook
Autor: Stephen Teilhet
ISBN: 978-14-919-3268-1
stron: 706, Format: ebook
Data wydania: 2001-06-15
Księgarnia: Helion

Cena książki: 177,65 zł (poprzednio: 206,57 zł)
Oszczędzasz: 14% (-28,92 zł)

Dodaj do koszyka Subclassing and Hooking with Visual Basic

Tagi: Visual Basic - Programowanie

Subclassing & Hooking with Visual Basic offers developers a unique way to customize Windows behavior.Windows is a message-based system. Every action you request creates one or more messages to carry out the action. These messages are passed between objects and carry with them information that gives the recipient more detail on how to interpret and act upon the message.With Subclassing and the Windows hooking mechanism ("hooks"), you can manipulate, modify, or even discard messages bound for other objects within the operating system, in the process changing the way the system behaves. What kinds of results can you achieve using the power of subclassing and hooking? Here are just a few of the possibilities:

  • Determine when a window is being activated or deactivated and respond to this change.
  • Display descriptions of menu items as the mouse moves across them.
  • Disallow a user to move or resize a window.
  • Determine where the mouse cursor is and respond accordingly.
  • Determine when the display resolution has been changed.
  • Monitor the system for a low system resource condition.
  • Modify or disallow keystrokes sent to a window or a control.
  • Create an automated testing application.
  • Determine when an application is idle.
Along with this power comes responsibility; Windows is very unforgiving if subclassing and hooking are used incorrectly. Subclassing & Hooking with Visual Basic demonstrates the various techniques for intercepting messages bound for one or more windows or controls: the intercepted message can be left in its original state or modified; afterwards, the message can be sent to its original destination or discarded.For both VB 6 and VB.NET developers, Subclassing & Hooking with Visual Basic opens up a wealth of possibilities that ordinarily would be completely unavailable, or at least not easy to implement.

Dodaj do koszyka Subclassing and Hooking with Visual Basic

 

Osoby które kupowały "Subclassing and Hooking with Visual Basic", wybierały także:

  • Visual Basic 2008. Warsztat programisty
  • Visual Basic 2010. Od podstaw
  • ASP.NET 4 z wykorzystaniem C# i VB. Zaawansowane programowanie
  • Programowanie dla poczÄ…tkujÄ…cych w 24 godziny. Wydanie IV
  • Zrozumieć Excela. VBA - makra i funkcje

Dodaj do koszyka Subclassing and Hooking with Visual Basic

Spis treści

Subclassing and Hooking with Visual Basic eBook -- spis treści

  • Subclassing and Hooking with Visual Basic
  • A Note Regarding Supplemental Files
  • Preface
    • Who This Book Is For
    • How This Book Is Structured
    • Obtaining the Sample Code
    • Conventions Used in This Book
    • How to Contact Us
    • Acknowledgments
  • I. Introducing Subclassing and Hooking
    • 1. Introduction
      • Subclassing
      • The Window Hooking Mechanism
      • Tools to Aid Us in Our Efforts
        • Spy++
          • Using Spy++ to examine a VB application
        • NuMega SmartCheck
        • Dbgwproc.dll
        • Microsoft System Information
      • A Word of Warning
    • 2. Windows System-Specific Information
      • Inside a Windows Application
        • Window Relationships
        • What Are All These Handles For?
          • hWnd
          • hInstance
          • hHook
        • Processes
        • Threads
        • The Internals of a Window
          • The window class
          • The window procedure
          • Creating a simple window application with Visual C++
      • Inside the Windows Messaging System
        • The Raw Input Thread
        • The System Message Queue
        • Thread Message Queues
        • Message Loops
        • Messages
        • The Different Types of Messages
      • Performance Considerations
    • 3. The Basics of Subclassing and Hooks
      • What Is Subclassing?
        • How Does Subclassing Work?
        • The Types of Subclassing
          • Instance subclassing
          • Global subclassing
          • Superclassing
        • Why Do We Use Subclassing?
      • What Are Hooks?
        • How Do Hooks Work?
        • Hook Scope
          • Thread-specific
          • System-wide
        • Why Do We Use Hooks?
        • Deciding Between Hooking or Subclassing
  • II. Subclassing and Superclassing
    • 4. Subclassing
      • The AddressOf Operator
        • Using AddressOf
        • Callbacks and Enumeration Functions
        • Callbacks and Asynchronous Processing
        • AddressOf and Subclassing
      • Some Subclassing Tips
      • Instance Subclassing: An Example
        • The Class Module
        • The BAS Module
        • The Form Module
        • Doing Something Interesting
          • Overriding window resizing
          • Overriding a windows minimize behavior
      • Global Subclassing
        • Changes to the Class
        • Changes to the BAS Module
        • Changes to the Form
        • How It All Works
        • Behind the Scenes with Spy++
      • Summary of Key Points in Subclassing
    • 5. Subclassing the Windows Common Dialog Boxes
      • How Common Dialog BoxSubclassing Works
        • Using the COMDLG32.DLL
        • The Resource File
        • Creating a Dialog Resource File UsingVB and Visual C++
        • Manipulating Control Placement on the Dialog
      • Using the Resource
        • Embedding the Resource in the EXE
        • Using a Resource in a DLL
          • Creating a Visual C++ resource DLL
          • Creating a VB resource DLL
      • Creating the Subclassing Application
        • The Code Behind the frmMain.frm Module
        • The Code Behind the Module1.bas Module
          • The dialog creation structure
          • The code for the Module1.bas module
          • The dialog hook procedure
          • Dialog initialization
          • Processing dialog box notification messages
          • Processing messages from the controls on the child dialog box
          • Processing the dialog shutdown messages
          • Default message processing
      • Subclassing Common Dialog Boxes Other Than Open and Save As
        • The Dialog Template Resource
          • Creating a dialog resource file
          • The Color common dialog
          • The Font common dialog
          • The Print common dialog
          • The Page Setup common dialog
          • The Print Property Sheet common dialog
          • The Find common dialog
          • The Replace common dialog
        • Receiving Notification and Control Messagesfrom the Dialog
      • Problems Subclassing the Find and Replace Common Dialogs
    • 6. ActiveX Controls and Subclassing
      • Subclassing a Third-PartyActiveX Control
      • Subclassing an ActiveX ControlCreated in VB
        • Creating the Control
        • Creating the Project to Subclass the Control
      • Subclassing a UserControl from Within a VB-Created ActiveX Control
        • Creating the Control
          • The UserControl module
          • The Module1.bas module
        • Hosting the Control
      • Creating an ActiveX Control That Subclasses Other Windows
        • Creating the First Version of the Control
        • Creating the Second Version of the Control
        • Creating the Third Version of the Control
    • 7. Superclassing
      • What Is Superclassing?
        • Similarities and Differences Between Subclassing and Superclassing
        • When to Use Superclassing
      • How the Superclassing Example Works
        • The Code
          • The module-level declarations
          • The Sub Main procedure
          • Message loop operation
          • Class creation
          • Window creation
          • The superclass procedures
      • Peering into the Superclassing Application with Spy++
    • 8. Debugging Techniques for Subclassing
      • Where to Start
        • Subclassing Checklist
        • Stepping Through the Application
        • Log Files
      • Microsoft Tools
        • Spy++
        • DBGWPROC.DLL
      • NuMegas SmartCheck
  • III. Hooking
    • 9. WH_CALLWNDPROC
      • How WH_CALLWNDPROC Works
        • Filter Function Definition
        • Location of This Hook in the System
      • A Thread-Specific Example
      • Caveats
    • 10. WH_CALLWNDPROCRET
      • How WH_CALLWNDPROCRET Works
        • Filter Function Definition
        • Location of This Hook in the System
      • A Thread-Specific Example
      • Caveats
    • 11. WH_GETMESSAGE
      • How WH_GETMESSAGE Works
        • Filter Function Definition
        • Location of This Hook in the System
      • A Thread-Specific Example
        • Other Uses of This Hook
      • Caveats
    • 12. WH_KEYBOARD and WH_KEYBOARD_LL
      • How Keyboard Messaging Operates
      • Description of Hooks
        • Filter Function Definitions
        • Explanation of Hook Codes
        • Location of This Hook in the System
      • A Thread-Specific Example
      • A System-Wide Example
      • A Low-Level Hook Example
      • Caveats
    • 13. WH_MOUSE and WH_MOUSE_LL
      • How Mouse Messaging Operates
        • The Mouse Capture
        • Mouse Click Messages
      • Description of Hooks
        • Filter Function Definitions
        • Explanation of Hook Codes
      • Location of This Hook in the System
      • A Single-Thread Example
      • A System-Wide Hook Example
        • Low-Level Mouse Hook Example
      • Caveats
    • 14. WH_FOREGROUNDIDLE
      • Description
      • Location of This Hook in the System
      • Background Processing Example
      • Caveats
    • 15. WH_MSGFILTER
      • Description
        • The Modal Loop
        • Filter Function Definition
        • Explanation of Hook Codes
        • Location of This Hook in the System
      • A Thread-Specific Example
      • Caveats
    • 16. WH_SYSMSGFILTER
      • Description
        • Filter Function Definition
        • Explanation of Hook Codes
        • Location of This Hook in the System
      • A System-Wide Example
      • Caveats
    • 17. WH_SHELL
      • Description
        • Filter Function Definition
        • Explanation of Hook Codes
      • Location of This Hook in the System
      • A Thread-Specific Example
        • Using the Application
        • The Code
      • Caveats
    • 18. WH_CBT
      • Description
        • Filter Function Definition
        • Explanation of Hook Codes
        • Comparing WH_SHELL to WH_CBT
      • A Thread-Specific Example
        • Using the WH_JOURNALPLAYBACK Hookwith a CBT
      • Caveats
    • 19. WH_JOURNALRECORD
      • Description
        • Stopping This Hook
        • Explanation of Hook Codes
        • Location of This Hook in the System
      • The Macro Recorder Example
      • Caveats
    • 20. WH_JOURNALPLAYBACK
      • Description
        • Explanation of Hook Codes
        • Location of This Hook in the System
      • The Macro Recorder/Playback Example
      • Caveats
    • 21. WH_DEBUG
      • Description
        • Filter Function Definition
        • Explanation of Hook Codes
      • A Thread-Specific Example
      • Some WH_DEBUG Scenarios
        • Problem: Misbehaving System-Wide Hook
        • Problem: Determining if Hooks Are Interfering with Each Other
        • Problem: Performance Degradation
      • Caveats
  • IV. The .NET Platform
    • 22. Subclassing .NET WinForms
      • What Is a WinForm?
        • Using a WinForm
      • Instance Subclassing
        • Technique #1: Overriding the WinProc Method
          • The application
          • The .VB file
        • Technique #2: Binding to a NativeWindow Class Instance
          • The application
          • The .VB file
        • Technique #3: The IMessageFilter Interface
          • The application
          • The .VB file
      • Subclassing a Control
        • The application
          • The .VB file
      • Superclassing
        • The application
          • The .VB file
      • Superclassing a Control
        • The application
          • The .VB file
      • Intercepting Keystrokes in a WinForm
        • The application
          • The .VB file
      • Behind the Scenes with Spy++
    • 23. Implementing Hooks in VB.NET
      • Hooks and VB.NET
      • Delegates
        • A Simple Example Using Delegates
      • Implementing the WH_KEYBOARD Hook
        • The Application
        • The .VB File
      • Implementing the WH_MOUSE Hook
        • The Application
        • The .VB File
  • V. Appendixes
    • A. Messages
      • Window Messages
        • Public Const WM_NULL = &H0
        • Public Const WM_CREATE = &H1
        • Public Const WM_DESTROY = &H2
        • Public Const WM_MOVE = &H3
        • Public Const WM_SIZE = &H5
        • Public Const WM_ACTIVATE = &H6
        • Public Const WM_SETFOCUS = &H7
        • Public Const WM_KILLFOCUS = &H8
        • Public Const WM_SETTEXT = &HC
        • Public Const WM_PAINT = &HF
        • Public Const WM_QUIT = &H12
        • Public Const WM_ERASEBKGND = &H14
        • Public Const WM_SHOWWINDOW = &H18
        • Public Const WM_SETCURSOR = &H20
        • Public Const WM_QUEUESYNC = &H23
        • Public Const WM_GETMINMAXINFO = &H24
        • Public Const WM_WINDOWPOSCHANGING = &H46
        • Public Const WM_WINDOWPOSCHANGED = &H47
        • Public Const WM_CANCELJOURNAL = &H4B
        • Public Const WM_NCCREATE = &H81
        • Public Const WM_NCDESTROY = &H82
        • Public Const WM_NCCALCSIZE = &H83
        • Public Const WM_NCHITTEST = &H84
        • Public Const WM_NCPAINT = &H85
        • Public Const WM_NCACTIVATE = &H86
        • Public Const WM_GETDLGCODE = &H87
        • Public Const WM_NCMOUSEMOVE = &HA0
        • Public Const WM_NCLBUTTONDOWN = &HA1
        • Public Const WM_NCLBUTTONUP = &HA2
        • Public Const WM_NCLBUTTONDBLCLK = &HA3
        • Public Const WM_NCRBUTTONDOWN = &HA4
        • Public Const WM_NCRBUTTONUP = &HA5
        • Public Const WM_NCRBUTTONDBLCLK = &HA6
        • Public Const WM_NCMBUTTONDOWN = &HA7
        • Public Const WM_NCMBUTTONUP = &HA8
        • Public Const WM_NCMBUTTONDBLCLK = &HA9
        • Public Const WM_NCXBUTTONDOWN = &HAB
        • Public Const WM_NCXBUTTONUP = &HAC
        • Public Const WM_NCXBUTTONDBLCLK = &HAD
        • Public Const WM_KEYDOWN = &H100
        • Public Const WM_KEYUP = &H101
        • Public Const WM_CHAR = &H102
        • Public Const WM_SYSKEYDOWN = &H104
        • Public Const WM_SYSKEYUP = &H105
        • Public Const WM_SYSCHAR = &H106
        • Public Const WM_INITDIALOG = &H110
        • Public Const WM_COMMAND = &H111
        • Public Const WM_SYSCOMMAND = &H112
        • Public Const WM_ENTERIDLE = &H121
        • Public Const WM_CTLCOLOREDIT = &H133
        • Public Const WM_CTLCOLORLISTBOX = &H134
        • Public Const WM_CTLCOLORBTN = &H135
        • Public Const WM_CTLCOLORDLG = &H136
        • Public Const WM_CTLCOLORSCROLLBAR = &H137
        • Public Const WM_CTLCOLORSTATIC = &H138
        • Public Const WM_MOUSEMOVE = &H200
        • Public Const WM_LBUTTONDOWN = &H201
        • Public Const WM_LBUTTONUP = &H202
        • Public Const WM_LBUTTONDBLCLK = &H203
        • Public Const WM_RBUTTONDOWN = &H204
        • Public Const WM_RBUTTONUP = &H205
        • Public Const WM_RBUTTONDBLCLK = &H206
        • Public Const WM_MBUTTONDOWN = &H207
        • Public Const WM_MBUTTONUP = &H208
        • Public Const WM_MBUTTONDBLCLK = &H209
        • Public Const WM_XBUTTONDOWN = &H20B
        • Public Const WM_XBUTTONUP = &H20C
        • Public Const WM_XBUTTONDBLCLK = &H20D
        • Public Const WM_PARENTNOTIFY = &H210
        • Public Const WM_ENTERMENULOOP = &H211
        • Public Const WM_EXITMENULOOP = &H212
        • Public Const WM_SIZING = &H214
        • Public Const WM_CAPTURECHANGED = &H215
        • Public Const WM_MOVING = &H216
        • Public Const WM_ENTERSIZEMOVE = &H231
        • Public Const WM_EXITSIZEMOVE = &H232
        • Public Const WM_HOTKEY = &H312
      • Button Control-Specific Messages
        • Public Const BM_GETCHECK = &HF0
        • Public Const BM_SETCHECK = &HF1
        • Public Const BM_CLICK = &HF5
      • Combo Box-Specific Messages
        • Public Const CB_ADDSTRING = &H143
        • Public Const CB_DELETESTRING = &H144
        • Public Const CB_GETCOUNT = &H146
        • Public Const CB_GETCURSEL = &H147
      • Edit Control-Specific Messages
        • Public Const EM_GETLINE = &HC4
        • Public Const EM_CANUNDO = &HC6
        • Public Const EM_UNDO = &HC7
      • Listbox-Specific Messages
        • Public Const LB_ADDSTRING = &H180
        • Public Const LB_DELETESTRING = &H182
        • Public Const LB_SETSEL = &H185
        • Public Const LB_GETSEL = &H187
      • Scroll Bar-Specific Messages
        • Public Const SBM_SETPOS = &HE0
        • Public Const SBM_GETPOS = &HE1
        • Public Const SBM_SETRANGE = &HE2
        • Public Const SBM_GETRANGE = &HE3
      • Messages Specific to the CommonDialog Boxes
        • Public Const CDM_GETFILEPATH = (CDM_FIRST + &H1)
        • Public Const CDM_GETFOLDERPATH = (CDM_FIRST + &H2)
        • Public Const CDM_GETSPEC = (CDM_FIRST + &H0)
        • Public Const CDM_HIDECONTROL = (CDM_FIRST + &H5)
        • Public Const CDM_SETCONTROLTEXT = (CDM_FIRST + &H4)
        • Public Const CDM_SETDEFEXT = (CDM_FIRST + &H6)
      • Messages Specific to the Font Common Dialog Box
        • Public Const WM_CHOOSEFONT_GETLOGFONT = _USER + 1)
        • Public Const WM_CHOOSEFONT_SETLOGFONT = (WM_USER + 101)
        • Public Const WM_CHOOSEFONT_SETFLAGS = (WM_USER + 102)
      • Messages Specific to the Page Setup Common Dialog Box
        • Public Const WM_PSD_PAGESETUPDLG = (WM_USER)
        • Public Const WM_PSD_FULLPAGERECT = (WM_USER+1)
        • Public Const WM_PSD_MINMARGINRECT = (WM_USER+2)
        • Public Const WM_PSD_MARGINRECT = (WM_USER+3)
        • Public Const WM_PSD_ENVSTAMPRECT = (WM_USER+5)
        • Public Const WM_PSD_FULLPAGERECT = (WM_USER+6)
    • B. API Functions
      • AttachThreadInput
      • BroadcastSystemMessage
      • CallNextHookEx
      • CallWindowProc
      • ChooseColor
      • ChooseFont
      • CopyMemory
      • CreateWindowEx
      • DefWindowProc
      • EnumChildWindows
      • FindText
      • FindWindow
      • FindWindowEx
      • GetClassInfoEx
      • GetDeskTopWindow
      • GetDlgItem
      • GetMessage
      • GetParent
      • GetSaveFileName
      • GetWindow
      • GetWindowLong
      • GetWindowRect
      • OutputDebugStringA
      • PageSetupDlg
      • PeekMessage
      • PostMessage
      • PostQuitMessage
      • PostThreadMessage
      • PrintDlg
      • PrintDlgEx
      • RegisterClassEx
      • RegisterWindowMessage
      • ReleaseCapture
      • ReplaceText
      • SendDlgItemMessage
      • SendMessage
      • SendMessageCallback
      • SendMessageTimeout
      • SendNotifyMessage
      • SetCapture
      • SetClassLongPtr
      • SetWindowLongPtr
      • SetWindowPos
      • SetWindowsHookEx
      • ShowWindow
      • UnhookWindowsHookEx
      • UnregisterClass
    • C. Structures and Constants
      • CBT_CREATEWND
        • CBT_CREATEWND
      • CBTACTIVATESTRUCT
        • CBTACTIVATESTRUCT
      • CHOOSECOLOR
        • CHOOSECOLOR
      • CHOOSEFONT
        • CHOOSEFONT
      • CWPRETSTRUCT
        • CWPRETSTRUCT
      • CWPSTRUCT
        • CWPSTRUCT
      • DEBUGHOOKINFO
        • DEBUGHOOKINFO
      • EVENTMSG
        • EVENTMSG
      • FINDREPLACE
        • FINDREPLACE
      • KBDLLHOOKSTRUCT
        • KBDLLHOOKSTRUCT
      • MOUSEHOOKSTRUCT
        • MOUSEHOOKSTRUCT
      • MOUSEHOOKSTRUCTEX
        • MOUSEHOOKSTRUCTEX
      • MSG
        • MSG
      • MSLLHOOKSTRUCT
        • MSLLHOOKSTRUCT
      • NMHDR
        • NMHDR
      • OPENFILENAME
        • OPENFILENAME
      • PAGESETUPDLG
        • PAGESETUPDLG
      • POINTAPI
        • POINTAPI
      • PRINTDLG
        • PRINTDLG
      • PRINTDLGEX
        • PRINTDLGEX
      • RECT
        • RECT
      • WNDCLASSEX
        • WNDCLASSEX
      • Message (.NET Structure)
        • Message (.NET Structure)
      • Constants
        • BroadcastSystemMessage Function Masks
        • Common Dialog Box Error Messages
        • Common Dialog Box Notification Messages
        • Class Styles
        • Edit Control Notification Codes
        • Extended Window Styles
        • GetClassLongPtr Function Constants
        • GetWindow API Function Constants
        • GetWindowLongPtr Function Constants
        • Hook Codes
          • General
          • Computer-based training (CBT) hook codes
          • WH_MSGFILTER hook codes
          • WH_SHELL hook codes
        • HSHELL_ACCESSIBILITYSTATE Constants
        • Key State Masks for Mouse Messages
        • Low-Level Hook Constants
        • Mouse Wheel Constant
        • Open and Save As Common Dialog BoxNotification Codes
        • PeekMessage Function Options
        • PostMessage and SendMessage Function Constants
        • Predefined Control ID Values for the Open andSave As Common Dialog Boxes
        • SendMessageTimeout API Function Constants
        • SetWindowLongPtr/GetWindowLongPtr Function Constants
        • SetWindowPos Function Constants
        • ShowWindow Function Constants
        • User Button Notification Codes
        • Virtual Key Codes
        • Window Hook Constants
        • Window Styles
        • WM_KEYUP, WM_DOWN, andWM_CHAR lParam HIWORD Flags
        • WM_NCHITTEST Codes
        • WH_SHELL Codes for the HSHELL_APPCOMMAND Hook Code
        • WM_SIZE Message wParam Values
        • WM_SYSCOMMAND Message wParam Constants
        • XButton Constants
  • Index
  • About the Author
  • Colophon
  • Copyright

Dodaj do koszyka Subclassing and Hooking with Visual Basic

Code, Publish & WebDesing by CATALIST.com.pl



(c) 2005-2024 CATALIST agencja interaktywna, znaki firmowe należą do wydawnictwa Helion S.A.