Getting default printer change notification using c++ in Windows service

橙三吉。 提交于 2019-12-13 18:00:15

问题


I need to tap default printer change notification, is it possible?

My scenario is that I want to execute a command whenever default printer is changed in window. What my command does is, it just takes default printer information from registry and save it in HKLM.

So, I have a service for this. Using this service, how can i tap notifications whenever a default printer is changed. I am using C++.


回答1:


From a regular application, I would listen for a WM_SETTINGCHANGE message and then call GetDefaultPrinter to see if the default printer has actually changed.

I don't know if you can watch for that message from a service. The default printer can be a per-user setting, so your service would have to be running as that user rather than as Local System.



来源:https://stackoverflow.com/questions/13953630/getting-default-printer-change-notification-using-c-in-windows-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!