I am having a problem when using wsprinf for more than two variables. When it returns, it upsets the stack, and i dont know how to fix it. for one variable, i can simply add 0ch onto the stack, eg: push eax push offset mmem push offset temp call wsprintfA add sp,0ch but the following example causes all sorts of problems. push eax push ebx push offset mouse1 push offset temp call wsprintfA add sp,???? dont know what to add...any help?
Posted on 2001-02-11 08:00:00 by mega
The quantity that you add is directly related to what you put on the stack. You have to set the stack back to it's relitive state that it was in before the call. In you first example you add 0ch beacuse you pushed three DWORDs onto the stack and that is 12 bytes. So in the second case you would add 010h because four DWORDs are 16 bytes. Take care, bitRAKE
Posted on 2001-02-11 08:51:00 by bitRAKE
you will note mega that wsprintf is the only non STDCALL function in windows...ie is a "C like" function...makes me wonder ... what version of Pascal where windows programmers using? :D as BitRake told you... on "C like" functions you have to adjust the stack after you call the function, you can call this function a "lazy" one :) take care to push as many parameters as formats you have in your format string also ...
Posted on 2001-02-11 14:36:00 by BogdanOntanu
1. add Esp not sp 2. add number of parameter * 4 push par4 push par3 push par2 push par1 call ClikeProc add esp 4*4 3. You can make MASM32 to do it for you use invoke If I'm right the proto is already in windows.inc do just invoke wsprintf,addr buffer,addr template,addr par1,addr par2,\ addr WhatEverParNumYouWant and forget about add esp(not sp!) if you're lazy to calc. it.
Posted on 2001-02-12 14:53:00 by The Svin
thanks fella's... i suppose i should have figured that out for myself...
Posted on 2001-02-13 18:41:00 by mega