I wish to know when printer settings are changed and which printer (in a users session), in a server environment (win2k3), I know about WM_SETTINGSCHANGE but lparam seems to get only "devices" and not the printer name.
What I can do is enumarate all printers and keep track of their DEVMODE and each time the notification WM_SETTINGSCHANGE happens i will enumrate AGAIN all printers and compare with the previous list of devmodes to check if a setting has chhanged. As you can see this is very inefficient.
In your opinion are there other ways to this, at least detect from which user this change has happened, so to check only his/her printers.
I made a program that used the gethostbyname(hostname); function in MFC. it worked fine. now when i tried to do the same in a win32 project it is returning null. before this i added the header file "winsock2.h". which showed some errors as redefinition of this xxxxxxx . then i removed it and added the ws2_32.lib reference, after which, it showed no errors but at gethostbyname(hostname); function it returns NULL. have i done anything wrong ? the hostname string contains a genuine hostname. Please answer this
according to MSDN:
The selection, if any, is always shown, even if the control does not have the focus.
This is true but it isn't highlighted in blue. Nomatter where I place the SetFocus call, nothing is happening. I have tried before setting item state, after setting state, beginning and end of WM_INITDIALOG, WM_CREATE, WM_SETFOCUS, WM_IMNOTGIVINGYOUFOCUSHAHAHA. Infact the only place it is working is within WM_PAINT, but this is just wrong.
This control is on a dialog along with sevral other controls. The only other thing I can think of is to change the tab order, but still, SetFocus should be unrelated to the tabs.
When you right click a CD/DVD-ROM, windows will show a menu, and one of its menuitem is just the "Eject"! I want to control the flow of eject action,when user click the menuitem, it will go into my codes.
I use the ModifyMenu function to modify the "eject" menuitem, but how could i know if the current menuitem is "eject",just as what i want? If use the MF_BYPOSITION flag, it is impossible to get the position of the "eject" menuitem. If use MF_COMMAND, after a long trace to code, i find the ID of "eject" menuitem can be case 31014://normal
case 30757://folder view
case 47://tree view while using folder mode
case 31078://short cut
case 102:// quick launch
case 38://tree view in the application of winrar
case 39://toolbar on taskbar
I have to use a switch statement to handle the condition.
I don't konw if the "eject" ID have other value, and if i find it, i have to modify my code, it boring me so much. Could someone help me to fix this trouble? All codes are place at function
HRESULT CXXXXXX::QueryContextMenu ( HMENU hmenu, UINT uMenuIndex,
UINT uidFirstCmd, UINT uidLastCmd, UINT uFlags ).
I had an simple object by using ATL Object wizard and a generic class CTCPSocket.
The com object name is CTest and interface is ITest. This class had a interface Add and a connection point Fire_notify.
And CSocket had two methods add_in and notify.
The code as following:
//create a socket and listening
//created a tcp connectiong?
//when created a socket accept,pass the event to CTest:OnNotify()
when the client call the CTest->Add method, CTCPSocket will create a socket and listening, but the problem is: when there is a tcp connection event,how to pass the event to CTest:OnNotify() from CTCPSocket:notify()?
Assuming that you by char really mean std::string (because you're a conscious developer that avoids bald arrays and pointers if possible, right? ), then do like this:
std::string ToString(unsigned longvalue) // Put this function in your local vault.
char buffer; // '33' comes from the _ultoa documentation.return std::string(_ultoa(value, buffer, 10));