Can someone get FileSelectPopuEx and WMI calls to CoInitializeEx / CoInitializeSecurity to coexist in the same code?

I'm having a problem to run the attached code, which in an ideal world, would allow me to access the hard disk on the host PC serial numbers and use the FileSelectPopupEx function in any order.

It seems that as soon as I launch FileSelectPopupEx (even by cancelling) the disc code stops working. There will be mistakes retrun to CoInitializeEx run from the same thread or CoInitializeSecurity run from separate threads.

Based on aid for the 3 functions, it's probably that the error is caused by the mode of apartment for pieces of code. With WMI needing an MTA and the FileSelectpopupEx that need to be threaded in a single compartment. The FileSelectPopupEx suggests executes in a separate thread to avoid conflicts. I tried this, and unless I have that messed up, separate threads did not fix the problem.

Since I never plan on the implementation of these components at the same time, it would be quite 'Cancel initialization' environment variables set FileSelectPopupEx after each instance in my case. Unfortunately, I'm at a bit of a loss on the bits to switch.

Regarding the attached code, I tried to run in the two CVI2012 SP1 (32-bit and 64-bit) and CVI2013 (SP1 (32-bit and 64-bit) with identical results. If you want to re-create the link of a few questions for the following static libraries from lib SDK for CVI: ole32.lib, propsys.lib, Ole32.lib and WbemUuid.lib.

I discovered that the code 'error' in this case was just a warning that was already called CoinitializeSecurity. The code is equal to RPC_E_TOO_LATE and can be swallowed with the following slight change to the code provided.

If (FAILED (hr) &!) (HR) IS RPC_E_TOO_LATE))

Sorry for the bug world.

Tags: NI Software

Similar Questions

Maybe you are looking for

  • UPD123 problem?

    I bought the Naim Unitiqute and I cannot set the time? It keeps saying I should check that UPD123 is not a firewall? Can anyone suggest a solution please? I have already spoken with Naim on a free telephone number and they said to contact Netgear but

  • Cannot read iPod on mac

    I can see the tracks on shuffle when it is connected to my mac, but they are greyed out so will not play all advice welcome

  • File invisible or inaccessible space on large hard drives

    I have two hard drives of 2 TB on a Win XP x 64 workstation (I think it's the SP3). I formatted the two disks using the DiskManagement tool which is reached by MyComputer. Manage | DiskManagement. After formatting, both discs showed only 1 TB of disk

  • Media Player will not play. WVM files... rrrrr

    I have a Sony VIAO with plenty in the VISTA neck pain. Please help with above.Windows Media Player... Version 11.0.6001.7004 ERROR MESSAGE... Windows Media Player cannot play the file. The player might not support the file type or does not support th

  • Windows 7 Home Basic tone works not

    I bought a computer laptop sony vaio VPCEH26EN in 2011. The laptop comes with windows 7 Home Basic preinstalled. Recently, the system had not worked in the last week. I have left chance rather than format windows. The windows 7 Home basic has been do