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. Registry Notifier into a deskband?

Registry Notifier into a deskband?

Scheduled Pinned Locked Moved C / C++ / MFC
helpwindows-admintutorialquestion
4 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.
  • M Offline
    M Offline
    Matthew Devine
    wrote on last edited by
    #1

    Alright I got the following code from on here to be able to notify when a registry key has been modified. The only problem is, I can't figure out how to implement this code into the DLL that I'm creating that will be used in an IE deskband. The problem I'm running into is that if I make it sychronous it will noticebly hang in IE while it waits for the Reg Key to change. Any ideas wouldn't be helpful. #include <tchar.h> #include <windows.h> INT WINAPI _tWinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nCmdShow ) { LONG l = 0L; HKEY hKey = {0}; l = RegOpenKeyEx ( HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), 0, KEY_NOTIFY, &hKey ); if(l == ERROR_SUCCESS) { // The following call will wait until a change is made to the registry key. l = RegNotifyChangeKeyValue ( hKey, FALSE, REG_NOTIFY_CHANGE_LAST_SET, NULL, FALSE ); MessageBox(NULL, _T("Registry key changed"), _T("Registry key changed"), 0); RegCloseKey(hKey); } return 0; }

    C 1 Reply Last reply
    0
    • M Matthew Devine

      Alright I got the following code from on here to be able to notify when a registry key has been modified. The only problem is, I can't figure out how to implement this code into the DLL that I'm creating that will be used in an IE deskband. The problem I'm running into is that if I make it sychronous it will noticebly hang in IE while it waits for the Reg Key to change. Any ideas wouldn't be helpful. #include <tchar.h> #include <windows.h> INT WINAPI _tWinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nCmdShow ) { LONG l = 0L; HKEY hKey = {0}; l = RegOpenKeyEx ( HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), 0, KEY_NOTIFY, &hKey ); if(l == ERROR_SUCCESS) { // The following call will wait until a change is made to the registry key. l = RegNotifyChangeKeyValue ( hKey, FALSE, REG_NOTIFY_CHANGE_LAST_SET, NULL, FALSE ); MessageBox(NULL, _T("Registry key changed"), _T("Registry key changed"), 0); RegCloseKey(hKey); } return 0; }

      C Offline
      C Offline
      CodeBeetle
      wrote on last edited by
      #2

      try putting that bit of code in a seperate thread, using the CreateThread function. Call create thread from the entry point.


      CodeBeetle.Com


      M 1 Reply Last reply
      0
      • C CodeBeetle

        try putting that bit of code in a seperate thread, using the CreateThread function. Call create thread from the entry point.


        CodeBeetle.Com


        M Offline
        M Offline
        Matthew Devine
        wrote on last edited by
        #3

        So you are saying I should call create thread from where I load the DLL file? And this will in turn always be activated, thus responding everytime the said regirsty key is changed. I'm alittle new at programming C++, sorry. Appreciate the help.

        C 1 Reply Last reply
        0
        • M Matthew Devine

          So you are saying I should call create thread from where I load the DLL file? And this will in turn always be activated, thus responding everytime the said regirsty key is changed. I'm alittle new at programming C++, sorry. Appreciate the help.

          C Offline
          C Offline
          CodeBeetle
          wrote on last edited by
          #4

          yes thats exactly wot i mean. but don't create it in DllMain. create it in the function in your dll that is called. goto msdn.com and familiarise urself with creating thread, cos thats one of the things c++ does best, and is always useful.


          CodeBeetle.Com


          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