Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 4 Monaten
Letzter Beitrag:
vor 2 Jahren, 4 Monaten
Beteiligte Autoren:
Bruce Lee, Peter Holemans, MichaelG

Get an integer value which only has address of this variable (transfer() function)

Startbeitrag von Bruce Lee am 16.10.2015 13:48

I am working on a dll file in Windev.
I have a callback function which has one parameter returned by system.
I can only get the address of this variable (the third parameter: nResponseAddress), it keeps a unsigned long variable in C. I used system int to keep the address.
How do I get the value in this address?

I read some document from Windev website.
I saw there is a function
Transfer( , , )
However, from the document about my callback function the value in here is supposed to be either 1 or 2. But Windev returns 16.

Did I missed something? Here is my code:

PROCEDURE CallBackControl(sMyConext is string, nStateMask is system int, nResponseAddress is system int, nSignal is system int, nBitmapAddress is system int)

nResponseValue is int
nResponseTempAddress is system int = &nResponseValue


After I run this function, nResponseValue is 16.

Thank you.


I think the reason you're not getting any replies is the lack of detail here. For example, what is returning the pointer? And what version of WD are you using? To start with what happens if you replace "nResponseAddress is system int" with "&nResponseAddress" and "nResponseAdderss" with "&nResponseAddress"?

von MichaelG - am 16.10.2015 18:54
Hi Michael,

Thank you for your reply.
It is my fault that I didn't describe my question very well.
I am using WD20, latest version.
Here is the document, it may describe my question better.

FTR_USER_CTX Context, // [in] user-defined context information
FTR_STATE StateMask, // [in] an arguments bit mask
FTR_RESPONSE *pResponse, // [in, out] progress data or response from user, it is a pointer to a int value
FTR_SIGNAL Signal, // [in] signal value
FTR_BITMAP_PTR pBitmap // [in] a pointer to the bitmap to be displayed

So, basically, system will call this call back function when some event happens. The third parameter is an address.(it is a callback function, this parameter is returned by system) I define all the address as system int. Then I assign a value (depend on type of variable).

If I replace "nResponseAddress is system int" with "&nResponseAddress" and "nResponseAdderss" with "&nResponseAddress", it will not work.
&nResponse is a int value in my case, and nResponseAddress is its address.
Now I have the address of nResponse, but I need to know the value of nResponse.

von Bruce Lee - am 16.10.2015 22:30
Hi Bruce,

nResponse is int on 4 bytes (If the DLL you are calling is a 32 bit DLL otherwise is int on 8 bytes)
Trace(&nResponse) will show you the address of the variable e.g.: 123456789
Trace(nResponse) will show you the value stored at that address e.g. 987

In case of strings:
szResponse is string ASCIIZ on 256 (e.g. 256 byte string - WX Strings don't work)
Trace(&szResponse) will show you the address of the variabke e.g.: 123456789
Trace(szResponse) will show the content of the NULL-terminated string at that address e.g.: "Some response huh!"

The same goes for structures...

Note that API parameters are generaly passed by reference and not by value so you should pass them as:
API(DLLName, FunctionName, &szResponse)


Peter Holemans

von Peter Holemans - am 17.10.2015 14:17
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.