diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-21 18:08:40 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-21 18:09:19 +0300 |
commit | a334516a231bc13b93e20aa59023e37d7c4ba666 (patch) | |
tree | 2bdd9b1f02df76cef33ed68002d21b3e0d5b6164 /plugins/Import | |
parent | f7001757a832e948645713a94739f66b07d5f2c1 (diff) |
Import: the wizard dialog to use initialization structure instead of PostMessage
Diffstat (limited to 'plugins/Import')
-rw-r--r-- | plugins/Import/src/main.cpp | 22 | ||||
-rw-r--r-- | plugins/Import/src/stdafx.h | 8 | ||||
-rw-r--r-- | plugins/Import/src/wizard.cpp | 6 |
3 files changed, 24 insertions, 12 deletions
diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index 02214a87dd..61d6da6cce 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -58,8 +58,8 @@ static INT_PTR ImportCommand(WPARAM, LPARAM) SetFocus(hwndWizard);
}
else {
- hwndWizard = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc);
- PostMessage(hwndWizard, WIZM_GOTOPAGE, IDD_WIZARDINTRO, (LPARAM)WizardIntroPageProc);
+ WizardDlgParam param = { IDD_WIZARDINTRO, (LPARAM)WizardIntroPageProc };
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, (LPARAM)¶m);
}
return 0;
@@ -76,7 +76,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) /////////////////////////////////////////////////////////////////////////////////////////
// MirandaInterfaces - returns the protocol interface to the core
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_IMPORT, MIID_SERVICEMODE, MIID_LAST };
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_IMPORT, MIID_DATABASE, MIID_SERVICEMODE, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
// Performs a primary set of actions upon plugin loading
@@ -109,20 +109,20 @@ static int OnExit(WPARAM, LPARAM) static INT_PTR ServiceMode(WPARAM, LPARAM)
{
g_bServiceMode = true;
- hwndWizard = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc);
- PostMessage(hwndWizard, WIZM_GOTOPAGE, IDD_WIZARDINTRO, (LPARAM)WizardIntroPageProc);
+
+ WizardDlgParam param = { IDD_WIZARDINTRO, (LPARAM)WizardIntroPageProc };
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, (LPARAM)¶m);
return SERVICE_ONLYDB;
}
static INT_PTR CustomImport(WPARAM wParam, LPARAM)
{
- MImportOptions *param = (MImportOptions*)wParam;
- wcsncpy_s(importFile, MAX_PATH, param->pwszFileName, _TRUNCATE);
- nImportOptions = param->dwFlags;
+ MImportOptions *opts = (MImportOptions*)wParam;
+ wcsncpy_s(importFile, MAX_PATH, opts->pwszFileName, _TRUNCATE);
+ nImportOptions = opts->dwFlags;
- hwndWizard = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc);
- PostMessage(hwndWizard, WIZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressPageProc);
- return 0;
+ WizardDlgParam param = { IDD_PROGRESS, (LPARAM)ProgressPageProc };
+ return DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, LPARAM(¶m));
}
extern "C" __declspec(dllexport) int Load(void)
diff --git a/plugins/Import/src/stdafx.h b/plugins/Import/src/stdafx.h index 0d201a39cb..21007d9136 100644 --- a/plugins/Import/src/stdafx.h +++ b/plugins/Import/src/stdafx.h @@ -67,6 +67,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void AddMessage(const wchar_t* fmt, ...);
+struct WizardDlgParam
+{
+ WPARAM wParam;
+ LPARAM lParam;
+};
+
INT_PTR CALLBACK WizardIntroPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ProgressPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK MirandaPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
@@ -79,7 +85,7 @@ bool IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei); int CreateGroup(const wchar_t *name, MCONTACT hContact);
extern HINSTANCE hInst;
-extern HWND hwndAccMerge;
+extern HWND hwndWizard, hwndAccMerge;
extern int nImportOptions;
extern wchar_t importFile[];
extern time_t dwSinceDate;
diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index f23bf6ce1b..1decf1d74f 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -97,6 +97,12 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
Window_SetIcon_IcoLib(hdlg, GetIconHandle(IDI_IMPORT));
+ hwndWizard = hdlg;
+ {
+ WizardDlgParam *param = (WizardDlgParam*)lParam;
+ if (param)
+ PostMessage(hdlg, WIZM_GOTOPAGE, param->wParam, param->lParam);
+ }
return TRUE;
case WIZM_GOTOPAGE:
|