The same way you open the other ones, but you have to be granted access permission form the owner of the object, in this case the printer.
In other words, a network administrator needs to grant the MachineName\Administrator account privileges to modify the printer.
Also, you could try different access permission request, instead of ALL_ACCESS try something like 'read' access rights on the OpenPrinter command, that might work, since you are perhaps not trying to change anything.
Most people seem to go for ALL_ACCESS when they only want to query a device. Opening for read only access often works where 'all access' or 'write access' requests fail.
You could post the code for your OpenPrinter command and me or someone here could try to help you out.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
Im populating the CCombox on OnInitDialog.
How to put color on each item text so when the user click the combobox, it will list the items in color (i.e. half of the list is red and half of the list is blue)
I have been programming windows using C++ since a year, but havent done any UI programming. Now I need to get into UI development, I would like to know of any introductory articles in this area. I have not used MFC before, and would like to stay away from it if possible. Can people suggest any URLs on UI development using C++ that can get me started?
Why don't you try working on SDK.
This is a slow process for developing an application , on the other hand if you use MFC you can speed up application development. You can read the code from this site for developing SDK applications
Vision is Always important and so is your ATTITUDE.
If you right click the CD/DVD-ROM, it will show a menu, and one of its menuitem is "eject". As everyone know that all menuitem have an ID, but after tracing the code, I found that the ID of "eject" can be 31014(normal),
30757(folder view), 47(tree view while using folder mode), 31078(short cut),
102(quick launch view), 38(tree view in the application of winrar), 39(create toolbar on taskbar). And i don't if this menuitem ID have other value. Could somebody help me? How to compute the ID or how many ID are there leave for this menuitem of "eject"??
I want to control the flow of eject action! when user click eject, it will get into my code, then i can control it.So i must modify the menuitem, there are two flag can be used, MF_POSITION and MF_COMMAND, it seems that is impossible to get the position of eject, so i choose MF_COMMAND, but i have to get the ID.
It seems to be impossible. How I told you before: every application can use its own ID for the eject command. The usage of a command is hard encoded in its program-code. Therefore its no way to find out which command executes the eject function.
The other post told you about the WM_DEVICECHANGE message - but this is only a notification message broadcasting to all toplevel windows. This message informs all windows that a device has been changed (see Windows-SDK for help).
I've just tested the WM_DEVICECHANGE: the message is called after the media has been removed.
#include <DBT.H><br />
void CFrame::WmDeviceChange(WPARAM w,LPARAM l)<br />
case DBT_CONFIGCHANGECANCELED:<br />
case DBT_CONFIGCHANGED:<br />
case DBT_DEVICEARRIVAL:<br />
case DBT_DEVICEQUERYREMOVE:<br />
case DBT_DEVICEQUERYREMOVEFAILED:<br />
case DBT_DEVICEREMOVECOMPLETE:<br />
// here is the debug trap after the media has been removed<br />// no other event came up before or after eject the media<br />break;<br />
case DBT_DEVICEREMOVEPENDING:<br />
case DBT_DEVICETYPESPECIFIC:<br />
case DBT_USERDEFINED:<br />
TRACE("WmDeviceChange: 0x%04X\r\n",w);<br />
Thanks for all of your help!
My code is using shell programming! So all code are handled in this function:
HRESULT CXXXXXXXXX::QueryContextMenu ( HMENU hmenu, UINT uMenuIndex,
UINT uidFirstCmd, UINT uidLastCmd,
UINT uFlags )
I don't know how to associate the upper code with the message WM_DEVICECHANGE, could you help?