diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
commit | 9cf1444eb7888f2d942d220f938aa893396a8a1b (patch) | |
tree | ea87e4cb78e9c26a651af00b2d423324ce4a85a6 /protocols/Omegle/src | |
parent | 3936ebbc665c9653d9f62527c1e136944d52e2ca (diff) |
g_hInstance incapulated into PLUGIN<>, no need in the separate variable
Diffstat (limited to 'protocols/Omegle/src')
-rw-r--r-- | protocols/Omegle/src/main.cpp | 21 | ||||
-rw-r--r-- | protocols/Omegle/src/proto.cpp | 4 | ||||
-rw-r--r-- | protocols/Omegle/src/stdafx.h | 1 | ||||
-rw-r--r-- | protocols/Omegle/src/theme.cpp | 2 |
4 files changed, 9 insertions, 19 deletions
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp index d1226e7f6e..ce2dbcfa74 100644 --- a/protocols/Omegle/src/main.cpp +++ b/protocols/Omegle/src/main.cpp @@ -24,11 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // TODO: Make following as "globals" structure?
-CMPlugin g_plugin;
CLIST_INTERFACE* pcli;
int hLangpack;
-HINSTANCE g_hInstance;
std::string g_strUserAgent;
DWORD g_mirandaVersion;
@@ -45,12 +43,6 @@ PLUGININFOEX pluginInfo = { { 0x9e1d9244, 0x606c, 0x4ef4, { 0x99, 0xa0, 0x1d, 0x7d, 0x23, 0xcb, 0x76, 0x1 } }
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
g_mirandaVersion = mirandaVersion;
@@ -58,6 +50,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda }
/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Interface information
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
@@ -65,15 +63,12 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC /////////////////////////////////////////////////////////////////////////////////////////
// Load
-static HANDLE g_hEvents[1];
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
InitIcons();
- //InitContactMenus();
// Init native User-Agent
{
@@ -103,9 +98,5 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- //UninitContactMenus();
- for (size_t i = 0; i < _countof(g_hEvents); i++)
- UnhookEvent(g_hEvents[i]);
-
return 0;
}
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 60361f1974..a09c8f491c 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -156,7 +156,7 @@ int OmegleProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam) INT_PTR OmegleProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_OmegleACCOUNT),
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_OmegleACCOUNT),
(HWND)lParam, OmegleAccountProc, (LPARAM)this);
}
@@ -176,7 +176,7 @@ int OmegleProto::OnModulesLoaded(WPARAM, LPARAM) int OmegleProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.w = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
diff --git a/protocols/Omegle/src/stdafx.h b/protocols/Omegle/src/stdafx.h index 70f5586598..b6aec36b82 100644 --- a/protocols/Omegle/src/stdafx.h +++ b/protocols/Omegle/src/stdafx.h @@ -75,7 +75,6 @@ class OmegleProto; #include "theme.h"
#include "resource.h"
-extern HINSTANCE g_hInstance;
extern std::string g_strUserAgent;
extern DWORD g_mirandaVersion;
diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp index fa89da9717..72af5190f4 100644 --- a/protocols/Omegle/src/theme.cpp +++ b/protocols/Omegle/src/theme.cpp @@ -31,7 +31,7 @@ static IconItem icons[] = void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Omegle", icons, _countof(icons), "Omegle");
+ Icon_Register(g_plugin.getInst(), "Protocols/Omegle", icons, _countof(icons), "Omegle");
}
HANDLE GetIconHandle(const char* name)
|