News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

printer_info_4

Started by shankle, June 21, 2012, 10:53:44 PM

Previous topic - Next topic

shankle

Having trouble with the  "CreateDC"  in GoAsm. Tried various combinations
with the square brackets but GoAsm just gives different messages about
the same thing. The CreateDC worked fine in MASM32
Any help would be appreciated

(line 67)     PRINTER_INFO_4A STRUCT 
                    pPrinterName   DD  ?
                    pServerName   DD  ?
                    Attributes         DD  ?
                  ENDS

                  PRINTER_INFO_4       equ  <PRINTER_INFO_4A>

                 dwneeded   DD 0
                 dwreturned DD 0
                 pinF04         DD 0

                 in Wndproc Local hMemory 

                 hdcPrn  HDC  ?

                 invoke  EnumPrinters, PRINTER_ENUM_LOCAL,NULL,4,NULL,0,\
                       addr dwNeeded,addr dwReturned   
                        ; Find how much memory we need (dwNeeded)
                 invoke  GlobalAlloc, GHND,[dwNeeded]
            mov [hMemory],eax

                 invoke  GlobalLock, eax
                        ; Lock the memory block & return pointer to memory
                 mov [pinf04],eax   ; Save it
                 mov ebx,eax         ; Set reg to memory
                 invoke  EnumPrinters, PRINTER_ENUM_LOCAL,NULL,4,addr pinf04,\
                                addr dwNeeded,addr dwNeeded,addr dwReturned
        
(line 1394)   invoke  CreateDC, NULL,PRINTER_INFO_4.pPrinterName[ebx],NULL,NULL
                 mov       [hdcPrn],eax
                 mov       [hdc],eax

This is the error message Generated by GoAsm:
   ERROR!
   line 1394 of assembler source file (xxx.asm):-
   data not closed with ">" operator
    in the struct at line 67 of assembler
     source file (xxx.asm)
     

wjr

This should work fine if you change your equate to:
PRINTER_INFO_4       equ  PRINTER_INFO_4A

and use the following in your call to CreateDC:
[ebx+PRINTER_INFO_4.pPrinterName]

shankle

Thank you very much for taking your time to answer my question WJR.

Will be posting one about "DWTOA" from the MASM32 forum shortly.