Greetings,
I have a single form that I need to display modally.
Google tells me its the showdialog method.
So I put that in my load event and it didnt go modal and the error said it shouldnt be visible.
So I put a $form1.visible = $false before my $form1.showdialog() in my load event and its still not modal.
What bit am I missing please?
Thanks
David
Displaying a modal form
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Displaying a modal form
You cannot use "ShowDialog()" after the form is already shown.
All forms in PowerShell are modal. PSS can only build modal forms. Even when using a compiled language a form cannot be changed for modal to modeless or modeless to modal after the from has been created.
Making a modal form hidden (visible = $false) closes the form.
You cannot show a the form from inside any of the forms events.
All forms in PowerShell are modal. PSS can only build modal forms. Even when using a compiled language a form cannot be changed for modal to modeless or modeless to modal after the from has been created.
Making a modal form hidden (visible = $false) closes the form.
You cannot show a the form from inside any of the forms events.
Re: Displaying a modal form
In which case I am using the wrong terminology.
I thought modal meant the window is displayed preventing entering anything else anywhere else on the desktop until you deal with the window (like the UAC prompt).
Whats that called and how do I do that (Can it be done?)
I thought modal meant the window is displayed preventing entering anything else anywhere else on the desktop until you deal with the window (like the UAC prompt).
Whats that called and how do I do that (Can it be done?)
Re: Displaying a modal form
Well there's something I am still missing.
I compile this form into an exe and launch the exe.
The form displays but I can still interact with the desktop.
What do I need to do so that when the exe is launched, everything goes dark, like a UAC prompt, and wont let me continue or interact with anything until I deal with the form?
Thanks
David
I compile this form into an exe and launch the exe.
The form displays but I can still interact with the desktop.
What do I need to do so that when the exe is launched, everything goes dark, like a UAC prompt, and wont let me continue or interact with anything until I deal with the form?
Thanks
David
Re: Displaying a modal form
I came up with a solution that will work.
I start a timer when the form loads and if they dont press a specific button on the form within 60 seconds, they will be logged off.
I start a timer when the form loads and if they dont press a specific button on the form within 60 seconds, they will be logged off.
Re: Displaying a modal form
Not with basic PowerShell. You would have to use the Win32 API calls to create a proess modal to the desktop. In windows 10 I do not think this is possible. We used to do it With XP. Allowing this can be a security issue.
Re: Displaying a modal form
Thanks.
When I saw this:
https://social.technet.microsoft.com/Fo ... powershell
I decided it was way to hard.
Looks like Im back to the timer thing...
When I saw this:
https://social.technet.microsoft.com/Fo ... powershell
I decided it was way to hard.
Looks like Im back to the timer thing...