void DLL_EXPORT Replace(LPCTSTR OriginalFile, LPCTSTR FileToReplace, LPCTSTR BackupOfFileToReplace)
{
    HGLOBAL LoadResource(HMODULE hModule,  HRSRC hResInfo);
    try
    {
        BOOL WINAPI ReplaceFile(OriginalFile, FileToReplace, BackupOfFileToReplace);
        MessageBox(NULL, "Done", "Alert", 0);
    }
    catch (...){}
}

The above is my code and it gives me errors like:

In function 'void Replace(LPCTSTR, LPCTSTR, LPCTSTR)':|
warning: '__stdcall__' attribute only applies to function types [-Wattributes]|
error: expression list treated as compound expression in initializer [-fpermissive]|
warning: left operand of comma operator has no effect [-Wunused-value]|
warning: right operand of comma operator has no effect [-Wunused-value]|
error: invalid conversion from 'LPCTSTR {aka const char*}' to 'BOOL {aka int}' [-fpermissive]|
warning: unused variable 'ReplaceFile' [-Wunused-variable]|
||=== Build finished: 2 errors, 4 warnings ===|

I've googled everything and cannot for the life of me figure out why it's giving me these errors.. I have all the right includes, everything! Any help is appreciated.

It isn't optional but.. I've used it normally without the last 3 parameters in my console app and it works.. Also for the DLL, if I do put the last 3 parameters, I get the exact same error still.

And the last 2 parameters are reserved for future use so I cannot use them :S

Edited 4 Years Ago by triumphost

This article has been dead for over six months. Start a new discussion instead.