G
Guest
I'm wondering if I can do this with a streamWriter? But I'm not sure what
this converts too.
I'm trying to recreat this code in Visual Basic .Net. I have C++ code that
looks like this:
{...
theStatus = CreateDestinationFile(theFileName, &theFileRef);
....}
....
KPDCStatus CreateDestinationFile(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);
}
....
#define EXPAND_LOCAL_DRIVES
WINBASEAPI
HANDLE
WINAPI
CreateFileA(
IN LPCSTR lpFileName,
IN DWORD dwDesiredAccess,
IN DWORD dwShareMode,
IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
IN DWORD dwCreationDisposition,
IN DWORD dwFlagsAndAttributes,
IN HANDLE hTemplateFile
);
WINBASEAPI
HANDLE
WINAPI
CreateFileW(
IN LPCWSTR lpFileName,
IN DWORD dwDesiredAccess,
IN DWORD dwShareMode,
IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
IN DWORD dwCreationDisposition,
IN DWORD dwFlagsAndAttributes,
IN HANDLE hTemplateFile
);
this converts too.
I'm trying to recreat this code in Visual Basic .Net. I have C++ code that
looks like this:
{...
theStatus = CreateDestinationFile(theFileName, &theFileRef);
....}
....
KPDCStatus CreateDestinationFile(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);
}
....
#define EXPAND_LOCAL_DRIVES
WINBASEAPI
HANDLE
WINAPI
CreateFileA(
IN LPCSTR lpFileName,
IN DWORD dwDesiredAccess,
IN DWORD dwShareMode,
IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
IN DWORD dwCreationDisposition,
IN DWORD dwFlagsAndAttributes,
IN HANDLE hTemplateFile
);
WINBASEAPI
HANDLE
WINAPI
CreateFileW(
IN LPCWSTR lpFileName,
IN DWORD dwDesiredAccess,
IN DWORD dwShareMode,
IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
IN DWORD dwCreationDisposition,
IN DWORD dwFlagsAndAttributes,
IN HANDLE hTemplateFile
);