I thought this would be pretty simple, but apparently I've managed to do something wrong. I'm trying to retrieve the handle to a certain printer on the network, as shown below:
1 2 3 4 5 6
LPHANDLE p_hPrinter;
if (OpenPrinter("\\\\saturn\\PHOBOS",p_hPrinter,NULL))
MessageBox (hwnd,"Success.","",MB_OK);
else
MessageBox(hwnd,"Failure.","",MB_OK);
This fails. Yes, this is the correct location of the printer:
(\\servername\printername) \\saturn\PHOBOS
... and I believe I'm correct in using the escape characters, so what else could be incorrect here? Thanks in advance for any help.
So, I'm assuming that since I created only a pointer, but no value for it to actually point to, that the function does not actually create it if it does not exist.
So by declaring a HANDLE instead and passing by reference, the function is simply replacing the existing (but meaningless) handle value which was already initialized?
If that's the case, it makes plenty of sense, and now I'm a lot less confused about some other things as well. Thanks again.