| (You do not need this source code to use SetNatTx or to understand how it works.) |
| ---------------------------------------------setnattx.cpp--------------------------------------------- |
| #include <windows.h> |
| #include <stdio.h> |
| extern "C" |
| int APIENTRY DllMain( HINSTANCE, DWORD, LPVOID ) |
| { |
| return 1; // ok |
| } |
| extern "C" |
| int WINAPI SetNaturalText( LPSTR pszState ) |
| { |
| HKEY hKey; |
| HRESULT rc; |
| BOOL bSet; |
| bSet = ( *pszState == '1' || *pszState == 't' || |
| 0 == stricmp( pszState, "on" ) ); |
| rc = RegOpenKeyEx( |
| HKEY_LOCAL_MACHINE, |
| "Software\\Dragon Systems\\NaturalText", |
| 0, KEY_WRITE, &hKey ); |
| if( rc == ERROR_SUCCESS ) |
| { |
| rc = RegSetValueEx( |
| hKey, "Enable Global Dictation", 0, REG_SZ, |
| (const BYTE *)( bSet ? "1" : "0" ), |
| 2 ); |
| } |
| if( rc != ERROR_SUCCESS ) |
| { |
| char szBuffer[ 256 ]; |
| sprintf( szBuffer, |
| "Unable to access the Dragon NaturallySpeaking registry" |
| " (code = 0x%x)\r\n\r\nThis utility will only work with" |
| " Dragon NaturalText Version 2.", |
| rc ); |
| MessageBox( |
| 0, szBuffer, "SetNaturalText Error", |
| MB_ICONWARNING | MB_OK ); |
| } |
| return 0; |
| } |
| ---------------------------------------------setnattx.def--------------------------------------------- |