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.


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.

Comments
Active Participant TroyK
Active Participant

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
Active Participant ColeTrain
Active Participant

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
Active Participant battler.
Active Participant

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?

Member kcalhoun
Member

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

Proven Zealot Proven Zealot
Proven Zealot

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.


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.

Active Participant thoult
Active Participant

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

---
CLA
Active Participant D60
Active Participant

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]
Member Staab_Engineering
Member

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.

Member shew82
Member

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.

Member Pankajusic
Member

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

thanks for the support

Member B.Settles
Member

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

Proven Zealot Proven Zealot
Proven Zealot

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.


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.

Knight of NI
Knight of NI

Hi settlesj,

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

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Member B.Settles
Member

@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

Proven Zealot Proven Zealot
Proven Zealot

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


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.

Member B.Settles
Member

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

Proven Zealot Proven Zealot
Proven Zealot

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.


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.

Active Participant David_Staab
Active Participant

Hooovahh wrote:

Some of my compaints: ...                

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

Member gi_virtualspot
Member

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~

Member barddya
Member

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