1つの関数を含む非常に単純なNSISプラグインを作成しました。Win32 DLLプロジェクトをDLLに正常にコンパイルし、それをディレクトリC:\ Program Files(x86)\ NSIS\Pluginsにコピーしました。
私の問題: dllから関数を呼び出す.nsiスクリプトを作成すると、無効なコマンド:tbox::myFunctionというコンパイルエラーが発生します。
私は何が間違っているのですか?tbox.libファイルもNSISディレクトリにコピーする必要がありますか、それとも含めるtbox.nshファイルを作成する必要がありますか?
私のdllの名前はtbox.dllで、nsiスクリプトはその下にあり、その下にC++DLLコードがあります。
!include MUI2.nsh
!include WinMessages.nsh
Name "aa.nsi"
OutFile "aa.exe"
Caption "${^Name}"
ShowInstDetails show
!define MUI_CUSTOMFUNCTION_GUIINIT MyGUIInit
Section "Dummy"
MessageBox MB_ICONINFORMATION|MB_OKCANCEL "dvkjdkj"
tbox::myFunction "abc" "def"
SectionEnd
DLLコード:
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#pragma comment(lib, "msimg32.lib")
#include <commctrl.h>
#include "TransparentCheckbox.h"
#include "NSIS/pluginapi.h"
HINSTANCE g_hInstance;
HWND g_hwndParent;
unsigned int g_stringsize;
stack_t **g_stacktop;
TCHAR *g_variables;
// To work with Unicode version of NSIS, please use TCHAR-type functions for accessing the variables and the stack.
HWND __declspec(dllexport) myFunction(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
{
g_hwndParent=hwndParent;
EXDLL_INIT();
{
TCHAR buf[1024];
wsprintf(buf,TEXT("string_size=%d, variables=%s\n"), string_size, variables);
MessageBox(g_hwndParent,buf,0,MB_OK);
}
return g_hwndParent;
}
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
g_hInstance = (HINSTANCE)hInst;
return TRUE;
}