WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
 

Print structure item if correct fill, can I view with wsprintf if the structure is filled correctly?

ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 874
Member No.: 5019
Joined: 13-May 07


Hi

And ervery about structures laugh.gif

Can i view with wsprintf if the structure correct fill?

CODE
LHV1 STRUCT
dwNumber   dd ?
LHV1 ENDS

My_CONFIG STRUCT
format       LHV1 <>
My_CONFIG ENDS

.data
My_Struct    My_CONFIG <>

.data?
lpOut dd 512 DUP(?)

.code

    lea  esi, [My_Struct]
   mov [esi].My_CONFIG.format.LHV1.dwNumber, 12345;
   mov edi, esi
   invoke wsprintf,addr lpOut,CTEXT ("%d"),edi
   invoke MessageBox,hWnd,addr lpOut,0,MB_OK


greets

PMUsers Website
Top
JimG
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 725
Member No.: 11
Joined: 16-May 04


Yes, if you give wsprintf the value of the variable to print

CODE
  lea  esi, [My_Struct]
  mov [esi].My_CONFIG.format.LHV1.dwNumber, 12345;
  mov edi, esi

  invoke wsprintf,addr lpOut,CTXT ("%d"),dword ptr [edi]

or

  mov eax,[esi]
  invoke wsprintf,addr lpOut,CTXT ("%d"),eax



wsprintf does not accept addresses for integers, only for strings.
PMEmail Poster
Top
ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 874
Member No.: 5019
Joined: 13-May 07


Hi

Thanks

QUOTE
wsprintf does not accept addresses for integers, only for strings.


Why can i not use integers??

I strore a lot of integers to the struct wink.gif


EDIT:

Ok i have it solved thanks JimG

mov [esi].My_CONFIG.format.LHV1.dwNumber, 12345;
mov eax,[esi].My_CONFIG.format.LHV1.dwNumber
invoke wsprintf,addr lpOut,CTEXT ("%lu"),eax

Greets,
ragdog
PMUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google