diff options
Diffstat (limited to 'plugins/UserGuide/src')
-rw-r--r-- | plugins/UserGuide/src/main.cpp | 64 | ||||
-rw-r--r-- | plugins/UserGuide/src/stdafx.h | 8 |
2 files changed, 36 insertions, 36 deletions
diff --git a/plugins/UserGuide/src/main.cpp b/plugins/UserGuide/src/main.cpp index 593d79a022..c1be1d50db 100644 --- a/plugins/UserGuide/src/main.cpp +++ b/plugins/UserGuide/src/main.cpp @@ -1,10 +1,12 @@ #include "stdafx.h"
-HINSTANCE hInst;
-
+CMPlugin g_plugin;
int hLangpack;
-PLUGININFOEX pluginInfo = {
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -14,38 +16,39 @@ PLUGININFOEX pluginInfo = { __AUTHORWEB,
UNICODE_AWARE,
// 297EC1E7-41B7-41F9-BB91-EFA95028F16C
- {0x297ec1e7, 0x41b7, 0x41f9, {0xbb, 0x91, 0xef, 0xa9, 0x50, 0x28, 0xf1, 0x6c}}
+ { 0x297ec1e7, 0x41b7, 0x41f9, {0xbb, 0x91, 0xef, 0xa9, 0x50, 0x28, 0xf1, 0x6c }}
};
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfo;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR ShowGuideFile(WPARAM, LPARAM)
{
- LPTSTR pszDirName = (LPTSTR)mir_alloc(250*sizeof(wchar_t));
- LPTSTR pszFileName = (LPTSTR)mir_alloc(250*sizeof(wchar_t));
+ LPTSTR pszDirName = (LPTSTR)mir_alloc(250 * sizeof(wchar_t));
+ LPTSTR pszFileName = (LPTSTR)mir_alloc(250 * sizeof(wchar_t));
wchar_t *ptszHelpFile = db_get_wsa(NULL, "UserGuide", "PathToHelpFile");
-
- if (ptszHelpFile==nullptr)
- {
- mir_wstrcpy(pszDirName, L"%miranda_path%\\Plugins");
- mir_wstrcpy(pszFileName, L"UserGuide.chm");
+
+ if (ptszHelpFile == nullptr) {
+ mir_wstrcpy(pszDirName, L"%miranda_path%\\Plugins");
+ mir_wstrcpy(pszFileName, L"UserGuide.chm");
}
- else
- {
- if(!mir_wstrcmp(ptszHelpFile, L""))
- {
+ else {
+ if (!mir_wstrcmp(ptszHelpFile, L"")) {
mir_wstrcpy(pszDirName, L"%miranda_path%\\Plugins");
mir_wstrcpy(pszFileName, L"UserGuide.chm");
}
- else
- {
+ else {
LPTSTR pszDivider = wcsrchr(ptszHelpFile, '\\');
- if (pszDivider == nullptr)
- {
+ if (pszDivider == nullptr) {
mir_wstrcpy(pszDirName, L"");
wcsncpy(pszFileName, ptszHelpFile, mir_wstrlen(ptszHelpFile));
}
- else
- {
+ else {
wcsncpy(pszFileName, pszDivider + 1, mir_wstrlen(ptszHelpFile) - mir_wstrlen(pszDivider) - 1);
pszFileName[mir_wstrlen(ptszHelpFile) - mir_wstrlen(pszDivider) - 1] = 0;
wcsncpy(pszDirName, ptszHelpFile, pszDivider - ptszHelpFile);
@@ -64,21 +67,9 @@ static INT_PTR ShowGuideFile(WPARAM, LPARAM) return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
-
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
- CreateServiceFunction("UserGuide/ShowGuide", ShowGuideFile);
CMenuItem mi;
SET_UID(mi, 0x6787c12d, 0xdc85, 0x409d, 0xaa, 0x6c, 0x1f, 0xfe, 0x5f, 0xe8, 0xc1, 0x18);
@@ -88,11 +79,14 @@ extern "C" __declspec(dllexport) int Load(void) mi.name.w = LPGENW("User Guide");
mi.pszService = "UserGuide/ShowGuide";
Menu_AddMainMenuItem(&mi);
-
+
+ CreateServiceFunction(mi.pszService, ShowGuideFile);
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/UserGuide/src/stdafx.h b/plugins/UserGuide/src/stdafx.h index 95ba80f95a..1760206b41 100644 --- a/plugins/UserGuide/src/stdafx.h +++ b/plugins/UserGuide/src/stdafx.h @@ -2,7 +2,6 @@ #include <windows.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_database.h>
#include <m_langpack.h>
@@ -11,3 +10,10 @@ #include <m_skin.h>
#include "version.h"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+};
|