UI Interest Group Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Windows Based Dialog Box

Originally found here under the Winevent.dll, the attached VI has been modified and updated to use Enums, and conform to modern LabVIEW programming styles.  This VI can be called and will show a system dialog box based on the inputs and will then return an enum of what button the user pressed was.

This method calls the User32.dll instead of .Net which appear to be more robust when it comes to building applications on a Windows system with an unknown version of .Net installed.  This function should work on all Windows versions, regardless of .Net.

EDIT: 2009 Version added.

Download All
Comments
TroyK
Active Participant
Active Participant
on

Nice! Works well. Thanks for sharing.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
ColeTrain
NI Employee (retired)
on

Agreed. I like examples like this that have a clean interface (said subVI).  I appreciate your effort to add the enums and test out the functionality.

ColeR
Field Engineer
battler.
Active Participant
Active Participant
on

Thanks a lot!  I agree it's nice to have a cleaner dialog with more control over functionality and appearance than the standard LV dialogs.

How does the PC find the path to the user.dll?  Does Windows automatically recognise the name and look in a specific folder?

Does it really function for all Windows versions (i.e. XP and later)?  Any further comments on this?

kcalhoun
Member
Member
on

Thanks for sharing! Nice and clean dialog box, enjoy the beep too!

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

The path to the User32.dll is found because it is in a path that Windows will search for as if the calling program was in the same directory.  When you type in "cmd" into Run on Windows the command prompt comes up.  You didn't need to provide the full path of C:\Windows\System32\cmd.exe  The User32.dll is similar to this.

It does work in XP and 7, and I would expect it to work from Windows 3.1 and newer (possibly older).

The nice thing about system is it changes with the OS and even the theme of the OS.  So running this on Windows 8 will create dialogs that look native to Windows 8.

thoult
Active Participant
Active Participant
on

The MSDN entry for MessageBox suggests it was implemented in Win2k, so might not be supported that far back.

---
CLA
D60
Active Participant
Active Participant
on

Hello,

I have used MessageBox (http://msdn.microsoft.com/en-us//library/system.windows.forms.messagebox.aspx)  dialogs for my LV apps. There windows are very fancy and easy to use, but I had some troubles with them.

The first one is the host (caller) VI execution property must be set to UI Thread in order to display the MessageBox correctly, and sometimes they are not opened as top level window.

I always have to handle these unwanted behavious (in LabVIEW) so I have returned back to the good-old LabVIEW dialogs.

There are my experiences, I hope it helps to anyone.

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
Staab_Engineering
Member
Member
on

D60, thanks for that information! This is evidence of LabVIEW behaving badly as a member of the Windows OS. We should be able to use the MessageBox without any problems! I definitely prefer it to the built-in LV dialogs because of its configurability and simplicity.

shew82
Member
Member
on

The problem with .net dialogs is that there is no direct way to identify the "owner" of the dialog. With the slightly more complicated to interface with win32 dialogs there are a couple of tricks to properly tell Windows which window owns the dialog (using the window name or a private LabVIEW VI property) but then, as I said, they're much harder to code.

Pankajusic
Member
Member
on

request you to please covert the files to 2009 ans upload it back..

thanks for the support

B.Settles
Member
Member
on

Hey...does anyone know of a similar style dialog box that allows user data entry?

"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

There isn't one, unless you make one.  The dialog you see is a call into a Windows function.  Windows doesn't have a similar dialog, that has input for the user.  But you can make a VI pretty easily that looks like this dialog with the different glyphs and button options, but allow some custom input.  Try your hand at making one on your own then post in the forums if you aren't quite satisfied with the result.

GerdW
Knight of NI Knight of NI
Knight of NI
on

Hi settlesj,

you can create your own dialog boxes by changing the VI window properties…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
B.Settles
Member
Member
on

@GerdW and Hooovahh

Typically, I've just used the Prompt User Express VI in the Dialog & User Interface palette. That usually meets my needs, and if I need to customize further, I just open the front panel and go from there. Was just wondering if there was a companion VI or VIs to this one?

"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

Nope, that express VI is quite limiting and I've only ever been able to force myself to use it once or twice.

B.Settles
Member
Member
on

Well, for just about all the test systems I've worked on, the goal is for the operator to push the start button and then walk away, so I don't usually have much need for the user to type in data, so typically it meets my needs.

"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

Some of my compaints: No window resize, no handling of the standard Windows close, no key binding or key navigation which rules out barcode scanners, no custom images, no control over background color, or control style (classic silver etc.), and I believe it is always a modal dialog.

Active Participant
Active Participant
on

Hooovahh wrote:

Some of my compaints: ...                

I logged in with both accounts just so I could "like" this twice.

gi_virtualspot
Member
Member
on

Here is a .Net implementation of Windows Dialog VI with an add-on feature assigning the dialog window to a specified monitor. The VI is in LV2011.

https://decibel.ni.com/content/docs/DOC-39284

Cheers~

barddya
Member
Member
on

I also recommend do away withe windows and make your own dialogue box in Labview. Its very easy, you can have any size shape opacity and as many as yes, no, cancel, enter password or scan barcode etc.it can go away in certain given time.

It will be your code and will not based on versions of windows and where he DLLs are and many other head aches

Barddya

Contributors