i modified that and it still wasn't working, so i added some messagebox's for errors and now it wont compile.
Code:
case ID_TOOLS_REPLACE:
{
HRSRC rsTxt;
HANDLE hExe;
HGLOBAL glTxt;
char *lpLock;
// Load the .EXE file that contains the file to copy.
hExe = LoadLibrary("FindText.exe");
if(hExe == NULL)
{
MessageBox(NULL, "There was an error accessing the extensions file.",
"Error!", MB_OK | MB_ICONEXCLAMATION);
}
rsTxt = FindResource(hExe, "ext.txt", RT_RCDATA);
if(rsTxt != NULL)
{
glTxt = LoadResource(hExe, rsTxt);
if(glTxt != NULL)
{
lpLock = LockResource(glTxt);
if (lpLock == NULL)
MessageBox(NULL, "Could not lock extensions file.", "Error!", MB_OK | MB_ICONEXCLAMATION);
HANDLE hFile;
BOOL bSuccess = FALSE;
TCHAR fileName[8] = "ext.txt";
DWORD dwWritten;
hFile = CreateFile(fileName, GENERIC_WRITE, 0, 0,
CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY, 0);
if(hFile != INVALID_HANDLE_VALUE)
{
if(WriteFile(hFile, lpLock, (DWORD)SizeofResource(hExe, rsTxt), &dwWritten, NULL))
{
MessageBox(NULL, "The file has been successfully been restored.", "Success",
MB_OK | MB_ICONINFORMATION);
}
else
{
MessageBox(NULL, "There was an error restoring the file.", "Error",
MB_OK | MB_ICONEXCLAMATION);
}
}
else
MessageBox(NULL, "hFile had an error", "ok" MB_OK);
}
else
MessageBox(NULL, "glTxt == NULL", "ok", MB_OK);
}
else
MessageBox(NULL, "rsTxt == NULL", "ok", MB_OK);
// Clean up.
if (!FreeLibrary(hExe))
{
MessageBox(NULL, "Could not free extensions file.", "Error!", MB_OK | MB_ICONEXCLAMATION);
}
}
break;
it stops at the else, messagebox right after trying to write the file MessageBox(NULL, "hFile had an error", "ok" MB_OK);
the error is "main.c: In function `WindowProcedure':
main.c:397: error: syntax error before numeric constant"