Author Topic: printer_info_4  (Read 4264 times)

shankle

  • Member
  • ****
  • Posts: 835
printer_info_4
« on: June 21, 2012, 10:53:44 PM »
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

  • Member
  • **
  • Posts: 209
    • WJR's website
Re: printer_info_4
« Reply #1 on: June 22, 2012, 02:50:16 AM »
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

  • Member
  • ****
  • Posts: 835
Re: printer_info_4
« Reply #2 on: June 22, 2012, 04:43:12 AM »
Thank you very much for taking your time to answer my question WJR.

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