Cannot execute 'winqueryreg()' in executable GUI on target computer
1 次查看(过去 30 天)
显示 更早的评论
Hi guys,
I created a standalone GUI (executable). In a function within the code, it should scan and list all COM ports. This is done with the following line:
devices = winqueryreg('name', 'HKEY_LOCAL_MACHINE', 'HARDWARE\DEVICEMAP\SERIALCOMM');
This works fine on the PC on which I created and compiled the exe file.
On target PC, the exe-file starts fine but when the line is executed, it gives an error sound and stops working.
It was compiled on a PC with MCR 8.5 64 bit which was also present on target PC.
Two questions:
Can I somehow find out what the error is that occors on target PC when executing the line?
Why could there be an error on target PC and not on PC on which it was compiled?
0 个评论
回答(2 个)
Image Analyst
2015-7-5
It doesn't work on mine even in the MATLAB development environment. What is 'name' doing in there? 'HKEY_LOCAL_MACHINE' should be your first argument. This is an example of how I use it:
registryKeyValue = winqueryreg('HKEY_LOCAL_MACHINE', 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'PROCESSOR_ARCHITECTURE');
By the way, on my computer this will fail:
devices = winqueryreg('HKEY_LOCAL_MACHINE', 'HARDWARE\DEVICEMAP\SERIALCOMM');
because I don't have the SERIALCOMM key under DEVICEMAP. I suggest you put that call in a try/catch block in case the computer does not have that key (like mine).
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!