M
MIUSS
Hello
I got an unusual problem and I don't know how to solve it out.
I need to get success with the handle variable hFile. It's not problem
'til I use wcscpy(...). I mean, when I take out those two double-
slashes the source is not working and the func CreateFile returns
0xFFFFFF to that variable. It seems to me that it has some context
with using wcscpy? But why?
void SaveWorkerFile(void)
{
TCHAR szSoubor[MAX_PATH];//
int StrLength;
LPTSTR lpBuffer;
WCHAR temppp[200];
WCHAR UnicodeIdr[10];
HANDLE hFile;
UnicodeIdr[0] = 0xFEFF; UnicodeIdr[1] = 0x0000;
// wcscpy(temppp, UnicodeIdr);
// wcscat(temppp, TEXT("MK00000000 01/01/07 REZIEROTEC
PocetHodin Popis \r\n"));
StrLength = lstrlen(temppp)+10;
lpBuffer = (LPTSTR)HeapAlloc(GetProcessHeap(), 0, StrLength);
GetWindowText(hWndDatabaseWindow, lpBuffer, StrLength);
wcscpy(lpBuffer, temppp);
DWORD dwZapsano;
lstrcpy(szSoubor, TEXT("C:\\RCOMMISIONS\\mkatab.txt"));
hFile = CreateFile(szSoubor, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
0, NULL);
if(hFile == INVALID_HANDLE_VALUE) return;
if(!WriteFile(hFile, lpBuffer, StrLength-1, &dwZapsano, NULL))
MessageBox(g_hWnd, TEXT("Error in writing file process."),
TEXT("Error"), MB_ICONERROR);
CloseHandle(hFile);
HeapFree(GetProcessHeap(), 0, lpBuffer);
return;
}
Any help will be apprecciated.
Have a nice day
I got an unusual problem and I don't know how to solve it out.
I need to get success with the handle variable hFile. It's not problem
'til I use wcscpy(...). I mean, when I take out those two double-
slashes the source is not working and the func CreateFile returns
0xFFFFFF to that variable. It seems to me that it has some context
with using wcscpy? But why?
void SaveWorkerFile(void)
{
TCHAR szSoubor[MAX_PATH];//
int StrLength;
LPTSTR lpBuffer;
WCHAR temppp[200];
WCHAR UnicodeIdr[10];
HANDLE hFile;
UnicodeIdr[0] = 0xFEFF; UnicodeIdr[1] = 0x0000;
// wcscpy(temppp, UnicodeIdr);
// wcscat(temppp, TEXT("MK00000000 01/01/07 REZIEROTEC
PocetHodin Popis \r\n"));
StrLength = lstrlen(temppp)+10;
lpBuffer = (LPTSTR)HeapAlloc(GetProcessHeap(), 0, StrLength);
GetWindowText(hWndDatabaseWindow, lpBuffer, StrLength);
wcscpy(lpBuffer, temppp);
DWORD dwZapsano;
lstrcpy(szSoubor, TEXT("C:\\RCOMMISIONS\\mkatab.txt"));
hFile = CreateFile(szSoubor, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
0, NULL);
if(hFile == INVALID_HANDLE_VALUE) return;
if(!WriteFile(hFile, lpBuffer, StrLength-1, &dwZapsano, NULL))
MessageBox(g_hWnd, TEXT("Error in writing file process."),
TEXT("Error"), MB_ICONERROR);
CloseHandle(hFile);
HeapFree(GetProcessHeap(), 0, lpBuffer);
return;
}
Any help will be apprecciated.
Have a nice day