// Setup.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "ce_setup.h"
#include "Setup.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// ----------------------------------------------------------
// Variables, constants...
TCHAR ErrorMessageTitle[] = _T("Setup Notice");
TCHAR ErrorMessageNet[] = _T("My error message.\n");
// ----------------------------------------------------------
// This function will be called when the user
// tries to install the cab. According to its return
// value the installation continues or is cancelled.
//// To continue installation, return codeINSTALL_INIT_CONTINUE
// If you want to cancel installation,
// return codeINSTALL_INIT_CANCEL
codeINSTALL_INIT Install_Init(HWND hwndParent, BOOL fFirstCall, BOOL fPreviouslyInstalled, LPCTSTR pszInstallDir )
{
if( fFirstCall && ::IsMyMethod(hwndParent) == false ){
::MessageBox(hwndParent, ErrorMessageNet, ErrorMessageTitle, MB_OK);
return codeINSTALL_INIT_CANCEL;
}
return codeINSTALL_INIT_CONTINUE;
}
// ----------------------------------------------------------
// To exit the installation DLL normally,
// return codeINSTALL_EXIT_DONE
// To unistall the application after the function exits,
// return codeINSTALL_EXIT_UNINSTALL
codeINSTALL_EXIT Install_Exit(
HWND hwndParent,
LPCTSTR pszInstallDir,
WORD cFailedDirs,
WORD cFailedFiles,
WORD cFailedRegKeys,
WORD cFailedRegVals,
WORD cFailedShortcuts
)
{
return codeINSTALL_EXIT_DONE;
}
// ----------------------------------------------------------
// To continue uninstallation, return codeUNINSTALL_INIT_CONTINUE
// If you want to cancel installation,
// return codeUNINSTALL_INIT_CANCEL
codeUNINSTALL_INIT Uninstall_Init(HWND hwndParent, LPCTSTR pszInstallDir)
{
return codeUNINSTALL_INIT_CONTINUE;
}
// ----------------------------------------------------------
codeUNINSTALL_EXIT Uninstall_Exit(HWND hwndParent)
{
return codeUNINSTALL_EXIT_DONE;
}
// ----------------------------------------------------------
// This is the constructor of a class that has been exported.
// see Setup.h for the class definition
CSetup::CSetup()
{
return;
}
// ----------------------------------------------------------
// Your own system checking or settings...
bool IsMyMethod(HWND hwndParent)
{
// Do system check here
// return true or false
return true;
}
//
#include "stdafx.h"
#include "ce_setup.h"
#include "Setup.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// ----------------------------------------------------------
// Variables, constants...
TCHAR ErrorMessageTitle[] = _T("Setup Notice");
TCHAR ErrorMessageNet[] = _T("My error message.\n");
// ----------------------------------------------------------
// This function will be called when the user
// tries to install the cab. According to its return
// value the installation continues or is cancelled.
//// To continue installation, return codeINSTALL_INIT_CONTINUE
// If you want to cancel installation,
// return codeINSTALL_INIT_CANCEL
codeINSTALL_INIT Install_Init(HWND hwndParent, BOOL fFirstCall, BOOL fPreviouslyInstalled, LPCTSTR pszInstallDir )
{
if( fFirstCall && ::IsMyMethod(hwndParent) == false ){
::MessageBox(hwndParent, ErrorMessageNet, ErrorMessageTitle, MB_OK);
return codeINSTALL_INIT_CANCEL;
}
return codeINSTALL_INIT_CONTINUE;
}
// ----------------------------------------------------------
// To exit the installation DLL normally,
// return codeINSTALL_EXIT_DONE
// To unistall the application after the function exits,
// return codeINSTALL_EXIT_UNINSTALL
codeINSTALL_EXIT Install_Exit(
HWND hwndParent,
LPCTSTR pszInstallDir,
WORD cFailedDirs,
WORD cFailedFiles,
WORD cFailedRegKeys,
WORD cFailedRegVals,
WORD cFailedShortcuts
)
{
return codeINSTALL_EXIT_DONE;
}
// ----------------------------------------------------------
// To continue uninstallation, return codeUNINSTALL_INIT_CONTINUE
// If you want to cancel installation,
// return codeUNINSTALL_INIT_CANCEL
codeUNINSTALL_INIT Uninstall_Init(HWND hwndParent, LPCTSTR pszInstallDir)
{
return codeUNINSTALL_INIT_CONTINUE;
}
// ----------------------------------------------------------
codeUNINSTALL_EXIT Uninstall_Exit(HWND hwndParent)
{
return codeUNINSTALL_EXIT_DONE;
}
// ----------------------------------------------------------
// This is the constructor of a class that has been exported.
// see Setup.h for the class definition
CSetup::CSetup()
{
return;
}
// ----------------------------------------------------------
// Your own system checking or settings...
bool IsMyMethod(HWND hwndParent)
{
// Do system check here
// return true or false
return true;
}
#ifdef SETUP_EXPORTS
#define SETUP_API __declspec(dllexport)
#else
#define SETUP_API __declspec(dllimport)
#endif
// This class is exported from the Setup.dll
class SETUP_API CSetup {
public:
CSetup(void);
// TODO: add your methods here.
};
bool IsMyMethod(HWND hwndParent);