Home > database >  Pb deposit the structure in the address to the dynamic link library pb retrieve the value error
Pb deposit the structure in the address to the dynamic link library pb retrieve the value error

Time:09-26

Long nc, ts, longth
Pb pb1
Nc=LocalAlloc (0 16th)
CopyMemory (nc, pb1, 16)
Longth=add1 (nc)
CopyMemory (pb1, nc, 16)
Messagebox (' ', a string (pb1. A) + "" + string (pb1. B) +" "+ string (pb1. C))
LocalFree (nc)//pb will structure into the memory and get its address

C + +
Extern "C" _declspec (dllexport) int _stdcall add1 (pb& Pb1)
{

/* int c=sizeof (pb);
Return the c; */
Pb1. A=123;
Pb1. B=124;
Pb1. C=125;
//pb1. D='a';
Return sizeof (pb1);
}
Pb run messagebox display 123 0 124 excuse me each ace is this why?

CodePudding user response:

Try this statement:
The Function long add1 (ref pb pb1) LIBRARY "XXXX. DLL
"
Call:
Long longth
Pb pb1
The longth=add1 (pb1)
Messagebox (' ', a string (pb1. A) + "" + string (pb1. B) +" "+ string (pb1. C))
  • Related