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 /plugins | |
parent | 524d1c7186eca3f0a4da08548eeb919785227101 (diff) |
PLUGIN<> to half-automatically calculate the dll's g_hInstance and pass it inside
Diffstat (limited to 'plugins')
52 files changed, 373 insertions, 398 deletions
diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp index 34e779df1c..1dacf3112e 100644 --- a/plugins/CloudFile/src/Services/dropbox_service.cpp +++ b/plugins/CloudFile/src/Services/dropbox_service.cpp @@ -308,12 +308,14 @@ UINT CDropboxService::Upload(FileTransferParam *ftp) ///////////////////////////////////////////////////////////////////////////////////////// -struct CMPluginDropbox : public CMPluginBase +struct CMPluginDropbox : public PLUGIN<CMPluginDropbox> { CMPluginDropbox() : - CMPluginBase(MODULE "/Dropbox") + PLUGIN<CMPluginDropbox>(MODULE "/Dropbox") { RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CDropboxService::Init, (pfnUninitProto)CDropboxService::UnInit); } } g_pluginDropbox; + +extern "C" _pfnCrtInit _pRawDllMain = &CMPluginDropbox::RawDllMain; diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp index c7c24333ac..665f5bc511 100644 --- a/plugins/CloudFile/src/Services/google_service.cpp +++ b/plugins/CloudFile/src/Services/google_service.cpp @@ -295,7 +295,7 @@ UINT CGDriveService::Upload(FileTransferParam *ftp) struct CMPluginGoogle : public CMPluginBase { CMPluginGoogle() : - CMPluginBase(MODULE "/GDrive") + CMPluginBase(g_hInstance, MODULE "/GDrive") { RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CGDriveService::Init, (pfnUninitProto)CGDriveService::UnInit); } diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp index 05c4c5ca81..656ccbdd4b 100644 --- a/plugins/CloudFile/src/Services/microsoft_service.cpp +++ b/plugins/CloudFile/src/Services/microsoft_service.cpp @@ -280,7 +280,7 @@ UINT COneDriveService::Upload(FileTransferParam *ftp) struct CMPluginOnedrive : public CMPluginBase { CMPluginOnedrive() : - CMPluginBase(MODULE "/OneDrive") + CMPluginBase(g_hInstance, MODULE "/OneDrive") { RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)COneDriveService::Init, (pfnUninitProto)COneDriveService::UnInit); } diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp index c3e32aa8c8..3212814db5 100644 --- a/plugins/CloudFile/src/Services/yandex_service.cpp +++ b/plugins/CloudFile/src/Services/yandex_service.cpp @@ -290,7 +290,7 @@ UINT CYandexService::Upload(FileTransferParam *ftp) struct CMPluginYandex : public CMPluginBase { CMPluginYandex() : - CMPluginBase(MODULE "/YandexDisk") + CMPluginBase(g_hInstance, MODULE "/YandexDisk") { RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CYandexService::Init, (pfnUninitProto)CYandexService::UnInit); } diff --git a/plugins/CloudFile/src/icons.cpp b/plugins/CloudFile/src/icons.cpp index ed496f2430..bb9dd9096c 100644 --- a/plugins/CloudFile/src/icons.cpp +++ b/plugins/CloudFile/src/icons.cpp @@ -11,7 +11,7 @@ static IconItem iconList[] = void InitializeIcons() { - Icon_Register(hInstance, "Protocols/" MODULE, iconList, _countof(iconList), MODULE); + Icon_Register(g_hInstance, "Protocols/" MODULE, iconList, _countof(iconList), MODULE); } HANDLE GetIconHandle(int iconId) diff --git a/plugins/CloudFile/src/main.cpp b/plugins/CloudFile/src/main.cpp index 91d8a82f7c..e9c8a6fdd2 100644 --- a/plugins/CloudFile/src/main.cpp +++ b/plugins/CloudFile/src/main.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" int hLangpack; -HINSTANCE hInstance; +HINSTANCE g_hInstance; PLUGININFOEX pluginInfo = { @@ -17,12 +17,6 @@ PLUGININFOEX pluginInfo = { 0xe876fe63, 0x701, 0x4cda, { 0xbe, 0xd5, 0x7c, 0x73, 0xa3, 0x79, 0xc1, 0xd1 }} }; -DWORD WINAPI DllMain(HINSTANCE hInst, DWORD, LPVOID) -{ - hInstance = hInst; - return TRUE; -} - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; diff --git a/plugins/CloudFile/src/oauth.cpp b/plugins/CloudFile/src/oauth.cpp index 9d8e40cf73..0e0503f639 100644 --- a/plugins/CloudFile/src/oauth.cpp +++ b/plugins/CloudFile/src/oauth.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" COAuthDlg::COAuthDlg(CCloudService *service, const char *authUrl, pThreadFuncOwner requestAccessTokenThread) - : CDlgBase(hInstance, IDD_OAUTH), m_service(service), + : CDlgBase(g_hInstance, IDD_OAUTH), m_service(service), m_requestAccessTokenThread(requestAccessTokenThread), m_authorize(this, IDC_OAUTH_AUTHORIZE, authUrl), m_code(this, IDC_OAUTH_CODE), m_ok(this, IDOK) diff --git a/plugins/CloudFile/src/options.cpp b/plugins/CloudFile/src/options.cpp index 32eb485a31..09fb7df117 100644 --- a/plugins/CloudFile/src/options.cpp +++ b/plugins/CloudFile/src/options.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" COptionsMainDlg::COptionsMainDlg() - : CPluginDlgBase(hInstance, IDD_OPTIONS_MAIN, MODULE), + : CPluginDlgBase(g_hInstance, IDD_OPTIONS_MAIN, MODULE), m_defaultService(this, IDC_DEFAULTSERVICE), m_doNothingOnConflict(this, IDC_DONOTHINGONCONFLICT), m_renameOnConflict(this, IDC_RENAMEONCONFLICT), diff --git a/plugins/CloudFile/src/stdafx.h b/plugins/CloudFile/src/stdafx.h index 9e91769740..85ce23b8d7 100644 --- a/plugins/CloudFile/src/stdafx.h +++ b/plugins/CloudFile/src/stdafx.h @@ -41,7 +41,7 @@ class CCloudService; #include "options.h" -extern HINSTANCE hInstance; +extern HINSTANCE g_hInstance; extern HNETLIBUSER hNetlibConnection; class Exception diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 8b3e44aead..c53ac57712 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
//PLUGINLINK *pluginLink=NULL;
@@ -319,10 +319,10 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar hwnd = GetDlgItem(hwndDlg, IDC_FGCOLOR);
EnableWindow(hwnd, FALSE);
}
- SendDlgItemMessage(hwndDlg, ID_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON6), IMAGE_ICON, 16, 16, 0));
- SendDlgItemMessage(hwndDlg, ID_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON3), IMAGE_ICON, 16, 16, 0));
- SendDlgItemMessage(hwndDlg, ID_DOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON4), IMAGE_ICON, 16, 16, 0));
- SendDlgItemMessage(hwndDlg, ID_UP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON5), IMAGE_ICON, 16, 16, 0));
+ SendDlgItemMessage(hwndDlg, ID_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON6), IMAGE_ICON, 16, 16, 0));
+ SendDlgItemMessage(hwndDlg, ID_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON3), IMAGE_ICON, 16, 16, 0));
+ SendDlgItemMessage(hwndDlg, ID_DOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON4), IMAGE_ICON, 16, 16, 0));
+ SendDlgItemMessage(hwndDlg, ID_UP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON5), IMAGE_ICON, 16, 16, 0));
// initialise and fill listbox
hwndList = GetDlgItem(hwndDlg, IDC_STATUS);
ListView_DeleteAllItems(hwndList);
@@ -388,7 +388,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar cur->strExtIp[0] = '*';
cur->strIntIp[0] = '*';
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur) == IDCANCEL) {
+ if (DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur) == IDCANCEL) {
mir_free(cur);
cur = nullptr;
}
@@ -552,7 +552,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar while (pos--) {
cur = cur->next;
}
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur);
+ DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur);
fillExceptionsListView(hwndDlg);
ListView_SetItemState(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), pos1, LVNI_FOCUSED | LVIS_SELECTED, LVNI_FOCUSED | LVIS_SELECTED);
SetFocus(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS));
@@ -585,7 +585,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar int ConnectionNotifyOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DIALOG);
odp.szTitle.w = _A2W(PLUGINNAME);
odp.szGroup.w = LPGENW("Plugins");
@@ -626,7 +626,7 @@ INT_PTR TMLoadIcon(WPARAM wParam, LPARAM) default:
return 0;
}
- return (INT_PTR)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam&PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam&PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
+ return (INT_PTR)LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam&PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam&PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
//=======================================================
//SetStatus
@@ -775,7 +775,7 @@ void showMsg(wchar_t *pName, DWORD pid, wchar_t *intIp, wchar_t *extIp, int intP //MessageBox(NULL,"aaa","aaa",1);
memset(&ppd, 0, sizeof(ppd)); //This is always a good thing to do.
ppd.lchContact = NULL;//(HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
- ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
+ ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
if (settingResolveIp) {
wchar_t hostName[128];
getDnsName(extIp, hostName, _countof(hostName));
@@ -841,7 +841,7 @@ static int preshutdown(WPARAM, LPARAM) extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
- hInst = hinstDLL;
+ g_hInstance = hinstDLL;
return TRUE;
}
@@ -900,12 +900,14 @@ extern "C" int __declspec(dllexport) Unload(void) /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(PLUGINNAME)
+ PLUGIN<CMPlugin>(PLUGINNAME)
{
RegisterProtocol(PROTOTYPE_PROTOCOL);
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp index 5d3d778517..a9d9774048 100644 --- a/plugins/ConnectionNotify/src/filter.cpp +++ b/plugins/ConnectionNotify/src/filter.cpp @@ -1,7 +1,7 @@ #include "stdafx.h"
HWND filterAddDlg = nullptr;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern struct CONNECTION *connExceptions;
extern HANDLE hFilterOptionsThread;
extern DWORD FilterOptionsThreadId;
@@ -27,7 +27,7 @@ static unsigned __stdcall filterQueue(void *) if (msg.message == WM_ADD_FILTER)
{
struct CONNECTION *conn = (struct CONNECTION *)msg.lParam;
- filterAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), nullptr, ConnectionFilterEditProc, (LPARAM)conn);
+ filterAddDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FILTER_DIALOG), nullptr, ConnectionFilterEditProc, (LPARAM)conn);
ShowWindow(filterAddDlg, SW_SHOW);
}
diff --git a/plugins/ExternalAPI/m_yamn.h b/plugins/ExternalAPI/m_yamn.h index 2be7c32712..f19d2eaf27 100644 --- a/plugins/ExternalAPI/m_yamn.h +++ b/plugins/ExternalAPI/m_yamn.h @@ -10,7 +10,6 @@ typedef struct CYAMNVariables
{
#define YAMN_VARIABLESVERSION 3
- HINSTANCE hInst;
MWindowList MessageWnds;
MWindowList NewMailAccountWnd;
int Shutdown;
diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index 9dccc5965d..945ab5984d 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -11,7 +11,7 @@ There is no warranty. #include "version.h"
CLIST_INTERFACE *pcli;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
int hLangpack;
UINT hTimer;
HANDLE hMirandaStarted, hOptionsInitial;
@@ -56,12 +56,6 @@ INT_PTR GetName(WPARAM wParam, LPARAM lParam) return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
PluginMenuCommand(0, 0);
@@ -170,12 +164,14 @@ extern "C" int __declspec(dllexport) Unload(void) /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(MODULE_NAME)
+ PLUGIN<CMPlugin>(MODULE_NAME)
{
RegisterProtocol(PROTOTYPE_VIRTUAL);
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index cc2bd0ffa9..4aafb314f6 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -272,7 +272,7 @@ int OptInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -790000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
odp.szTitle.a = LPGEN("GmailNotifier");
odp.szGroup.a = LPGEN("Network");
diff --git a/plugins/GmailNotifier/src/stdafx.h b/plugins/GmailNotifier/src/stdafx.h index 78d5c08275..c098816cef 100644 --- a/plugins/GmailNotifier/src/stdafx.h +++ b/plugins/GmailNotifier/src/stdafx.h @@ -73,7 +73,7 @@ struct optionSettings extern OBJLIST<Account> g_accs;
extern optionSettings opt;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern HNETLIBUSER hNetlibUser;
extern UINT hTimer;
extern short ID_STATUS_NONEW;
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index b9c5335b1c..8c105de7c7 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -23,7 +23,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam); char PLUGINNAME[64] = {0}; //init at init_pluginname();
int hLangpack = 0;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
HINSTANCE hLotusDll;
@@ -209,7 +209,7 @@ void init_pluginname() WIN32_FIND_DATAA ffd;
// Try to find name of the file having original letter sizes
- GetModuleFileNameA(hInst, text, sizeof(text));
+ GetModuleFileNameA(g_hInstance, text, sizeof(text));
HANDLE hFind = FindFirstFileA(text, &ffd);
if(hFind != INVALID_HANDLE_VALUE) {
@@ -450,7 +450,7 @@ void showMsg(wchar_t* sender,wchar_t* text, DWORD id, char *strUID) POPUPATT * mpd = (POPUPATT*)malloc(sizeof(POPUPATT));
memset(&ppd, 0, sizeof(ppd)); //This is always a good thing to do.
ppd.lchContact = NULL; //(HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
- ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
+ ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
wcscpy_s(ppd.lptzContactName, _countof(ppd.lptzContactName), sender);
wcscpy_s(ppd.lptzText, _countof(ppd.lptzText), text);
if(settingSetColours)
@@ -1453,7 +1453,7 @@ static INT_PTR CALLBACK DlgProcLotusNotifyMiscOpts(HWND hwndDlg, UINT msg, WPARA int LotusNotifyOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.szGroup.w = LPGENW("Plugins");
odp.szTitle.w = _A2W(__PLUGIN_NAME);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
@@ -1509,7 +1509,7 @@ INT_PTR TMLoadIcon(WPARAM wParam, LPARAM) default:
return 0;
}
- return (INT_PTR)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
+ return (INT_PTR)LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
@@ -1700,7 +1700,7 @@ extern "C" int __declspec(dllexport) Load(void) SET_UID(mi, 0x4519458, 0xb55a, 0x4e22, 0xac, 0x95, 0x5e, 0xa4, 0x4d, 0x92, 0x65, 0x65);
mi.position = -0x7FFFFFFF; //on top menu position
mi.flags = CMIF_UNICODE;
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
mi.name.w = LPGENW("&Check Lotus");
mi.pszService = "LotusNotify/MenuCommand"; //service name thet listning for menu call
hMenuHandle = Menu_AddMainMenuItem(&mi); //create menu pos.
@@ -1760,7 +1760,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID ) case DLL_PROCESS_ATTACH:
/* Save the instance handle */
Plugin_Terminated = false;
- hInst = hinstDLL;
break;
case DLL_PROCESS_DETACH:
/* Deregister extension manager callbacks */
@@ -1773,12 +1772,14 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID ) /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(PLUGINNAME)
+ PLUGIN<CMPlugin>(PLUGINNAME)
{
RegisterProtocol(PROTOTYPE_PROTOCOL);
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp index 7ff29ede9a..e656206e9f 100644 --- a/plugins/NewsAggregator/Src/Authentication.cpp +++ b/plugins/NewsAggregator/Src/Authentication.cpp @@ -43,7 +43,7 @@ void CreateAuthString(char *auth, MCONTACT hContact, CFeedEditor *pDlg) }
CAuthRequest::CAuthRequest(CFeedEditor *pDlg, MCONTACT hContact)
- : CSuper(hInst, IDD_AUTHENTICATION),
+ : CSuper(g_hInstance, IDD_AUTHENTICATION),
m_feedname(this, IDC_FEEDNAME), m_username(this, IDC_FEEDUSERNAME),
m_password(this, IDC_FEEDPASSWORD), m_ok(this, IDOK)
{
diff --git a/plugins/NewsAggregator/Src/Icons.cpp b/plugins/NewsAggregator/Src/Icons.cpp index 763890c580..206238b4bd 100644 --- a/plugins/NewsAggregator/Src/Icons.cpp +++ b/plugins/NewsAggregator/Src/Icons.cpp @@ -33,7 +33,7 @@ static IconItem iconList[] = void InitIcons()
{
- Icon_Register(hInst, LPGEN("News Aggregator"), iconList, _countof(iconList), MODULE);
+ Icon_Register(g_hInstance, LPGEN("News Aggregator"), iconList, _countof(iconList), MODULE);
}
HICON LoadIconEx(const char *name, bool big)
diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index d0b1547f22..66f0af69b8 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInst = nullptr;
+HINSTANCE g_hInstance = nullptr;
int hLangpack;
HANDLE hPrebuildMenuHook = nullptr;
@@ -29,6 +29,8 @@ HANDLE hUpdateMutex; LIST<CFeedEditor> g_arFeeds(1, PtrKeySortT);
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -42,18 +44,16 @@ PLUGININFOEX pluginInfoEx = { {0x56cc3f29, 0xccbf, 0x4546, {0xa8, 0xba, 0x98, 0x56, 0x24, 0x8a, 0x41, 0x2a}}
};
-bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- hInst = hinstDLL;
- return TRUE;
+ return &pluginInfoEx;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfoEx;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) int Load(void)
{
@@ -97,6 +97,8 @@ extern "C" __declspec(dllexport) int Load(void) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
DestroyUpdateList();
@@ -106,13 +108,15 @@ extern "C" __declspec(dllexport) int Unload(void) /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(MODULE)
+ PLUGIN<CMPlugin>(MODULE)
{
RegisterProtocol(PROTOTYPE_VIRTUAL);
SetUniqueId("URL");
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index b84aabe6a2..4d96fb10e3 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
CExportFeed::CExportFeed()
- : CSuper(hInst, IDD_FEEDEXPORT),
+ : CSuper(g_hInstance, IDD_FEEDEXPORT),
m_feedslist(this, IDC_FEEDSLIST), m_feedsexportlist(this, IDC_FEEDSEXPORTLIST),
m_addfeed(this, IDC_ADDFEED), m_removefeed(this, IDC_REMOVEFEED),
m_addallfeeds(this, IDC_ADDALLFEEDS), m_removeallfeeds(this, IDC_REMOVEALLFEEDS),
@@ -251,7 +251,7 @@ void CExportFeed::OnClose() }
CImportFeed::CImportFeed(CCtrlListView *m_feeds)
- : CSuper(hInst, IDD_FEEDIMPORT),
+ : CSuper(g_hInstance, IDD_FEEDIMPORT),
m_importfile(this, IDC_IMPORTFILEPATH), m_browsefile(this, IDC_BROWSEIMPORTFILE),
m_feedslist(this, IDC_FEEDSLIST), m_feedsimportlist(this, IDC_FEEDSIMPORTLIST),
m_addfeed(this, IDC_ADDFEED), m_removefeed(this, IDC_REMOVEFEED),
@@ -661,7 +661,7 @@ void CImportFeed::OnClose() }
CFeedEditor::CFeedEditor(int iItem, CCtrlListView *m_feeds, MCONTACT Contact)
- : CSuper(hInst, IDD_ADDFEED),
+ : CSuper(g_hInstance, IDD_ADDFEED),
m_feedtitle(this, IDC_FEEDTITLE), m_feedurl(this, IDC_FEEDURL),
m_checktime(this, IDC_CHECKTIME), m_checktimespin(this, IDC_TIMEOUT_VALUE_SPIN),
m_checkfeed(this, IDC_DISCOVERY), m_useauth(this, IDC_USEAUTH),
@@ -893,7 +893,7 @@ void COptionsMain::UpdateList() }
COptionsMain::COptionsMain()
- : CPluginDlgBase(hInst, IDD_OPTIONS, MODULE),
+ : CPluginDlgBase(g_hInstance, IDD_OPTIONS, MODULE),
m_feeds(this, IDC_FEEDLIST),
m_add(this, IDC_ADD),
m_change(this, IDC_CHANGE),
@@ -1064,7 +1064,7 @@ void COptionsMain::OnFeedListDoubleClick(CCtrlBase*) int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
odp.szGroup.w = LPGENW("Network");
odp.szTitle.w = LPGENW("News Aggregator");
diff --git a/plugins/NewsAggregator/Src/stdafx.h b/plugins/NewsAggregator/Src/stdafx.h index 40fc6f7002..60c5bcf593 100644 --- a/plugins/NewsAggregator/Src/stdafx.h +++ b/plugins/NewsAggregator/Src/stdafx.h @@ -60,7 +60,7 @@ Boston, MA 02111-1307, USA. #define DEFAULT_AVATARS_FOLDER "NewsAggregator"
#define DEFAULT_UPDATE_TIME 60
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern CDlgBase *pAddFeedDialog, *pImportDialog, *pExportDialog;
extern HNETLIBUSER hNetlibUser;
extern UINT_PTR timerId;
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index c3c550eb59..5923e9794f 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -123,7 +123,7 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_HELPMSG:
- CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_HELP), nullptr, HelpWindowDlgProc);
+ CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_HELP), nullptr, HelpWindowDlgProc);
break;
case IDCANCEL:
@@ -205,13 +205,13 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) INT_PTR testStringReplacer(WPARAM, LPARAM)
{
- CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_TEST_LINE), nullptr, TestWindowDlgProc);
+ CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_TEST_LINE), nullptr, TestWindowDlgProc);
return 0;
}
INT_PTR LoadFilesDlg(WPARAM, LPARAM)
{
- CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_ADD_FILE), nullptr, DlgProcFiles);
+ CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_ADD_FILE), nullptr, DlgProcFiles);
return 0;
}
@@ -241,7 +241,7 @@ void DoPropertySheet(MCONTACT hContact) /* contact info */
psp[0].dwSize = sizeof(PROPSHEETPAGE);
psp[0].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[0].hInstance = g_hInst;
+ psp[0].hInstance = g_hInstance;
psp[0].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_INFO);
psp[0].pszIcon = nullptr;
psp[0].pfnDlgProc = DlgProcContactInfo;
@@ -252,7 +252,7 @@ void DoPropertySheet(MCONTACT hContact) /* other settings */
psp[1].dwSize = sizeof(PROPSHEETPAGE);
psp[1].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[1].hInstance = g_hInst;
+ psp[1].hInstance = g_hInstance;
psp[1].pszTemplate = MAKEINTRESOURCEA(IDD_OTHER_STUFF);
psp[1].pszIcon = nullptr;
psp[1].pfnDlgProc = DlgProcOtherStuff;
@@ -263,7 +263,7 @@ void DoPropertySheet(MCONTACT hContact) /* copy contact */
psp[2].dwSize = sizeof(PROPSHEETPAGE);
psp[2].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[2].hInstance = g_hInst;
+ psp[2].hInstance = g_hInstance;
psp[2].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COPYEXPORT);
psp[2].pszIcon = nullptr;
psp[2].pfnDlgProc = DlgProcCopy;
@@ -274,7 +274,7 @@ void DoPropertySheet(MCONTACT hContact) /* files */
psp[3].dwSize = sizeof(PROPSHEETPAGE);
psp[3].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[3].hInstance = g_hInst;
+ psp[3].hInstance = g_hInstance;
psp[3].pszTemplate = MAKEINTRESOURCEA(IDD_ADD_FILE);
psp[3].pszIcon = nullptr;
psp[3].pfnDlgProc = DlgProcFiles;
@@ -285,7 +285,7 @@ void DoPropertySheet(MCONTACT hContact) /* propery sheet header.. dont touch !!!! */
PROPSHEETHEADERA psh = { sizeof(psh) };
psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
- psh.hInstance = g_hInst;
+ psh.hInstance = g_hInstance;
psh.pszIcon = MAKEINTRESOURCEA(IDI_MAIN);
if (!db_get_static(hContact, MODNAME, "Nick", nick, _countof(nick))) {
char title[256];
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index fd7de1059d..36e2d33361 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -7,7 +7,7 @@ #include "Version.h"
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInst;
+HINSTANCE g_hInstance;
int hLangpack;
PLUGININFOEX pluginInfoEx = {
@@ -63,7 +63,7 @@ int LCStatus = ID_STATUS_OFFLINE; int NimcOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szGroup.a = LPGEN("Plugins");
odp.szTitle.a = LPGEN("Non-IM Contacts");
@@ -94,7 +94,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC //
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD, LPVOID)
{
- g_hInst = hinst;
+ g_hInstance = hinst;
return TRUE;
}
@@ -121,7 +121,7 @@ extern "C" __declspec(dllexport) int Load() mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
- Icon_Register(g_hInst, LPGEN("Non-IM Contact"), icoList, _countof(icoList));
+ Icon_Register(g_hInstance, LPGEN("Non-IM Contact"), icoList, _countof(icoList));
HookEvent(ME_CLIST_DOUBLECLICKED, (MIRANDAHOOK)doubleClick);
HookEvent(ME_OPT_INITIALISE, NimcOptInit);
@@ -204,12 +204,14 @@ extern "C" __declspec(dllexport) int Unload(void) /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(MODNAME)
+ PLUGIN<CMPlugin>(MODNAME)
{
RegisterProtocol(PROTOTYPE_VIRTUAL);
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/Non-IM Contact/src/stdafx.h b/plugins/Non-IM Contact/src/stdafx.h index ef713be562..857bb66680 100644 --- a/plugins/Non-IM Contact/src/stdafx.h +++ b/plugins/Non-IM Contact/src/stdafx.h @@ -69,7 +69,7 @@ struct DLGTEMPLATEEX // Defines
//=======================================================
//General
-extern HINSTANCE g_hInst;
+extern HINSTANCE g_hInstance;
extern int LCStatus;
extern IconItem icoList[];
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 55c5e6379b..c1f6625f62 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -290,12 +290,6 @@ inline int Quotes_UnhookEvent(HANDLE h) return UnhookEvent(h);
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInstance = hinstDLL;
- return TRUE;
-}
-
EXTERN_C __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
EXTERN_C __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
@@ -338,13 +332,15 @@ EXTERN_C __declspec(dllexport) int Unload(void) /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(QUOTES_PROTOCOL_NAME)
+ PLUGIN<CMPlugin>(QUOTES_PROTOCOL_NAME)
{
RegisterProtocol(PROTOTYPE_VIRTUAL);
SetUniqueId(DB_STR_QUOTE_SYMBOL);
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/StartPosition/src/main.cpp b/plugins/StartPosition/src/main.cpp index 24ae37c529..e802790da2 100644 --- a/plugins/StartPosition/src/main.cpp +++ b/plugins/StartPosition/src/main.cpp @@ -23,10 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-
-HINSTANCE g_hInst;
+CMPlugin g_plugin;
+HINSTANCE g_hInstance;
int hLangpack;
-StartPositionPlugin* startposition;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -41,31 +40,23 @@ PLUGININFOEX pluginInfo = { {0x211f6277, 0x6f9b, 0x4b77, {0xa9, 0x39, 0x84, 0xd0, 0x4b, 0x26, 0xb3, 0x8c}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- return &pluginInfo;
+ return &pluginInfo;
}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
extern "C" __declspec(dllexport) int Load(void)
{
- mir_getLP(&pluginInfo);
- startposition = new StartPositionPlugin;
+ mir_getLP(&pluginInfo);
- startposition->positionClist();
+ g_plugin.positionClist();
- return 0;
+ return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
{
- delete startposition;
- startposition = nullptr;
-
- return 0;
+ return 0;
}
diff --git a/plugins/StartPosition/src/options.cpp b/plugins/StartPosition/src/options.cpp index da33fc6ef3..f797c1d030 100644 --- a/plugins/StartPosition/src/options.cpp +++ b/plugins/StartPosition/src/options.cpp @@ -1,124 +1,123 @@ #include "stdafx.h" - StartPositionOptions::StartPositionOptions() : - setTopPosition(MODULE_NAME, "CLEnableTop", 1), - setBottomPosition(MODULE_NAME, "CLEnableBottom", 0), - setSidePosition(MODULE_NAME, "CLEnableSide", 1), - clistAlign(MODULE_NAME, "CLAlign", ClistAlign::right), - setClistWidth(MODULE_NAME, "CLEnableWidth", 0), - setClistStartState(MODULE_NAME, "CLEnableState", 0), - clistState(MODULE_NAME, "CLState", ClistState::normal), - pixelsFromTop(MODULE_NAME, "CLpixelsTop", 3), - pixelsFromBottom(MODULE_NAME, "CLpixelsBottom", 3), - pixelsFromSide(MODULE_NAME, "CLpixelsSide", 3), - clistWidth(MODULE_NAME, "CLWidth", 180) -{} - -COptionsDlg::COptionsDlg(StartPositionPlugin* instance) : - CPluginDlgBase(g_hInst, IDD_OPTIONS, MODULE_NAME), - m_plugin(instance), - chkPositionTop(this, IDC_CLTOPENABLE), - edtPositionTop(this, IDC_CLTOP), - chkPositionBottom(this, IDC_CLBOTTOMENABLE), - edtPositionBottom(this, IDC_CLBOTTOM), - chkPositionSide(this, IDC_CLSIDEENABLE), - edtPositionSide(this, IDC_CLSIDE), - chkFromLeft(this, IDC_CLALIGNLEFT), - chkFromRight(this, IDC_CLALIGNRIGHT), - chkWidth(this, IDC_CLWIDTHENABLE), - edtWidth(this, IDC_CLWIDTH), - chkStartState(this, IDC_CLSTATEENABLE), - chkStartHidden(this, IDC_CLSTATETRAY), - chkStartNormal(this, IDC_CLSTATEOPENED) + setTopPosition(MODULE_NAME, "CLEnableTop", 1), + setBottomPosition(MODULE_NAME, "CLEnableBottom", 0), + setSidePosition(MODULE_NAME, "CLEnableSide", 1), + clistAlign(MODULE_NAME, "CLAlign", ClistAlign::right), + setClistWidth(MODULE_NAME, "CLEnableWidth", 0), + setClistStartState(MODULE_NAME, "CLEnableState", 0), + clistState(MODULE_NAME, "CLState", ClistState::normal), + pixelsFromTop(MODULE_NAME, "CLpixelsTop", 3), + pixelsFromBottom(MODULE_NAME, "CLpixelsBottom", 3), + pixelsFromSide(MODULE_NAME, "CLpixelsSide", 3), + clistWidth(MODULE_NAME, "CLWidth", 180) +{ +} + +COptionsDlg::COptionsDlg() : + CPluginDlgBase(g_hInstance, IDD_OPTIONS, MODULE_NAME), + chkPositionTop(this, IDC_CLTOPENABLE), + edtPositionTop(this, IDC_CLTOP), + chkPositionBottom(this, IDC_CLBOTTOMENABLE), + edtPositionBottom(this, IDC_CLBOTTOM), + chkPositionSide(this, IDC_CLSIDEENABLE), + edtPositionSide(this, IDC_CLSIDE), + chkFromLeft(this, IDC_CLALIGNLEFT), + chkFromRight(this, IDC_CLALIGNRIGHT), + chkWidth(this, IDC_CLWIDTHENABLE), + edtWidth(this, IDC_CLWIDTH), + chkStartState(this, IDC_CLSTATEENABLE), + chkStartHidden(this, IDC_CLSTATETRAY), + chkStartNormal(this, IDC_CLSTATEOPENED) { - CreateLink(chkPositionTop, m_plugin->spOptions.setTopPosition); - CreateLink(chkPositionBottom, m_plugin->spOptions.setBottomPosition); - CreateLink(chkPositionSide, m_plugin->spOptions.setSidePosition); - CreateLink(chkWidth, m_plugin->spOptions.setClistWidth); - CreateLink(chkStartState, m_plugin->spOptions.setClistStartState); - - CreateLink(edtPositionTop, m_plugin->spOptions.pixelsFromTop); - CreateLink(edtPositionBottom, m_plugin->spOptions.pixelsFromBottom); - CreateLink(edtPositionSide, m_plugin->spOptions.pixelsFromSide); - CreateLink(edtWidth, m_plugin->spOptions.clistWidth); - - chkPositionTop.OnChange = Callback(this, &COptionsDlg::onCheck_PositionTop); - chkPositionBottom.OnChange = Callback(this, &COptionsDlg::onCheck_PositionBottom); - chkPositionSide.OnChange = Callback(this, &COptionsDlg::onCheck_PositionSide); - chkWidth.OnChange = Callback(this, &COptionsDlg::onCheck_Width); - chkStartState.OnChange = Callback(this, &COptionsDlg::onCheck_StartState); + CreateLink(chkPositionTop, g_plugin.spOptions.setTopPosition); + CreateLink(chkPositionBottom, g_plugin.spOptions.setBottomPosition); + CreateLink(chkPositionSide, g_plugin.spOptions.setSidePosition); + CreateLink(chkWidth, g_plugin.spOptions.setClistWidth); + CreateLink(chkStartState, g_plugin.spOptions.setClistStartState); + + CreateLink(edtPositionTop, g_plugin.spOptions.pixelsFromTop); + CreateLink(edtPositionBottom, g_plugin.spOptions.pixelsFromBottom); + CreateLink(edtPositionSide, g_plugin.spOptions.pixelsFromSide); + CreateLink(edtWidth, g_plugin.spOptions.clistWidth); + + chkPositionTop.OnChange = Callback(this, &COptionsDlg::onCheck_PositionTop); + chkPositionBottom.OnChange = Callback(this, &COptionsDlg::onCheck_PositionBottom); + chkPositionSide.OnChange = Callback(this, &COptionsDlg::onCheck_PositionSide); + chkWidth.OnChange = Callback(this, &COptionsDlg::onCheck_Width); + chkStartState.OnChange = Callback(this, &COptionsDlg::onCheck_StartState); } void COptionsDlg::OnInitDialog() { - if (m_plugin->spOptions.clistState == ClistState::normal) - chkStartNormal.SetState(true); - else - chkStartHidden.SetState(true); - - chkStartHidden.Enable(chkStartState.GetState()); - chkStartNormal.Enable(chkStartState.GetState()); - - if (m_plugin->spOptions.clistAlign == ClistAlign::right) - chkFromRight.SetState(true); - else - chkFromLeft.SetState(true); - - chkFromLeft.Enable(chkPositionSide.GetState()); - chkFromRight.Enable(chkPositionSide.GetState()); - - edtPositionTop.Enable(chkPositionTop.GetState()); - edtPositionBottom.Enable(chkPositionBottom.GetState()); - edtPositionSide.Enable(chkPositionSide.GetState()); - edtWidth.Enable(chkWidth.GetState()); + if (g_plugin.spOptions.clistState == ClistState::normal) + chkStartNormal.SetState(true); + else + chkStartHidden.SetState(true); + + chkStartHidden.Enable(chkStartState.GetState()); + chkStartNormal.Enable(chkStartState.GetState()); + + if (g_plugin.spOptions.clistAlign == ClistAlign::right) + chkFromRight.SetState(true); + else + chkFromLeft.SetState(true); + + chkFromLeft.Enable(chkPositionSide.GetState()); + chkFromRight.Enable(chkPositionSide.GetState()); + + edtPositionTop.Enable(chkPositionTop.GetState()); + edtPositionBottom.Enable(chkPositionBottom.GetState()); + edtPositionSide.Enable(chkPositionSide.GetState()); + edtWidth.Enable(chkWidth.GetState()); } void COptionsDlg::OnApply() { - removeOldSettings(); + removeOldSettings(); - if (chkStartNormal.GetState()) - m_plugin->spOptions.clistState = ClistState::normal; - else - m_plugin->spOptions.clistState = ClistState::hidden; + if (chkStartNormal.GetState()) + g_plugin.spOptions.clistState = ClistState::normal; + else + g_plugin.spOptions.clistState = ClistState::hidden; - if (chkFromRight.GetState()) - m_plugin->spOptions.clistAlign = ClistAlign::right; - else - m_plugin->spOptions.clistAlign = ClistAlign::left; + if (chkFromRight.GetState()) + g_plugin.spOptions.clistAlign = ClistAlign::right; + else + g_plugin.spOptions.clistAlign = ClistAlign::left; } void COptionsDlg::removeOldSettings() { - m_plugin->delSetting("CLEnable"); - m_plugin->delSetting("CLuseLastWidth"); + g_plugin.delSetting("CLEnable"); + g_plugin.delSetting("CLuseLastWidth"); } void COptionsDlg::onCheck_PositionTop(CCtrlCheck*) { - edtPositionTop.Enable(chkPositionTop.GetState()); + edtPositionTop.Enable(chkPositionTop.GetState()); } void COptionsDlg::onCheck_PositionBottom(CCtrlCheck*) { - edtPositionBottom.Enable(chkPositionBottom.GetState()); + edtPositionBottom.Enable(chkPositionBottom.GetState()); } void COptionsDlg::onCheck_PositionSide(CCtrlCheck*) { - edtPositionSide.Enable(chkPositionSide.GetState()); - chkFromLeft.Enable(chkPositionSide.GetState()); - chkFromRight.Enable(chkPositionSide.GetState()); + edtPositionSide.Enable(chkPositionSide.GetState()); + chkFromLeft.Enable(chkPositionSide.GetState()); + chkFromRight.Enable(chkPositionSide.GetState()); } void COptionsDlg::onCheck_Width(CCtrlCheck*) { - edtWidth.Enable(chkWidth.GetState()); + edtWidth.Enable(chkWidth.GetState()); } void COptionsDlg::onCheck_StartState(CCtrlCheck*) { - chkStartHidden.Enable(chkStartState.GetState()); - chkStartNormal.Enable(chkStartState.GetState()); + chkStartHidden.Enable(chkStartState.GetState()); + chkStartNormal.Enable(chkStartState.GetState()); } diff --git a/plugins/StartPosition/src/options.h b/plugins/StartPosition/src/options.h index 9208157f24..ed3dcfb5f3 100644 --- a/plugins/StartPosition/src/options.h +++ b/plugins/StartPosition/src/options.h @@ -77,7 +77,7 @@ class COptionsDlg : public CPluginDlgBase CCtrlCheck chkStartState, chkStartHidden, chkStartNormal; public: - COptionsDlg(StartPositionPlugin* instance); + COptionsDlg(); void OnInitDialog() override; void OnApply() override; @@ -90,6 +90,4 @@ private: void onCheck_PositionSide(CCtrlCheck*); void onCheck_Width(CCtrlCheck*); void onCheck_StartState(CCtrlCheck*); - - StartPositionPlugin* m_plugin; }; diff --git a/plugins/StartPosition/src/startposition.cpp b/plugins/StartPosition/src/startposition.cpp index 3f661f9f96..26c845b5ca 100644 --- a/plugins/StartPosition/src/startposition.cpp +++ b/plugins/StartPosition/src/startposition.cpp @@ -1,57 +1,56 @@ #include "stdafx.h" - -StartPositionPlugin::StartPositionPlugin() : - PLUGIN<StartPositionPlugin>(MODULE_NAME) +CMPlugin::CMPlugin() : + PLUGIN<CMPlugin>(MODULE_NAME) { - HookPluginEvent(ME_OPT_INITIALISE, &StartPositionPlugin::OnOptionsInit); + HookPluginEvent(ME_OPT_INITIALISE, &CMPlugin::OnOptionsInit); } -void StartPositionPlugin::positionClist() +void CMPlugin::positionClist() { - ClistOptions clOptions; - - if (spOptions.setClistStartState) - clOptions.state = static_cast<BYTE>(spOptions.clistState); - - if (spOptions.setClistWidth && spOptions.clistWidth > 0) - clOptions.width = static_cast<DWORD>(spOptions.clistWidth); - else - spOptions.clistWidth = static_cast<DWORD>(clOptions.width); - - if (spOptions.setTopPosition || spOptions.setBottomPosition || spOptions.setSidePosition) - clOptions.isDocked = false; - - if (spOptions.setTopPosition) - clOptions.y = static_cast<DWORD>(spOptions.pixelsFromTop); - - RECT WorkArea; - SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0); - - if (spOptions.setBottomPosition) { - if (spOptions.setTopPosition) - clOptions.height = WorkArea.bottom - WorkArea.top - spOptions.pixelsFromTop - spOptions.pixelsFromBottom; - else - clOptions.y = WorkArea.bottom - spOptions.pixelsFromBottom - clOptions.height; - } - - if (spOptions.setSidePosition) { - if (spOptions.clistAlign == ClistAlign::right) - clOptions.x = WorkArea.right - spOptions.clistWidth - spOptions.pixelsFromSide; - else - clOptions.x = WorkArea.left + spOptions.pixelsFromSide; - } + ClistOptions clOptions; + + if (spOptions.setClistStartState) + clOptions.state = static_cast<BYTE>(spOptions.clistState); + + if (spOptions.setClistWidth && spOptions.clistWidth > 0) + clOptions.width = static_cast<DWORD>(spOptions.clistWidth); + else + spOptions.clistWidth = static_cast<DWORD>(clOptions.width); + + if (spOptions.setTopPosition || spOptions.setBottomPosition || spOptions.setSidePosition) + clOptions.isDocked = false; + + if (spOptions.setTopPosition) + clOptions.y = static_cast<DWORD>(spOptions.pixelsFromTop); + + RECT WorkArea; + SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0); + + if (spOptions.setBottomPosition) { + if (spOptions.setTopPosition) + clOptions.height = WorkArea.bottom - WorkArea.top - spOptions.pixelsFromTop - spOptions.pixelsFromBottom; + else + clOptions.y = WorkArea.bottom - spOptions.pixelsFromBottom - clOptions.height; + } + + if (spOptions.setSidePosition) { + if (spOptions.clistAlign == ClistAlign::right) + clOptions.x = WorkArea.right - spOptions.clistWidth - spOptions.pixelsFromSide; + else + clOptions.x = WorkArea.left + spOptions.pixelsFromSide; + } } -int StartPositionPlugin::OnOptionsInit(WPARAM wParam, LPARAM) +int CMPlugin::OnOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {}; - odp.hInstance = g_hInst; - odp.szGroup.a = LPGEN("Contact list"); - odp.szTitle.a = LPGEN("Start position"); - odp.pDialog = new COptionsDlg(this); - odp.flags = ODPF_BOLDGROUPS; - Options_AddPage(wParam, &odp); - - return 0; + OPTIONSDIALOGPAGE odp = {}; + odp.hInstance = g_hInstance; + odp.szGroup.a = LPGEN("Contact list"); + odp.szTitle.a = LPGEN("Start position"); + odp.pDialog = new COptionsDlg(); + odp.flags = ODPF_BOLDGROUPS; + Options_AddPage(wParam, &odp); + + return 0; } diff --git a/plugins/StartPosition/src/startposition.h b/plugins/StartPosition/src/startposition.h index b4ce8dc896..fe5235e521 100644 --- a/plugins/StartPosition/src/startposition.h +++ b/plugins/StartPosition/src/startposition.h @@ -19,16 +19,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" - -class StartPositionPlugin : public PLUGIN<StartPositionPlugin> +class CMPlugin : public PLUGIN<CMPlugin> { - friend COptionsDlg; + friend COptionsDlg; public: - StartPositionPlugin(); + CMPlugin(); - int __cdecl OnOptionsInit(WPARAM, LPARAM); - void positionClist(); + int __cdecl OnOptionsInit(WPARAM, LPARAM); + void positionClist(); - StartPositionOptions spOptions; + StartPositionOptions spOptions; }; diff --git a/plugins/StartPosition/src/stdafx.h b/plugins/StartPosition/src/stdafx.h index 5ecea86a97..a4995fad9b 100644 --- a/plugins/StartPosition/src/stdafx.h +++ b/plugins/StartPosition/src/stdafx.h @@ -33,11 +33,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "resource.h"
#include "version.h"
-extern HINSTANCE g_hInst;
+extern HINSTANCE g_hInstance;
#define MODULE_NAME "StartPosition"
#define CLIST_MODULE_NAME "CList"
-class StartPositionPlugin;
#include "options.h"
#include "startposition.h"
diff --git a/plugins/Weather/src/stdafx.h b/plugins/Weather/src/stdafx.h index 17eca030b2..a6e0354d14 100644 --- a/plugins/Weather/src/stdafx.h +++ b/plugins/Weather/src/stdafx.h @@ -351,7 +351,7 @@ typedef struct DATALIST WIDATALIST; extern WIDATALIST *WIHead, *WITail;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern HWND hPopupWindow, hWndSetup;
extern MYOPTIONS opt;
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index 00ceba9e93..afa14ccf0c 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -31,7 +31,7 @@ belong to any other file. WIDATALIST *WIHead;
WIDATALIST *WITail;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
HWND hPopupWindow;
HANDLE hHookWeatherUpdated;
@@ -58,7 +58,9 @@ BOOL ModuleLoaded; HANDLE hTBButton = nullptr;
+/////////////////////////////////////////////////////////////////////////////////////////
// plugin info
+
static const PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
@@ -73,18 +75,16 @@ static const PLUGININFOEX pluginInfoEx = {0x6b612a34, 0xdcf2, 0x4e32, {0x85, 0xcf, 0xb6, 0xfd, 0x0, 0x6b, 0x74, 0x5e}}
};
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-
extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+
+/////////////////////////////////////////////////////////////////////////////////////////
int WeatherShutdown(WPARAM, LPARAM)
{
@@ -152,29 +152,6 @@ void InitVar() ModuleLoaded = FALSE;
}
-// unload function
-extern "C" int __declspec(dllexport) Unload(void)
-{
- DestroyMwin();
- DestroyWindow(hPopupWindow);
-
- DestroyHookableEvent(hHookWeatherUpdated);
- DestroyHookableEvent(hHookWeatherError);
-
- NetlibHttpDisconnect();
- Netlib_CloseHandle(hNetlibUser);
-
- DestroyUpdateList();
- DestroyOptions();
- DestroyWIList(); // unload all ini data from memory
-
- WindowList_Destroy(hDataWindowList);
- WindowList_Destroy(hWindowList);
-
- CloseHandle(hUpdateMutex);
- return 0;
-}
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfoEx);
@@ -227,17 +204,42 @@ extern "C" int __declspec(dllexport) Load(void) wchar_t SvcFunc[100];
mir_snwprintf(SvcFunc, L"%s__PopupWindow", _A2W(WEATHERPROTONAME));
hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, hInst, nullptr);
+ CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInstance, nullptr);
SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
+// unload function
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ DestroyMwin();
+ DestroyWindow(hPopupWindow);
+
+ DestroyHookableEvent(hHookWeatherUpdated);
+ DestroyHookableEvent(hHookWeatherError);
+
+ NetlibHttpDisconnect();
+ Netlib_CloseHandle(hNetlibUser);
+
+ DestroyUpdateList();
+ DestroyOptions();
+ DestroyWIList(); // unload all ini data from memory
+
+ WindowList_Destroy(hDataWindowList);
+ WindowList_Destroy(hWindowList);
+
+ CloseHandle(hUpdateMutex);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(WEATHERPROTONAME)
+ PLUGIN<CMPlugin>(WEATHERPROTONAME)
{
opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true);
RegisterProtocol((opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL);
@@ -245,3 +247,5 @@ struct CMPlugin : public CMPluginBase }
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 59f5720d22..87a9374cbd 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -200,7 +200,7 @@ INT_PTR WeatherCreateAdvancedSearchUI(WPARAM, LPARAM lParam) {
HWND parent = (HWND)lParam;
if (parent)
- return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCHCITY), parent, WeatherSearchAdvancedDlgProc, 0);
+ return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SEARCHCITY), parent, WeatherSearchAdvancedDlgProc, 0);
return 0;
}
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index efde7bc6d2..e685f3d4de 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -418,7 +418,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM) else {
// if the dialog box is not opened, open a new one
if (IsMyContact(wParam))
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT), nullptr, DlgProcChange, (LPARAM)wParam);
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_EDIT), nullptr, DlgProcChange, (LPARAM)wParam);
}
return 0;
diff --git a/plugins/Weather/src/weather_icons.cpp b/plugins/Weather/src/weather_icons.cpp index 1840dcde66..de876f00c1 100644 --- a/plugins/Weather/src/weather_icons.cpp +++ b/plugins/Weather/src/weather_icons.cpp @@ -39,7 +39,7 @@ static IconItem iconList[] = void InitIcons(void)
{
- Icon_Register(hInst, WEATHERPROTONAME, iconList, _countof(iconList), WEATHERPROTONAME);
+ Icon_Register(g_hInstance, WEATHERPROTONAME, iconList, _countof(iconList), WEATHERPROTONAME);
}
HICON LoadIconEx(const char* name, bool big)
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 303fa5366c..7e79387f55 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -518,7 +518,7 @@ bool LoadWIData(bool dial) if (WIHead == nullptr) {
// no ini found, display an error message box.
if (dial)
- hWndSetup = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETUP), nullptr, DlgProcSetup);
+ hWndSetup = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_SETUP), nullptr, DlgProcSetup);
else
MessageBox(nullptr,
TranslateT("No update data file is found. Please check your Plugins\\Weather directory."),
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index 6a5151429f..0775bcfff6 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -48,7 +48,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara data->hContact = (DWORD_PTR)((LPCREATESTRUCT)lParam)->lpCreateParams;
data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD,
- 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, nullptr, hInst, nullptr);
+ 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, nullptr, g_hInstance, nullptr);
if (data->hAvt) SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact);
break;
@@ -238,7 +238,7 @@ static void addWindow(MCONTACT hContact) db_free(&dbv);
HWND hWnd = CreateWindow(L"WeatherFrame", L"", WS_CHILD | WS_VISIBLE,
- 0, 0, 10, 10, pcli->hwndContactList, nullptr, hInst, (void*)hContact);
+ 0, 0, 10, 10, pcli->hwndContactList, nullptr, g_hInstance, (void*)hContact);
WindowList_Add(hMwinWindowList, hWnd, hContact);
CLISTFrame Frame = { 0 };
@@ -308,7 +308,7 @@ void InitMwin(void) wndclass.lpfnWndProc = wndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInst;
+ wndclass.hInstance = g_hInstance;
wndclass.hIcon = nullptr;
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = nullptr; //(HBRUSH)(COLOR_3DFACE+1);
@@ -362,7 +362,7 @@ void DestroyMwin(void) if (frameId)
CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);
}
- UnregisterClass(L"WeatherFrame", hInst);
+ UnregisterClass(L"WeatherFrame", g_hInstance);
WindowList_Destroy(hMwinWindowList);
UnhookEvent(hFontHook);
}
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp index 8f4ec006ef..981b8e9f3e 100644 --- a/plugins/Weather/src/weather_opt.cpp +++ b/plugins/Weather/src/weather_opt.cpp @@ -483,7 +483,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l // display the menu
button = GetDlgItem(hdlg, LOWORD(wParam));
GetWindowRect(button, &pos);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TMMENU));
+ hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_TMMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr)) {
@@ -511,7 +511,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l // left click action selection menu
button = GetDlgItem(hdlg, IDC_RESET);
GetWindowRect(button, &pos);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TMENU));
+ hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_TMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr)) {
@@ -571,7 +571,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
// plugin options
odp.position = 95600;
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp index 6ab96255b2..32d0969307 100644 --- a/plugins/Weather/src/weather_popup.cpp +++ b/plugins/Weather/src/weather_popup.cpp @@ -256,7 +256,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) SaveOptions();
// click actions
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
GetMenuString(hMenu1, opt.LeftClickAction, str, _countof(str), MF_BYCOMMAND);
SetDlgItemText(hdlg, IDC_LeftClick, TranslateW(str));
@@ -330,7 +330,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) button = GetDlgItem(hdlg, IDC_RightClick);
GetWindowRect(button, &pos);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
SelectMenuItem(hMenu1, opt.RightClickAction);
@@ -339,7 +339,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) opt.RightClickAction = ID;
DestroyMenu(hMenu);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
GetMenuString(hMenu1, opt.RightClickAction, str, _countof(str), MF_BYCOMMAND);
SetDlgItemText(hdlg, IDC_RightClick, TranslateW(str));
@@ -351,7 +351,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) button = GetDlgItem(hdlg, IDC_LeftClick);
GetWindowRect(button, &pos);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
SelectMenuItem(hMenu1, opt.LeftClickAction);
@@ -359,7 +359,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) if (ID) opt.LeftClickAction = ID;
DestroyMenu(hMenu);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
GetMenuString(hMenu1, opt.LeftClickAction, str, _countof(str), MF_BYCOMMAND);
SetDlgItemText(hdlg, IDC_LeftClick, TranslateW(str));
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp index 32b4dbf87b..694b03b068 100644 --- a/plugins/Weather/src/weather_userinfo.cpp +++ b/plugins/Weather/src/weather_userinfo.cpp @@ -143,7 +143,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L GetWindowRect(hList, &rc);
ListView_SetColumnWidth(hList, 1, ListView_GetColumnWidth(hList, 1) + (int)LOWORD(lParam) - (rc.right - rc.left));
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_BRIEF), BriefDlgResizer);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_BRIEF), BriefDlgResizer);
}
break;
@@ -294,7 +294,7 @@ static INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case IDC_MOREDETAIL:
HWND hMoreDataDlg = WindowList_Find(hDataWindowList, hContact);
if (hMoreDataDlg == nullptr)
- hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, hContact);
+ hMoreDataDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, hContact);
else {
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
@@ -314,7 +314,7 @@ static INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPA int UserInfoInit(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.position = 100000000;
odp.szTitle.a = WEATHERPROTONAME;
@@ -348,7 +348,7 @@ int BriefInfo(WPARAM wParam, LPARAM) SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
}
- else hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, (LPARAM)wParam);
+ else hMoreDataDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, (LPARAM)wParam);
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_DATALIST), 0);
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_MTEXT), 1);
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index b56ba33794..978e938e0a 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -74,13 +74,6 @@ void ChangeContactStatus(int con_stat) }
/*****************************************************************************/
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-/*****************************************************************************/
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
@@ -128,7 +121,7 @@ extern "C" int __declspec(dllexport) Load() HookEvent(ME_CLIST_DOUBLECLICKED, Doubleclick);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_CONTEXT));
hRichEd = LoadLibrary(L"Msftedit.dll");
/*TIMERS*/
@@ -171,7 +164,7 @@ extern "C" int __declspec(dllexport) Load() /*DISABLE WEBVIEW*/
SET_UID(mi, 0xdedeb697, 0xfc10, 0x4622, 0x8b, 0x97, 0x74, 0x39, 0x32, 0x68, 0xa7, 0x7b);
CreateServiceFunction("DisableWebview", AutoUpdateMCmd);
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
if (db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0))
mi.name.w = LPGENW("Auto update disabled");
else
@@ -183,7 +176,7 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0xf324ede, 0xfdf, 0x498a, 0x8f, 0x49, 0x6d, 0x2a, 0x9f, 0xda, 0x58, 0x6);
CreateServiceFunction("UpdateAll", UpdateAllMenuCommand);
mi.position = 500090002;
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = LPGENW("Update all Webview sites");
mi.pszService = "UpdateAll";
Menu_AddMainMenuItem(&mi);
@@ -192,7 +185,7 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0x1fa5fa21, 0x2ee1, 0x4372, 0xae, 0x3e, 0x3b, 0x96, 0xac, 0xd, 0xe8, 0x49);
CreateServiceFunction("MarkAllSitesRead", MarkAllReadMenuCommand);
mi.position = 500090099;
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MARKALLREAD));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MARKALLREAD));
mi.name.w = LPGENW("Mark all Webview sites as read");
mi.pszService = "MarkAllSitesRead";
Menu_AddMainMenuItem(&mi);
@@ -201,7 +194,7 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0xfed046a8, 0xaae5, 0x4cbe, 0xa8, 0xc, 0x3c, 0x50, 0x3e, 0x3e, 0x9b, 0x15);
CreateServiceFunction("OpenCacheFolder", OpenCacheDir);
mi.position = 500090099;
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_FOLDER));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_FOLDER));
mi.name.w = LPGENW("Open cache folder");
mi.pszService = "OpenCacheFolder";
Menu_AddMainMenuItem(&mi);
@@ -213,7 +206,7 @@ extern "C" int __declspec(dllexport) Load() wchar_t countername[100];
mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
mi.position = 600090099;
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = countername;
mi.pszService = "Countdown";
hMenuItemCountdown = Menu_AddMainMenuItem(&mi);
@@ -225,7 +218,7 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0xadc6a9a4, 0xdf7, 0x4f63, 0x89, 0x11, 0x8e, 0x42, 0x1d, 0xd6, 0x29, 0x31);
CreateServiceFunction("Open web page", WebsiteMenuCommand);
mi.position = 100;
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_URL));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_URL));
mi.pszService = "Open web page";
mi.name.w = LPGENW("Open web page");
Menu_AddContactMenuItem(&mi, MODULENAME);
@@ -233,42 +226,42 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0x9d803e61, 0xc929, 0x4c6e, 0x9e, 0x7, 0x93, 0x0, 0xab, 0x14, 0x13, 0x50);
CreateServiceFunction("OpenClose Window", DataWndMenuCommand);
mi.pszService = "OpenClose Window";
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SHOW_HIDE));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SHOW_HIDE));
mi.name.w = LPGENW("Open/Close window");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0x3840cc71, 0xcc85, 0x448d, 0xb5, 0xc8, 0x1a, 0x7d, 0xfe, 0xf0, 0x8, 0x85);
mi.position = 2222220;
mi.pszService = "UpdateData";
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATE));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATE));
mi.name.w = LPGENW("Update data");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0xd1ab586c, 0x2c71, 0x429c, 0xb1, 0x79, 0x7b, 0x3a, 0x1d, 0x4a, 0xc1, 0x7d);
CreateServiceFunction("ContactOptions", CntOptionsMenuCommand);
mi.pszService = "ContactOptions";
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_OPTIONS));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OPTIONS));
mi.name.w = LPGENW("Contact options");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0xe4cda597, 0x9def, 0x4f54, 0x8a, 0xc6, 0x69, 0x3b, 0x5a, 0x7d, 0x77, 0xb6);
CreateServiceFunction("ContactAlertOpts", CntAlertMenuCommand);
mi.pszService = "ContactAlertOpts";
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ALERT));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ALERT));
mi.name.w = LPGENW("Contact alert options");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0x63fdeed8, 0xf880, 0x423f, 0x95, 0xae, 0x20, 0x8c, 0x86, 0x3c, 0x5, 0xd8);
CreateServiceFunction("PingWebsite", PingWebsiteMenuCommand);
mi.pszService = "PingWebsite";
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_PING));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_PING));
mi.name.w = LPGENW("Ping web site");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0x28fd36de, 0x6ce1, 0x43d0, 0xa1, 0x6e, 0x98, 0x71, 0x53, 0xe8, 0xc9, 0xf4);
CreateServiceFunction("StopDataProcessing", StpPrcssMenuCommand);
mi.pszService = "StopDataProcessing";
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_STOP));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_STOP));
mi.name.w = LPGENW("Stop data processing");
Menu_AddContactMenuItem(&mi, MODULENAME);
@@ -284,13 +277,15 @@ extern "C" int __declspec(dllexport) Load() /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(MODULENAME)
+ PLUGIN<CMPlugin>(MODULENAME)
{
RegisterProtocol(PROTOTYPE_PROTOCOL);
SetUniqueId("PreserveName");
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index bd83ccab8b..be2b8635bc 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -38,7 +38,7 @@ UINT_PTR Countdown; LOGFONT g_lf;
HFONT h_font;
HWND ContactHwnd;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
HMENU hMenu;
int bpStatus;
HGENMENU hMenuItem1;
@@ -54,14 +54,14 @@ void ChangeMenuItem1() else
ptszName = LPGENW("Auto update disabled");
- Menu_ModifyItem(hMenuItem1, ptszName, LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)));
+ Menu_ModifyItem(hMenuItem1, ptszName, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE)));
}
/*****************************************************************************/
void ChangeMenuItemCountdown()
{
// countdown
- HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
+ HICON hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
wchar_t countername[100];
mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
@@ -185,9 +185,9 @@ int Doubleclick(WPARAM wParam, LPARAM) SetFocus(hwndDlg);
}
else {
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
+ hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
@@ -293,7 +293,7 @@ void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD) static int OptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
odp.szGroup.a = LPGEN("Network");
odp.szTitle.a = MODULENAME;
@@ -368,8 +368,8 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) }
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
@@ -474,7 +474,7 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM) return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
@@ -489,7 +489,7 @@ INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM) return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h index b144ade234..c9bfd998a4 100644 --- a/plugins/WebView/src/webview.h +++ b/plugins/WebView/src/webview.h @@ -143,7 +143,6 @@ extern UINT_PTR timerId, Countdown; extern LOGFONT g_lf;
extern HFONT h_font;
extern HWND ContactHwnd;
-extern HINSTANCE hInst;
extern HMENU hMenu;
extern int bpStatus;
extern HNETLIBUSER hNetlibUser;
@@ -157,7 +156,6 @@ void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD); void SavewinSettings(void);
void ValidatePosition(HWND hwndDlg);
int ModulesLoaded(WPARAM wParam, LPARAM lParam);
-void ChangeMenuItem3();
wchar_t* FixButtonText(wchar_t *url, size_t len);
int ContactMenuItemUpdateData (WPARAM wParam, LPARAM lParam);
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index d3dc4fc415..a21b19f693 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -122,7 +122,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) else mir_wstrcpy(ppd.lptzContactName, _A2W(MODULENAME));
ppd.lchContact = wParam;
- ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE));
+ ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
wchar_t *displaytext = (wchar_t*)lParam;
if ((mir_wstrlen(displaytext) == MAX_SECONDLINE) || (mir_wstrlen(displaytext) > MAX_SECONDLINE))
@@ -413,7 +413,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn else if (eventIndex == 1) { // webpage changed
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(hInst, cachepath, _countof(cachepath));
+ GetModuleFileName(g_hInstance, cachepath, _countof(cachepath));
wchar_t *cacheend = wcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
@@ -625,7 +625,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if (((strstr(tempraw, Alerttempstring)) != nullptr) && ((strstr(tempraw, Alerttempstring2)) != nullptr)) {
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(hInst, cachepath, _countof(cachepath));
+ GetModuleFileName(g_hInstance, cachepath, _countof(cachepath));
wchar_t *cacheend = wcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
@@ -763,9 +763,9 @@ int DataWndAlertCommand(WPARAM wParam, LPARAM) if ( WindowList_Find(hWindowList, hContact))
return 0;
- HWND hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
+ HWND hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 2bd17e4863..425b43e7ae 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -39,7 +39,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SetWindowText(hwndDlg, TranslateT("Find"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hInst, MAKEINTRESOURCE(IDI_FIND)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_FIND)));
return TRUE;
case WM_COMMAND:
@@ -175,36 +175,36 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else preservename[0] = 0;
SetWindowTextA(hwndDlg, preservename);
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE)));
// //////
COLORREF colour = BackgoundClr;
COLORREF txtcolor;
SendDlgItemMessage(hwndDlg, IDC_DATA, EM_SETBKGNDCOLOR, 0, colour);
- SendDlgItemMessage(hwndDlg, IDC_UPDATE_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_UPDATE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_UPDATE_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_UPDATE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_UPDATE_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Update data"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_FIND), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_FIND), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Find"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_OPTIONS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_OPTIONS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Contact options"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_ALERT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ALERT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Alert options"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STOP, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Stop processing"), BATF_UNICODE);
SendDlgItemMessage(hwndDlg, IDC_OPEN_URL, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Click here to open this URL in a browser window."), BATF_UNICODE);
if (!db_get_b(hContact2, MODULENAME, ON_TOP_KEY, 0)) {
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Stick to the front"), BATF_UNICODE);
}
else {
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Disable stick to the front"), BATF_UNICODE);
}
@@ -368,7 +368,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA hTopmost = HWND_TOPMOST;
ptszToolTip = TranslateT("Disable stick to the front");
}
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BUTTONADDTOOLTIP, (WPARAM)ptszToolTip, BATF_UNICODE);
SetWindowPos(hwndDlg, hTopmost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
}
@@ -376,7 +376,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_FIND_BUTTON:
{
- HWND hwndFind = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FIND), hwndDlg, DlgProcFind, (LPARAM) wParam);
+ HWND hwndFind = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FIND), hwndDlg, DlgProcFind, (LPARAM) wParam);
ShowWindow(hwndFind, SW_SHOW);
EnableWindow(GetDlgItem(hwndDlg, IDC_FIND_BUTTON), 0);
}
@@ -384,7 +384,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_OPTIONS_BUTTON:
if (hContact = FindContactByUrl(hwndDlg)) {
- ContactHwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), hwndDlg, DlgProcContactOpt, (LPARAM) hContact);
+ ContactHwnd = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_OPT), hwndDlg, DlgProcContactOpt, (LPARAM) hContact);
ShowWindow(ContactHwnd, SW_SHOW);
SetActiveWindow(ContactHwnd);
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTIONS_BUTTON), 0);
@@ -394,7 +394,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_ALERT_BUTTON:
if (hContact = FindContactByUrl(hwndDlg)) {
- HWND hwndAlertOpt = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), hwndDlg, DlgProcAlertOpt, (LPARAM) hContact);
+ HWND hwndAlertOpt = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ALRT_OPT), hwndDlg, DlgProcAlertOpt, (LPARAM) hContact);
ShowWindow(hwndAlertOpt, SW_SHOW);
SetActiveWindow(hwndAlertOpt);
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_BUTTON), 0);
@@ -431,7 +431,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return 0;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
InvalidateRect(hwndDlg, nullptr, TRUE);
// global
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index 4ad9519b4a..348185a01d 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -207,7 +207,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) }
ppd.lchContact = NULL;
mir_wstrcpy(ppd.lptzContactName, _A2W(MODULENAME));
- ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE));
+ ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
mir_wstrcpy(ppd.lptzText, TranslateT("This is a preview popup."));
ppd.colorBack = BGColour;
ppd.colorText = TextColour;
@@ -279,7 +279,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SetWindowText(hwndDlg, TranslateT("Alert options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_ALERT)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ALERT)));
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_APPLY), 0);
@@ -819,7 +819,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowText(hwndDlg, TranslateT("Contact options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_OPTIONS)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OPTIONS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_APPLY), 0);
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 3d0f27c556..277683ea74 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -80,7 +80,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) // TEST GET NAME FOR CACHE wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH]; - GetModuleFileName(hInst, cachepath, _countof(cachepath)); + GetModuleFileName(g_hInstance, cachepath, _countof(cachepath)); wchar_t *cacheend = wcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; @@ -118,7 +118,7 @@ int SiteDeleted(WPARAM wParam, LPARAM) // TEST GET NAME FOR CACHE wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50]; - GetModuleFileName(hInst, cachepath, _countof(cachepath)); + GetModuleFileName(g_hInstance, cachepath, _countof(cachepath)); wchar_t *cacheend = wcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; @@ -143,7 +143,7 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM) { //GET NAME FOR CACHE wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH]; - GetModuleFileName(hInst, cachepath, _countof(cachepath)); + GetModuleFileName(g_hInstance, cachepath, _countof(cachepath)); wchar_t *cacheend = wcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; @@ -292,7 +292,7 @@ INT_PTR BPLoadIcon(WPARAM wParam, LPARAM) default: return 0; } - return (INT_PTR)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, + return (INT_PTR)LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0); } diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 6bc632e730..7b84b15c44 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -220,7 +220,7 @@ void __cdecl BadConnection(void *Param) SetEvent(MyParam.ThreadRunningEV);
__try {
- hBadConnect = CreateDialogParam(YAMNVar.hInst, MAKEINTRESOURCE(IDD_DLGBADCONNECT), nullptr, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
+ hBadConnect = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DLGBADCONNECT), nullptr, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
Window_SetIcon_IcoLib(hBadConnect, g_GetIconHandle(3));
#ifdef DEBUG_SYNCHRO
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index d26db00f7b..7ecab8374d 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -1604,7 +1604,7 @@ void __cdecl ShowEmailThread(void *Param) } else { CREADTEVIEWMESSAGEWINDOW: - MyParam.mail->MsgWindow = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), nullptr, DlgProcYAMNShowMessage, (LPARAM)&MyParam); + MyParam.mail->MsgWindow = CreateDialogParamW(g_hInstance, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), nullptr, DlgProcYAMNShowMessage, (LPARAM)&MyParam); WindowList_Add(YAMNVar.MessageWnds, MyParam.mail->MsgWindow); MSG msg; while (GetMessage(&msg, nullptr, 0, 0)) { @@ -2318,7 +2318,7 @@ void __cdecl MailBrowser(void *Param) WndFound = TRUE; if ((hMailBrowser == nullptr) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) { - hMailBrowser = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), nullptr, DlgProcYAMNMailBrowser, (LPARAM)&MyParam); + hMailBrowser = CreateDialogParamW(g_hInstance, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), nullptr, DlgProcYAMNMailBrowser, (LPARAM)&MyParam); Window_SetIcon_IcoLib(hMailBrowser, g_GetIconHandle(2)); MoveWindow(hMailBrowser, PosX, PosY, SizeX, SizeY, TRUE); } diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index edfbf9c6ec..7491051500 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -23,6 +23,7 @@ int YAMN_STATUS; BOOL UninstallPlugins; HANDLE hAccountFolder; +HINSTANCE g_hInstance; HINSTANCE *hDllPlugins; static int iDllPlugins = 0; @@ -32,19 +33,6 @@ YAMN_VARIABLES YAMNVar; CLIST_INTERFACE *pcli; int hLangpack; -PLUGININFOEX pluginInfo = { - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - // {B047A7E5-027A-4CFC-8B18-EDA8345D2790} - {0xb047a7e5, 0x27a, 0x4cfc, {0x8b, 0x18, 0xed, 0xa8, 0x34, 0x5d, 0x27, 0x90}} -}; - HANDLE hNewMailHook; HANDLE NoWriterEV; HANDLE hTTButton; @@ -82,15 +70,22 @@ static void GetProfileDirectory(wchar_t *szPath, int cbPath) ///////////////////////////////////////////////////////////////////////////////////////// -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - YAMNVar.hInst = hinstDLL; - return TRUE; -} +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; ///////////////////////////////////////////////////////////////////////////////////////// -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; +PLUGININFOEX pluginInfo = { + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {B047A7E5-027A-4CFC-8B18-EDA8345D2790} + {0xb047a7e5, 0x27a, 0x4cfc, {0x8b, 0x18, 0xed, 0xa8, 0x34, 0x5d, 0x27, 0x90}} +}; extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { @@ -98,8 +93,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) } ///////////////////////////////////////////////////////////////////////////////////////// - // The callback function + BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr) { // Convert code page string to number @@ -168,7 +163,7 @@ static IconItem iconList[] = void LoadIcons() { - Icon_Register(YAMNVar.hInst, "YAMN", iconList, _countof(iconList)); + Icon_Register(g_hInstance, "YAMN", iconList, _countof(iconList)); } HANDLE WINAPI g_GetIconHandle(int idx) @@ -362,13 +357,15 @@ extern "C" int __declspec(dllexport) Unload(void) ///////////////////////////////////////////////////////////////////////////////////////// -struct CMPlugin : public CMPluginBase +struct CMPlugin : public PLUGIN<CMPlugin> { CMPlugin() : - CMPluginBase(YAMN_DBMODULE) + PLUGIN<CMPlugin>(YAMN_DBMODULE) { RegisterProtocol(PROTOTYPE_VIRTUAL); SetUniqueId("Id"); } } g_plugin; + +extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 07889eaee3..405e27ab4a 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -154,7 +154,7 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) int YAMNOptInitSvc(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = YAMNVar.hInst;
+ odp.hInstance = g_hInstance;
odp.szGroup.a = LPGEN("Network");
odp.szTitle.a = LPGEN("YAMN");
odp.flags = ODPF_BOLDGROUPS;
@@ -809,7 +809,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case IDC_BTNSTATUS:
- DialogBoxParamW(pYAMNVar->hInst, MAKEINTRESOURCEW(IDD_CHOOSESTATUSMODES), hDlg, DlgProcPOP3AccStatusOpt, NULL);
+ DialogBoxParamW(g_hInstance, MAKEINTRESOURCEW(IDD_CHOOSESTATUSMODES), hDlg, DlgProcPOP3AccStatusOpt, NULL);
break;
case IDC_BTNADD:
|