02-18-2010 03:33 PM
I have a visual studio project making use of a lab windows UIR front panel. I know in Lab Windows you can embed the UIR file in the output executable. However, I'm not sure how to do this when building with Visual Studio. So how does one embed the UIR file in the Visual Studio output executable?
Thanks!
02-19-2010 04:56 PM
02-22-2010 10:30 AM
If your ultimate goal is to avoid having to distribute the .uir file alongside your program, you do have an alternative to embedding the .uir file in the executable. Once your .uir is finalized, you can run the UI converter tool (Tools>>UI to Code Converter) to convert it to code. This tool generates the instructions that can be used to create the same UI programmatically. You then need only add this code to your project.
Luis
02-23-2010 05:44 AM
Alternatively, you can embed the UIR in the executable, the same way that the CVI compiler does it. This, of course, is not guaranteed to work in future versions of CVI but it's worked for quite a while now. Maybe it doesn't work in CVI 2009, I haven't migrated yet.
You need to create a custom resource with a resource type of "UIRFILETYPE". It should have a string resource identifier which is the UIR file name that the application uses e.g. "MYGUI.UIR", and its contents are simply the (binary) contents of the UIR file. So, for example, you might end up with this code in the .rc resource file:
///////////////////////////////////////////////////////////////////////////// // // UIRFILETYPE // MYGUI.UIR UIRFILETYPE "MYGUI.UIR"
In this code, the first entry on the line is the resource identifier, the second entry the resource type, and the third entry the file that contains the data.
Pretty simple, really.
06-16-2025 01:25 PM
@msaxon wrote:
Alternatively, you can embed the UIR in the executable, the same way that the CVI compiler does it. This, of course, is not guaranteed to work in future versions of CVI but it's worked for quite a while now. Maybe it doesn't work in CVI 2009, I haven't migrated yet.
You need to create a custom resource with a resource type of "UIRFILETYPE". It should have a string resource identifier which is the UIR file name that the application uses e.g. "MYGUI.UIR", and its contents are simply the (binary) contents of the UIR file. So, for example, you might end up with this code in the .rc resource file:
///////////////////////////////////////////////////////////////////////////// // // UIRFILETYPE // MYGUI.UIR UIRFILETYPE "MYGUI.UIR"
In this code, the first entry on the line is the resource identifier, the second entry the resource type, and the third entry the file that contains the data.
Pretty simple, really.
Thanks for this post. I have been creating a CMakeLists.txt file to build our LabWindows 2017 product using the Microsoft compiler. I got that done, but wanted to figure out how to build-in the .uir panel files. Your post helped. I was able to build this file, and add it to the CMakeLists.txt and ... it just worked! I am not a Windows programmer, so all of this is foreign to be. If I can get it to work, it must be pretty simple!
# Add source to this project's executable.
set(RESOURCE_FILES "OurProgram.rc") # Your .rc file
add_executable (OurProgram ${RESOURCE_FILES}
# Source Files:
"src/UniversalCallbacks.c"
"src/UniversalEEPROM_Callbacks.c"
...snip...