get default printer name
-
hi i like to get the default printer name on windowsNT/2000/xp systems. how can i acheive it actually i am using EnumPrinters() like below "EnumPrinters(PRINTER_ENUM_DEFAULT,NULL,5,(LPBYTE)pinfo5,dwBytesNeeded,&dwBytesNeeded,&dwReturned);" but the above function is working on win95/98 its not supporting please help how can i achieve. thank you from venu
-
hi i like to get the default printer name on windowsNT/2000/xp systems. how can i acheive it actually i am using EnumPrinters() like below "EnumPrinters(PRINTER_ENUM_DEFAULT,NULL,5,(LPBYTE)pinfo5,dwBytesNeeded,&dwBytesNeeded,&dwReturned);" but the above function is working on win95/98 its not supporting please help how can i achieve. thank you from venu
I think in 95/98/Me, you have to monkey with the WIN.INI file to get the info you need. Try something like this: TCHAR buffer[MAX_PATH]; ::GetProfileString("Windows", "device", "", buffer, MAX_PATH); (Look up GetProfileString on MSDN for more info.) The printer info should be in that buffer, although I think it also contains some additional stuff (like the port name) so you may have to parse it a little. Hope this gets you on the right track. Even a broken clock is right twice a day.
-
hi i like to get the default printer name on windowsNT/2000/xp systems. how can i acheive it actually i am using EnumPrinters() like below "EnumPrinters(PRINTER_ENUM_DEFAULT,NULL,5,(LPBYTE)pinfo5,dwBytesNeeded,&dwBytesNeeded,&dwReturned);" but the above function is working on win95/98 its not supporting please help how can i achieve. thank you from venu
Look up the ::PrintDlg Win 32 API Function. There is a flag you can set to retrieve the default information. If you are using MFC, CPrintDlg offers the same functionality. You can get the information without displaying the dialog in either case.