Wednesday, December 15, 2004

For my next trick

Okay, so I'm able to pass strings out now. ByRef/ByVal... stupid fat fingers.

My next step is to convert this function into VB: (I will be working on it tomorrow. GENERICREAD?!?!)
KPDCStatus CreateDestinationFile( KPDCProcsPtr pProcs,
KPDCLibMgrRef libMgr,
char* fileName,
KPDCFileRefHandle* fileRef)
{
KPDCStatus theStatus = KPDC_OK;
char theFilePath[MAX_STRING_LENGTH];
KPDCUInt32 theAttributeSize = 0;
HANDLE theFileHandle = INVALID_HANDLE_VALUE;

//
// Set up the file path
//
strcpy(theFilePath, "C:\\");
strcat(theFilePath, fileName);

//
// Create the file
//
theFileHandle = CreateFile( theFilePath,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(theFileHandle == INVALID_HANDLE_VALUE)
{
theStatus = (KPDCStatus) GetLastError();
}
else
{
*fileRef = (KPDCFileRefHandle) theFileHandle;
}

return(theStatus);
}

No comments: