Cannot execute 'winqueryreg()' in executable GUI on target computer
조회 수: 2 (최근 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
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!