...that is the question?!? I just spent four fucking hours (excuse my lingo) debuggin and the problem was a missing ADDR!!!!! :mad: So, to prevent this insanity from striking again, can someone give me a good rule-of-thumb when to (or not to) use ADDR? I kinda deduced (from my looooooooong journey in fun-world :mad: ) that I should use ADDR when it's defined under .DATA, and I shouldn't when it's defined under .DATA?. BTW, I'm aware about the OFFSET and ADDR difference. ;) Thanx
Posted on 2001-04-28 17:22:00 by *unknown*
Oh well, All I can tell is :
Save early, Safe often, Compile often, Run often
I got it told too, *hehehe* Best is you compile your prog every few lines (or after every proc) you write. This dramatically reduces this kind of errors. For hard tasks, just code an empty window where you pre-run your code. If this code works well you can copy-paste it into your prog and be sure that everything is good ;)
Posted on 2001-04-28 18:38:00 by JimmyClif
disease_2000: The difference between ADDR and OFFSET is this: 1) Use ADDR if whatever you're pointing to has already been defined and 2) Use OFFSET if whatever you're pointing to has not been defined (and will be later). ;) Usually, when a parameter of an API calls for a pointer (has a prefix of lp or the like) then you use ADDR. Usually though....this is what got me. :mad: Later,
Posted on 2001-04-28 19:35:00 by *unknown*
Unknown, The ADDR operator does more things than OFFSET and it can only be used in conjunction with INVOKE. What you must keep in mind is what a manual function call does and what the parameters are that are being passed to the function. ADDR within an INVOKE call can be,

    lea reg, variable
    push reg
or it can be,

    push offset variable
It can also be used for structures. One thing that still catches many people is the difference between a variable and an address, some API functions return an address and if you use ADDR on that address, it will not work correctly. generally you use ADDR on variables within an INVOKE call. Regards, hutch@pbq.com.au
Posted on 2001-04-28 20:18:00 by hutch--
.....thanx for the explanation hutch--! ;)
Posted on 2001-04-29 13:11:00 by *unknown*
Did anyone say when to use ADDR (or OFFSET)? Generally: If the parameter is passed as a value, don't use ADDR. If the parameter itself is to be passed, use ADDR. In VB, these cases are called ByVal and ByRef. ByRef simply causes ADDR to be used. One way to help know is if the parameter will be changed by the dll, it must be ByRef. Or, if the parameter is larger then a DWORD, pass it byref (in Windows, a POINT is about the only one I know offhand where X and Y are passed, not the address of X). If you have the C proto from MSDN, look for astericks. In C, asterick means ByRef (or use ADDR). Another hint is the params with an "lp" (long pointer) hungarian prefix are ByRef.
Posted on 2001-05-05 11:22:00 by Ernie