Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Read WndProc of other windows

Read WndProc of other windows

Scheduled Pinned Locked Moved C#
questiontutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tony Pottier
    wrote on last edited by
    #1

    Hello, I'm writing a program that needs to know when a user do things to windows of another process (activate, drag/drop, whatever). I think I'd need to read the WndProc function of those windows, but how do I achieve that? Also, how to notify my program in case some specific messages happens? For instance, if WM_ACTIVATE is sent to the window of another program, how can it triggers some function in my program? Any lead is appreciated :p Regards, Tony

    M 1 Reply Last reply
    0
    • T Tony Pottier

      Hello, I'm writing a program that needs to know when a user do things to windows of another process (activate, drag/drop, whatever). I think I'd need to read the WndProc function of those windows, but how do I achieve that? Also, how to notify my program in case some specific messages happens? For instance, if WM_ACTIVATE is sent to the window of another program, how can it triggers some function in my program? Any lead is appreciated :p Regards, Tony

      M Offline
      M Offline
      Marcelo Emmerich
      wrote on last edited by
      #2

      Tony_P, this can be accomplished by doing the following: - get the HWND of the application's window you want to hook to - use GetWindowLong to get the windows WndProc and store it - create a WndProc method in your app - use SetWindowLong to inject your Wndproc into the other window - after doing what you want in *your* WndProc, use CallWindowProc to pass control to the windows original WndProc (you stored it previously) Please bear in mind that this is not possible in .NET without using DllImport to coredll.dll in order to have access to certain Win32 functions like SetWindowLong, GetWindowLong, GetWindow, CallWindowProc, etc. Hope this helps. Marcelo

      -- Marcelo Emmerich Software Development - Computer Graphics - Mobile Computing http://bytethings.blogspot.com

      T 1 Reply Last reply
      0
      • M Marcelo Emmerich

        Tony_P, this can be accomplished by doing the following: - get the HWND of the application's window you want to hook to - use GetWindowLong to get the windows WndProc and store it - create a WndProc method in your app - use SetWindowLong to inject your Wndproc into the other window - after doing what you want in *your* WndProc, use CallWindowProc to pass control to the windows original WndProc (you stored it previously) Please bear in mind that this is not possible in .NET without using DllImport to coredll.dll in order to have access to certain Win32 functions like SetWindowLong, GetWindowLong, GetWindow, CallWindowProc, etc. Hope this helps. Marcelo

        -- Marcelo Emmerich Software Development - Computer Graphics - Mobile Computing http://bytethings.blogspot.com

        T Offline
        T Offline
        Tony Pottier
        wrote on last edited by
        #3

        I see. Don't worry I've already worked with DLLImports of the win32 api. Thank you!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups