- Код: Выделить всё
// szBuffer - [out] A pointer to a character buffer
// that will receive the name of the plugin.
// pnBufferSize - [in/out] A pointer to an integer
// that contains the number of characters in szBuffer
// on the way in and will be set to the number of characters
// actually copied to the buffer on the way out.
char szObjectName[] = "MyObject";
int GetName(char* szBuffer, int* pnBufferSize)
{
int nLength = lstrlen(szObjectName);
if(*pnBufferSize < nLength)
{
*pnBufferSize = nLength;
return -1;
} else
{
memset(szBuffer,0,*pnBufferSize);
lstrcpy(szBuffer,szObjectName);
return nLength;
}
}
Моя попытка на PB:
- Код: Выделить всё
FUNCTION GetName ALIAS "GetName" (BYVAL szBuffer AS DWORD, BYVAL pnBufferSize AS LONG) EXPORT AS LONG
DIM nLength AS LONG
DIM szObjectName AS ASCIIZ * 80
szObjectName = "MyObject"
nLength = lstrlen(szObjectName)
IF(pnBufferSize < nLength) THEN
pnBufferSize = nLength
FUNCTION = -1
ELSE
lstrcpy(BYVAL szBuffer, szObjectName)
FUNCTION = nLength
END IF
END FUNCTION
Заранее благодарен за любой совет, а если с примером, то это будет просто здорово.
P.S. Сильно не пинайте, я только учусь .