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.

Are the last three parameters optional?
...from looking at this documentation

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

Sometimes it's easier to do it the hard way.
1) Delete old file
2) Move in new file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.