diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-18 18:14:33 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-18 18:14:33 +0300 |
commit | b172c4bbc75cdad0e8ccd22292aa671ba43cac45 (patch) | |
tree | 4677a04a47f3987c88f3fb44c6b70d2642b1f8a3 /protocols/VKontakte | |
parent | 524d1c7186eca3f0a4da08548eeb919785227101 (diff) |
PLUGIN<> to half-automatically calculate the dll's g_hInstance and pass it inside
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/main.cpp | 21 | ||||
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/stdafx.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 11 |
5 files changed, 16 insertions, 22 deletions
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp index 71e8ddd3cd..01a6dfb66d 100644 --- a/protocols/VKontakte/src/main.cpp +++ b/protocols/VKontakte/src/main.cpp @@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
#include "version.h"
-HINSTANCE hInst;
+CMPlugin g_plugin;
+HINSTANCE g_hInstance;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -38,11 +39,7 @@ PLUGININFOEX pluginInfo = /////////////////////////////////////////////////////////////////////////////////////////
-BOOL WINAPI DllMain(HINSTANCE hModule, DWORD, LPVOID)
-{
- hInst = hModule;
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
@@ -70,15 +67,3 @@ extern "C" int __declspec(dllexport) Unload(void) {
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public ACCPROTOPLUGIN<CVkProto>
-{
- CMPlugin() :
- ACCPROTOPLUGIN<CVkProto>("VKontakte")
- {
- SetUniqueId("ID");
- }
-}
- g_plugin;
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 2f3aeca9c7..1b18bc382b 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -79,7 +79,7 @@ static IconItem iconList[] = void InitIcons()
{
- Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("VKontakte"), iconList, _countof(iconList), "VKontakte");
+ Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("VKontakte"), iconList, _countof(iconList), "VKontakte");
}
HANDLE GetIconHandle(int iCommand)
diff --git a/protocols/VKontakte/src/stdafx.h b/protocols/VKontakte/src/stdafx.h index da91ad030d..e60368369e 100644 --- a/protocols/VKontakte/src/stdafx.h +++ b/protocols/VKontakte/src/stdafx.h @@ -57,7 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "win2k.h"
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
#include "resource.h"
#include "vk.h"
diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index 4fd3060912..b40f8980ba 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -103,7 +103,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct CVkProto;
extern LIST<CVkProto> vk_Instances;
extern mir_cs csInstances;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
LPCSTR findHeader(NETLIBHTTPREQUEST *hdr, LPCSTR szField);
bool wlstrstr(wchar_t *_s1, wchar_t *_s2);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 8b7abdbb8a..5c050cf2a4 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -399,4 +399,13 @@ private: void SetChatStatus(MCONTACT hContact, int iStatus);
CVkChatInfo* GetChatById(LPCWSTR pwszId);
INT_PTR __cdecl SvcCreateChat(WPARAM, LPARAM);
-};
\ No newline at end of file +};
+
+struct CMPlugin : public ACCPROTOPLUGIN<CVkProto>
+{
+ CMPlugin() :
+ ACCPROTOPLUGIN<CVkProto>("VKontakte")
+ {
+ SetUniqueId("ID");
+ }
+};
|