Copy link to clipboard
Copied
How to create an application modal dialog box on a button click on Panel using Illustrator plugin development SDK ?
I show some API in AIUserSuite like OKCancelAlert, ErrorAlert, YesNoAlert, MessageAlert, MessageAlertEx, QuestionAlert.
However, I want to create my custom dialog from resource file, for that, How to get the main illustrator window's handle to pass in Win32 API 'DialogBox' to create the application modal dialogbox ?
Copy link to clipboard
Copied
Moving thread to the Illustrator forum from Using the Community
Copy link to clipboard
Copied
Hi Ged, can mods also add tags to posts? Here the SDK and Scripting tags would be useful if so.
Copy link to clipboard
Copied
Yep we can 🙂
Copy link to clipboard
Copied
Nice, thank you!
Copy link to clipboard
Copied
Did you ever figure out a solution to this? I need to access the Adobe window handle in order to spawn a modal dialog. I also need to make this work for MacOS.
Copy link to clipboard
Copied
I don't have perfect solution because the Panel window can be attached to other panel window too.
The workaround:
Find the most parent window handle for launching the dialog:
Used GetParent() function until I get the output parent handle as null or equal to GetDesktopWindow().
However, Sometime it is possible to go to Panel window from the dialog box.
Hence, the steps:
1. Disabled all the controls on Panel Window.
2. Launch the Dialogbox using MAKEINTRESOURCE, setting the parent as found by GetParent described above.
3. Once DialogBox returns, enable all the controls on Panel window
If you find any better solution then let me know.
Copy link to clipboard
Copied
Hi,
In your menu function use this:
You can defin HINSTANCE gHINSTANCE;
int nRetVal = DialogBoxParam(gHINSTANCE, MAKEINTRESOURCE(IDD_DIALOG1),NULL,DialogProc,0);
need to call dialgproc function, in dialog proc function use:
switch (uMsg)
{
case WM_INITDIALOG:
//CenterDialog(hDlg);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_BUTTON1:
AfxMessageBox("button clicked");
case IDOK:
EndDialog(hDlg, IDOK);
break;
case IDCANCEL:
//SendMessage(hDlg, WM_CLOSE, 0, 0);
EndDialog(hDlg, IDCANCEL);
//return TRUE;
break;
}
break;