Discussion:
popup question
(too old to reply)
R.Wieser
2020-01-20 07:48:03 UTC
Permalink
T,
I would like to pop up a window that show progress of what is going on
behind thescenes. Is that a Win API call or something else?
Yup. "MessageBox" in User32.dll

Regards,
Rudy Wieser
T
2020-01-20 08:22:20 UTC
Permalink
Post by R.Wieser
T,
I would like to pop up a window that show progress of what is going on
behind thescenes. Is that a Win API call or something else?
Yup. "MessageBox" in User32.dll
Regards,
Rudy Wieser
Hi Rudy,

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox

I see where you can write a message and get YES, NO ,
etc. back, but not give in progress text as things
happen. Am I missing something?

-T
R.Wieser
2020-01-20 08:58:01 UTC
Permalink
T,
I see where you can write a message and get YES, NO , etc. back, but not
give in progress text as things
happen. Am I missing something?
Nope, you're missing anything. But I'm afraid that Windows does not offer
such an updatable dialog. Most (if not all) of those user32.dll dialogs are
modal and will not return until you press one of their buttons, meaning that
program which creates them has no idea where to send such "progress text"
to.

If you would want to have such an updatable dialog I'm afraid you would need
to create it yourself - most likely in a seperate thread, as you need to
respond to all of its events (including responding to creating, destroying,
drawing, moving, etc of the window !) using something called a "message
pump". In short, not something I imagine would be easy to do in plain
Raku.

Regards,
Rudy Wieser
T
2020-01-20 17:58:43 UTC
Permalink
Post by R.Wieser
T,
I see where you can write a message and get YES, NO , etc. back, but not
give in progress text as things
happen. Am I missing something?
Nope, you're missing anything. But I'm afraid that Windows does not offer
such an updatable dialog. Most (if not all) of those user32.dll dialogs are
modal and will not return until you press one of their buttons, meaning that
program which creates them has no idea where to send such "progress text"
to.
If you would want to have such an updatable dialog I'm afraid you would need
to create it yourself - most likely in a seperate thread, as you need to
respond to all of its events (including responding to creating, destroying,
drawing, moving, etc of the window !) using something called a "message
pump". In short, not something I imagine would be easy to do in plain
Raku.
Regards,
Rudy Wieser
Hi Rudy,

Thank you for the tips.

I Linux, I will sometimes open an xterm and
write to it. Press any key to exit. Maybe
I should just open a cmd shell and do the
same thing. It ain't real pretty, but
it will work.

-T
T
2020-01-20 19:19:30 UTC
Permalink
T,
Post by T
I Linux, I will sometimes open an xterm and
write to it. Press any key to exit. Maybe
I should just open a cmd shell and do the
same thing. It ain't real pretty, but
it will work.
Yup, there are several ugly solutions available. :-)
I just did a quick search for "perl 6 non-modal dialog" and google returned
https://stackoverflow.com/questions/2719007/how-can-i-create-a-non-modal-dialog-in-perl-tk
https://perlmonks.org/?node_id=836513
Its rather old info, but maybe its a starting point ?
Regards,
Rudy Wieser
Thank you . I never wold have thought to search
for "non modal".

:-)

-T
T
2020-01-20 21:07:24 UTC
Permalink
T,
Post by T
I Linux, I will sometimes open an xterm and
write to it. Press any key to exit. Maybe
I should just open a cmd shell and do the
same thing. It ain't real pretty, but
it will work.
Yup, there are several ugly solutions available. :-)
I just did a quick search for "perl 6 non-modal dialog" and google returned
https://stackoverflow.com/questions/2719007/how-can-i-create-a-non-modal-dialog-in-perl-tk
https://perlmonks.org/?node_id=836513
Its rather old info, but maybe its a starting point ?
Regards,
Rudy Wieser
Rats!

Perl5 and Perl6 (Raku) does not have that library yet.
René König
2020-01-20 09:51:58 UTC
Permalink
Hi,

the shell has a progress dialog:
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nn-shlobj_core-iprogressdialog

Rene
T
2020-01-20 18:01:20 UTC
Permalink
Post by René König
Hi,
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nn-shlobj_core-iprogressdialog
Rene
Hi René,

Thank you!

Interesting. I will have to read it over slowly.

Do you know of any examples out there?

-T
T
2020-01-20 22:40:21 UTC
Permalink
#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();
}
Right over my head! But I am saving it ANYWAY!!!!

Thank you!
Charlie Gibbs
2020-01-20 19:07:01 UTC
Permalink
Post by René König
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nn-shlobj_core-iprogressdialog
All well and good, but does it have to be a dialog?
If all you're doing is spitting out the occasional
status message, without frills like a "cancel" button,
it's more like a monologue than a dialogue. My private
library contains a little routine that opens a small window
and displays a message in it. Alternatively, you can simply
do a TextOut() to an existing window. Less is more.
--
/~\ Charlie Gibbs | Microsoft is a dictatorship.
\ / <***@kltpzyxm.invalid> | Apple is a cult.
X I'm really at ac.dekanfrus | Linux is anarchy.
/ \ if you read it the right way. | Pick your poison.
Bonita Montero
2020-01-21 18:24:22 UTC
Permalink
Post by René König
Hi,
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nn-shlobj_core-iprogressdialog
LOL. It was hard for him to get a simple C-call working.
Now you show him a COM-API ?
T
2020-01-22 18:53:15 UTC
Permalink
Post by Bonita Montero
Post by René König
Hi,
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nn-shlobj_core-iprogressdialog
LOL. It was hard for him to get a simple C-call working.
Now you show him a COM-API ?
I made a copy of it. You never know!

Loading...