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 / C++ / MFC
  4. Add an event on runtime

Add an event on runtime

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
5 Posts 3 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.
  • C Offline
    C Offline
    clint1982
    wrote on last edited by
    #1

    Hello I am working with MFC. I am loading an external DLL using LoadLibrary and call a function within this DLL. This function opens a dialog box and this dialog box has several controls. I have the HWND and ids of the dialog box and controls. I want to register to the getFocus event of one of the controls (On runtime). I was looking for a long time and couldn't find any helpful function or example, could any one help ?

    T C 2 Replies Last reply
    0
    • C clint1982

      Hello I am working with MFC. I am loading an external DLL using LoadLibrary and call a function within this DLL. This function opens a dialog box and this dialog box has several controls. I have the HWND and ids of the dialog box and controls. I want to register to the getFocus event of one of the controls (On runtime). I was looking for a long time and couldn't find any helpful function or example, could any one help ?

      T Offline
      T Offline
      theCPkid
      wrote on last edited by
      #2

      what are you exactly trying to achieve by registering for onfocus()? afaik every control is derived from CWnd and every CWnd receives a WM_SET_FOCUS event when it receives a focus. if your control is child of dialog and you dont want to override the default class of control, then maybe you need to check whether your dialog received the WM_SET_FOCUS when one of its child gets the focus as a dialog can never have focus - only its child can have focus. And if you can get the setfocus function call, you can easily signal your main application from the dll.. or not??

      C 1 Reply Last reply
      0
      • T theCPkid

        what are you exactly trying to achieve by registering for onfocus()? afaik every control is derived from CWnd and every CWnd receives a WM_SET_FOCUS event when it receives a focus. if your control is child of dialog and you dont want to override the default class of control, then maybe you need to check whether your dialog received the WM_SET_FOCUS when one of its child gets the focus as a dialog can never have focus - only its child can have focus. And if you can get the setfocus function call, you can easily signal your main application from the dll.. or not??

        C Offline
        C Offline
        clint1982
        wrote on last edited by
        #3

        There is the login dll of windows GinaDLL.dll In this DLL there is a function that opens a dialog box for entering the login username and password. I want to use the functionallity of this DLL and not override the whole DLL. I want to know when the user is typing in the username edit box and when he is typing in the password edit box. Since this is an external dll, I can't use the DECLARE_MESSAGE_MAP, BEGIN_MESSAGE_MAP and END_MESSAGE_MAP macros.

        T 1 Reply Last reply
        0
        • C clint1982

          There is the login dll of windows GinaDLL.dll In this DLL there is a function that opens a dialog box for entering the login username and password. I want to use the functionallity of this DLL and not override the whole DLL. I want to know when the user is typing in the username edit box and when he is typing in the password edit box. Since this is an external dll, I can't use the DECLARE_MESSAGE_MAP, BEGIN_MESSAGE_MAP and END_MESSAGE_MAP macros.

          T Offline
          T Offline
          theCPkid
          wrote on last edited by
          #4

          check if http://msdn.microsoft.com/en-us/library/aa374744(VS.85).aspx or Hooks and DLLs are of any use to you. Hooking msgina.dll will not be that easy and I dont know if there's any other way of doing this.

          1 Reply Last reply
          0
          • C clint1982

            Hello I am working with MFC. I am loading an external DLL using LoadLibrary and call a function within this DLL. This function opens a dialog box and this dialog box has several controls. I have the HWND and ids of the dialog box and controls. I want to register to the getFocus event of one of the controls (On runtime). I was looking for a long time and couldn't find any helpful function or example, could any one help ?

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #5

            You may go through subclassing, see, for instance [^]. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            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