Can we change the Normal VC++ function to VC++ Exported function with extern "C" calling convention.

  • Thread starter Thread starter aditya satya prakash
  • Start date Start date
A

aditya satya prakash

Guest
Hello,

My requirement is to call the function that is there in the C++/VC++ executable from NSIS (NULLSOFT installer)

But I was not able to call this function from NSIS.

I read one of the NSIS articles and found that we can't directly call the class functions. To call the function, we use extern "C" wrapper functions for every class member function.

Below is the article i read:

Calling C++ class from NSIS

Now I am using the normal functions like as shown below:

From the WinMain function, i am calling ApplicationDataCollection() function. Can I change ApplicationDataCollection() using extern "C" calling convention and DLLEXPORT?

Or else can we write a wrapper function for every class member function?

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
ULONG ulEnableUI = 0;
DWORD dShutdownStarted = 0;

GetTwoLetterISOCountryCode();

RegistryObj regSettings(APC_DALI_SETTINGS_REG_PATH);

RegistryObj regSettingsShutdown (APC_DALI_SETTINGS_REG_PATH, HKEY_CURRENT_USER, TRUE);
RegistryObj regShutdown(APC_DALI_SHUTDOWN_REG_PATH);

regSettingsShutdown.Set(APC_SETTINGS_SHUTDOWN_STARTED, dShutdownStarted);

CheckForUpgrade();

if (regSettings.GetNum(APC_SETTINGS_ALARM_ENABLE_UI, &ulEnableUI))
{
if (!ulEnableUI)

return 0;
}
}

RegistryObj regObj(APC_DALI_DEFAULT_REG_PATH);

DWORD dwSize = MAX_PATH;

if ((CheckForCriticalEvents())) //|| (IsSplashScreenDisabled()))
{
if (bGotComm)
{
ApplicationDataCollection();
}
else
{
Sleep(3000);

if (DisplayApplicationDataDialogCheck()) {
const int cDialogPresented = 1;
RegistryObj reg(APC_DALI_DIALOG_REG_PATH);
reg.Set(APC_DIALOG_APP_DATA_COLLECTION_PATH, cDialogPresented);
}
}
return(0);
}

ApplicationDataCollection();

RedrawWindow(NULL, NULL, NULL, RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);

lpCmdLine;
return (msg.wParam);
}




Y A S Prakash

Continue reading...
 
Back
Top