Solution
As mentioned in the help files of
FileSelectPopupEx, this function is prone to this error when threads are not initialized properly. The underlying Windows SDK function used to create and run the
FileSelectPopupEx dialog box does not work properly when the threading model is multithread apartment (MTA). ActiveX functions use this thread type by default, and calling any ActiveX function initializes the thread to MTA. This might cause subsequent calls to the
FileSelectPopupEx function to return an error.
Make sure LabWindows/CVI initializes the thread calling the
FileSelectPopupEx function to
COINIT_APARTMENTTHREADED prior to creating the dialog box. This will ensure the dialog box works properly,
If you want to run in the default MTA threading model, consider calling the
FileSelectPopupEx function from a different thread that does not call any ActiveX functions. You can explicitly set the ActiveX threading model for a thread using the
CA_InitActiveXThreadStyleForCurrentThread function.