On 2020-01-20 13:08, ToddAndMargo via perl6-users wrote:
Hi All,
Is there a way to create a "non modal dialog" in
Raku for Windows?
Many thanks,
-T
One of the guys on the WinApi group gave me this:
Any idea how I do this is Raku?
-T
c++:
#include <Windows.h>
#include <tchar.h>
#include <ShlObj.h>
EXTERN_C int _tmain()
{
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED |
COINIT_DISABLE_OLE1DDE);
IProgressDialog* pDlg = nullptr;
if(SUCCEEDED(CoCreateInstance(CLSID_ProgressDialog, nullptr,
CLSCTX_SERVER, IID_IProgressDialog, reinterpret_cast<void**>(&pDlg))))
{
pDlg->StartProgressDialog(nullptr, nullptr, PROGDLG_NORMAL |
PROGDLG_AUTOTIME, nullptr);
for(unsigned percent = 0; percent <= 100; ++percent)
{
if(pDlg->HasUserCancelled())
break;
pDlg->SetProgress(percent, 100);
Sleep(1000);
}
pDlg->StopProgressDialog();
pDlg->Release();
}
CoUninitialize();
}