The following works on Windoze 98 and bombs on Windoze XP.
It crashes either on the last EnumPrinters or the CreateDC.
Could it possibly have something to do with DLLs - mine from 1999 to
the computer that I tested it from 2002????
Thanks for any help,
JPS
It crashes either on the last EnumPrinters or the CreateDC.
Could it possibly have something to do with DLLs - mine from 1999 to
the computer that I tested it from 2002????
.data
dwNeeded dd 0
dwReturned dd 0
pinf05 dd 0
WndProc PROC hWnd:HWND, iMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL hdc: HDC, cc: codecode, hInst: HINSTANCE, ps:PAINTSTRUCT
LOCAL hMemory: DWORD
mov eax,iMsg
.IF eax==WM_CREATE
push ebx
invoke EnumPrinters, PRINTER_ENUM_DEFAULT, NULL, 5, NULL, \
0, ADDR dwNeeded, ADDR dwReturned
invoke GlobalAlloc, GHND, dwNeeded
mov hMemory, eax
invoke GlobalLock, eax
mov pinf05, eax
mov ebx,eax
invoke EnumPrinters, PRINTER_ENUM_DEFAULT, NULL, 5, pinf05, \
dwNeeded, ADDR dwNeeded, ADDR dwReturned
invoke CreateDC, NULL, PRINTER_INFO_5.pPrinterName[ebx], NULL, NULL
mov hdcPrn,eax
mov hdc,eax
invoke GlobalUnlock, hMemory
invoke GlobalFree, hMemory
Thanks for any help,
JPS
From MSDN:
PRINTER_ENUM_DEFAULT Windows 95/98/Me: The function returns information about the default printer.
So you'll have to enumerate different printer type on nt/2k/xp.
PRINTER_ENUM_DEFAULT Windows 95/98/Me: The function returns information about the default printer.
So you'll have to enumerate different printer type on nt/2k/xp.
Since I posted this message I have found out a few more things.
I have a copy of ENUMPRINTERS from 1999. On msdn there is a much later version
of ENUMPRINTERS which I am unable to print a copy of.
I looked at the possibility on ordering an API SDK but from what I read it implies
that it won't work on Windows 98
So from my above code it seems that I must be able to tell what operating system
I am on and then modify ENUMPRINTERS accordingly. First I don't know how to
do that and 2nd what a hassle this is.....
I have a copy of ENUMPRINTERS from 1999. On msdn there is a much later version
of ENUMPRINTERS which I am unable to print a copy of.
I looked at the possibility on ordering an API SDK but from what I read it implies
that it won't work on Windows 98
So from my above code it seems that I must be able to tell what operating system
I am on and then modify ENUMPRINTERS accordingly. First I don't know how to
do that and 2nd what a hassle this is.....