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. device notification

device notification

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
2 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
    Manu_81
    wrote on last edited by
    #1

    Hi, In my app, I want to be notified for device changes. I tried to register for notification using RegisterDeviceNotification() function. But this function takes window handle as its first param. But my app is console app. How do I have to do this. I also wanted to receive WM_Device messages. Can I create a handle to WinMain and use RegisterDeviceNotification() and have a callback window procedure using this handle?? How to do that. How to create a handle to winmain?? If not can I create an invisible window and handle the messages. How do I create an invisible window?? Thanks a lot in advance.

    D 1 Reply Last reply
    0
    • M Manu_81

      Hi, In my app, I want to be notified for device changes. I tried to register for notification using RegisterDeviceNotification() function. But this function takes window handle as its first param. But my app is console app. How do I have to do this. I also wanted to receive WM_Device messages. Can I create a handle to WinMain and use RegisterDeviceNotification() and have a callback window procedure using this handle?? How to do that. How to create a handle to winmain?? If not can I create an invisible window and handle the messages. How do I create an invisible window?? Thanks a lot in advance.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Manu_81 wrote:

      I tried to register for notification using RegisterDeviceNotification() function. But this function takes window handle as its first param. But my app is console app.

      Which does not mean that your application cannot create a hidden window for the sole purpose of receiving notifications. This is not an uncommon form of communication between processes.


      "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

      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