How to execute daqregister(‘nidaq’) without running MATLAB as administrator

Posted on May 6, 2015

In order to control NI devices with Data Acquisition Toolbox in MATLAB, you first need to run MATLAB as administrator and execute the DAQREGISTER command. (See this.) However, running MATLAB as administrator is not possible, if you have to log in with a different username to be an administrator and your MATLAB activation type is Standalone Named User. MATLAB just won’t start when you switch to your admin account, because the Standalone Named User license does not allow anyone to use MATLAB but the licensed named user. You can bypass this problem by giving your non-admin MATLAB user write permission for the following two registry entries so that you can execute DAQREGISTER as a standard user. This was tested on 64-bit Windows 7 with MATLAB 2015a.

HKEY_LOCAL_MACHINE\SOFTWARE\Classes
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes

To change permissions for registry, you need to run REGEDIT as administrator. (Or open a command window as administrator and type REGEDIT.)

Some .CHM files may not render properly on Windows Vista and Windows 7

Posted on Jan 1, 2015

From http://support.microsoft.com/kb/2021383

Symptoms
When attempting to open a Compiled HTML Help (.CHM) file on Windows Vista or Windows 7, the file may open but display one of the following messages instead of the expected content:

– Navigation to the webpage was canceled.
– Action canceled.

Cause
This will occur if the .CHM file has been flagged as downloaded from an untrusted source, such as the Internet.

Resolution
To resolve this issue, carry out the following steps:

– Right-click the .CHM file and choose Properties
– On the General tab, click the button labeled “Unblock”
– Click OK

[wxWidgets] Compiling wxWidgets for MS Windows

Posted on Dec 30, 2014

1. Get the latest source code from https://www.wxwidgets.org/downloads/ (ver 3.0.2 as of Dec 30, 2014) and unzip it somewhere.

2. Go to ./build/msw

3. Compile
– For MS Visual Studio, find a solution file for your VS version (e.g., wx_vc12.sln) and build.
– For MinGW, open a cmd window and set the bin folder of MinGW in the beginning of your PATH environment variable, like the following example.

set "PATH = C:\GNU\mingw64\bin;%path%"

Then, run the following commands, depending on the version you want to build.

@ release DLL
mkdir ..\..\lib\gcc_dll\mswu\wx
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=release SHARED=1 UNICODE=1 MSLU=0 clean
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=release SHARED=1 UNICODE=1 MSLU=0

@ debug DLL
mkdir ..\..\lib\gcc_dll\mswud\wx
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=debug SHARED=1 UNICODE=1 MSLU=0 clean
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=debug SHARED=1 UNICODE=1 MSLU=0

@ release static LIB
mkdir ..\..\lib\gcc_lib\mswu\wx
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=release SHARED=0 UNICODE=1 MSLU=0 clean
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=release SHARED=0 UNICODE=1 MSLU=0

@ debug static LIB
mkdir ..\..\lib\gcc_lib\mswud\wx
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=debug SHARED=0 UNICODE=1 MSLU=0 clean
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=debug SHARED=0 UNICODE=1 MSLU=0

Continue…

[wxWidgets] Add an icon from .ico file

Posted on Dec 21, 2014

YourApp.rc

mondrian ICON "mondrian.ico" // identifier ICON filename

#include "wx/msw/wx.rc"

YourApp.cpp

// In the constructor,
MyDialog::MyDialog(wxWindow* parent)
{
	...

	SetIcon(wxICON(mondrian)); // the same identifier that you put in the rc file
}

[wxWidgets] Add “About…” to the system menu

Posted on Dec 21, 2014

Original post: https://forums.wxwidgets.org/viewtopic.php?f=20&t=13921

MyDialog.h

class MyDialog : public wxDialog
{
	...

	// Override MSWTranslateMessage
	bool MSWTranslateMessage(WXMSG* pMsg);
};

MyDialog.cpp

// Include aboutdlg.h
#include <wx/aboutdlg.h>

MyDialog::MyDialog(wxWindow* parent)
{
	...

	// Add the menu item, "About...", to the system menu
	HMENU hSystemMenu = ::GetSystemMenu((HWND__*)GetHWND(), FALSE);
	::AppendMenu(hSystemMenu, MF_SEPARATOR, 0, wxT(""));
	::AppendMenu(hSystemMenu, MF_STRING, wxID_ABOUT, wxT("About..."));
	::DrawMenuBar((HWND__*)GetHWND());
}

// implement the message handler
bool MyDialog::MSWTranslateMessage(WXMSG* pMsg)
{
	if (WM_SYSCOMMAND==pMsg->message && wxID_ABOUT==pMsg->wParam)
	{
		wxAboutDialogInfo di;
		di.SetName(wxT("My App"));
		di.SetVersion(wxT("1.00"));
		di.SetDescription(wxT("This app does cool trix!"));

		wxAboutBox(di);

		return true; // Message processed
	}

	return wxDialog::MSWTranslateMessage(pMsg);
}