hey,this is a C struct. struct { int iIndex ; TCHAR * szLabel ; TCHAR * szDesc ; } sysmetrics [] = { SM_CXSCREEN, TEXT("SM_CXSCREEN"), TEXT ("Screen width in pixels"), SM_CYSCREEN, TEXT ("SM_CYSCREEN"), TEXT ("Screen height in pixels") }; how to use asm? sorry, My english is poor. thx.
Posted on 2001-02-26 01:51:00 by bzshow
SYSMETRICS struct item dd ? SM_Lable db 50 dup(?),0 SM_Desc db 50 dup(?),0 SYSMETRICS end yes? no? help me!
Posted on 2001-02-26 02:35:00 by bzshow
SYSMETRICS struct item dd ? SM_abc db 50 dup(?),0 SM_Desc db 50 dup(?),0 SYSMETRICS ends .data sm SYSMETRICS <1,"haha","cool window"> ERROR::: Msgbox.asm(18) : error A2138: invalid data initializer Msgbox.asm(18) : error A2036: too many initial values for structure
Posted on 2001-02-26 02:59:00 by bzshow
as far as i can see, everything is alright, but you have to use {} instead of <> like this: .data sm SYSMETRICS {1,"haha","cool window"} :rolleyes:
Posted on 2001-02-26 03:44:00 by [SaFc0n]
;;begin your code struct { int iIndex ; TCHAR * szLabel ; TCHAR * szDesc ; } sysmetrics [] = { SM_CXSCREEN, TEXT("SM_CXSCREEN"), TEXT ("Screen width in pixels"), SM_CYSCREEN, TEXT ("SM_CYSCREEN"), TEXT ("Screen height in pixels") }; how to use asm? sorry, My english is poor. thx. ;;end your code ;;begin my code Hi try this

sysmetrics STRUCT
   iIndex  dword ?
   szlabel byte ## dup (?);## number of bytes atleast length
                          ;of longest string
           byte NULL      ;NULL terminator
   szDesc  byte ## dup (?);## number of bytes same as above
           byte NULL
sysmetrics ENDS

;the "byte NULL" are the official null terminators.  These may 
;be ommitted if ## is atleast as big as the longest string+1 
;however it's not as clear and probably WRONG though it works 
;for me.

;to initialise this it's
sysmetrics {DWORD,"string",,"STRING"}; note the ,, this is a 
;holding place for the first terminating NULL so it doesn't get 
;over written. Also note there is no holding place for the last 
;NULL terminator
GeO
Posted on 2001-02-26 07:38:00 by GeO
The C code you originally gave:

struct
{
int iIndex ;
TCHAR * szLabel ;
TCHAR * szDesc ;
}
Uses pointers rather than actual data in itself! So you will need:

SYSMETRICS struct
item     DWORD ?
SM_Lable DWORD ?
SM_Desc  DWORD ?
SYSMETRICS end

...

.data
hahaText db          "haha",0
coolText db          "cool window",0
sm       SYSMETRICS  <1,OFFSET hahaText,OFFSET coolText>

The C struct required pointers to text, rather than text itself! And so when initialising the struct, you need to pass the address of the text, rather than the text itself :) ! Mirno P.S. I think it is angled brackets for structs in ASM, but I could (and usually am) wrong!
Posted on 2001-02-26 08:31:00 by Mirno
Two issues: First, while either angle <> or curley {} brackets may be used to define structure, use the curley ones. MS reports there are bugs in using the angle bracket ones. Seccond, be aware that a TCHAR may be either a char or a wchar (IE, Unicode), depending on if UNICODE is defined. MASM32 so far is sadly lacking in Unicode support. (I know, I have to write every bit of it I use) ;-)
Posted on 2001-02-26 10:55:00 by Ernie