Microsoft IME for Japanese Input

I’ve found the keyboard shortcuts for the Microsoft IME (Input Method Editor) to be poorly documented. I’ve tried to collect all of them here.

Switching Between Input Languages

MicrosoftIME_JapaneseInputLanguageMenuThese keyboard shortcuts switch between, for example, English and Japanese input languages. This is equivalent to clicking on the language abbreviation (e.g. EN, JP) in the IME Toolbar.

Left Alt + Shift or
Ctrl + Shift or
Grave Accent (`) – switch input language (default is Left Alt + Shift)

Ctrl + Shift or
Left Alt + Shift or
Grave Accent (`) – switch keyboard layout (not assigned by default). An example of usage would be to switch between “US” and the “United States – International” keyboard layouts, assuming they have been configured in Text Services and Input Languages.

Switching Between Input Modes

MicrosoftIME_JapaneseInputMenuOnce Japanese language input is selected, the following shortcuts can be used to change the input mode between hiragana, katakana, and alphanumeric. This is equivalent to clicking on the input menu in the IME bar:

Ctrl + Caps Lock – switch to hiragana

Alt + Caps Lock – switch to katakana

Shift + Caps Lock – switch between full-width hiragana and full-width alphanumeric (romaji).

Alt + Grave Accent (`) – switch between kana and half-width alphanumeric (romaji).

String Conversion

When typing using IME, while a sequence is still underlined, these shortcuts can be used to convert the underlined portion between hiragana, katakana, romaji, both full- and half-width. Note that these conversions cannot be performed after moving on to the next input block (i.e., it is not possible to double-click and existing word and convert it).

F6 - converts to hiragana:

ホワイト becomes ほわいと

F7 – converts to katakana:

ほわいと becomes ホワイト

F8 – converts to half-width katakana:

ホワイト becomes ホワイト

F9 – converts to full-width romaji, press again for all-capitals, then again for proper noun capitalization:

ホワイト becomes howaito, press F9 again for HOWAITO, and again for Howaito

F10 – convert to half-width romaji, press again for all-capitals, and again for proper noun capitalization:

ホワイト becomes howaito, press F10 again for HOWAITO, and again for Howaito

More Conversion Examples

Typing katakana, then pressing F10 and F7 alternately will convert the string back and forth between katakana and half-width romaji.

Typing hiragana, then pressing F10 and F6 alternately will convert the string back and forth between hiragana and half-width romaji.

Typing hiragana, then pressing F7 and F6 alternately will convert the string between hiragana and katakana.

Typing katakana, then pressing F6 and F7 alternately will convert the string between katakana and hiragana.

Quotes

MicrosoftIME_QuoteCharactersBasic opening and closing quotes (「」), type the left and right bracket ([, ]), respectively. To access more quote styles, type the open or closing bracket, then press the space bar for the conversion menu. Another option is to type kakko (Japanese for “brackets”), press the space bar for the completion menu, and scroll down.

「」 〈〉 《》

Katakana-specific Shortcuts

These shortcuts only have meaning in the katakana input mode.

Long vowel – press the ‘minus’ key (next to equals on US keyboards):

ソーダ (soda)

Separator – type a forward slash ‘/’:

ジョン・ホワイト (John White)

Traditionally, Japanese doesn’t have a “ti” sound, so it was translated as チ (chi, e.g. ticket becomes “チケット”, “chiketo”). In order to write ‘ti’, type thi or texi. For ‘di’, type dhi or dexi.

ティ・ディ

Posted in Technology, Windows, 日本語 | Leave a comment

Setting Global C++ Include Paths in Visual Studio 2012 (and 2011, and 2010)

Starting with Visual Studio 2010, Microsoft decided to make life hard on C++ developers.  System-wide include path settings used to be accessed through Tools | Options | Projects and Solutions | VC++ Directories.  However, that option is gone:

VS2012_ToolsOptionsDirectories

Instead, the system-wide include paths are now located within the ‘Properties’ interface.  To access it, select View | Property Manager.  No dialog will appear yet. Instead, the Property Manager appears as a tab along with the Solution Explorer:

VS2012_OptionsPropertyManager

Note:  The Property Manager won’t contain anything unless a solution is loaded.

Now, expand one of your projects, then expand Debug | Win32 or Release | Win32:

VS2012_PropertyPageProjectExpanded

Right click Microsoft.Cpp.Win32.user and select Properties:

VS2012_PropertyPageProjectExpandedMenu

This brings up the Microsoft.Cpp.Win32.User Property Pages dialog, which should look familiar enough:

VS2012_Win32UserPropertyPage

Alternate Access

The properties can be accessed directly as an XML file by editing %LOCALAPPDATA%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props

VS2012_Win32UserPropsXML

Rant

None of this makes any sense whatsoever. Why do I have to have a solution loaded before I can edit the system-wide (technically user-wide) path settings?  The old system made sense: project-specific include paths were set in the properties of individual projects, and system include paths were set through the Tools menu. The layout is irritating, forgettable, and, most importantly, it makes absolutely no sense to access system settings by clicking through your own projects!

Posted in Technology, Windows | Leave a comment

Console2 and Cygwin with Solarized Color Palette

If you want to use Ethan Schoonover’s Solarized color palette with Console2 and Cygwin, here’s how:

  1. Edit the console settings file at %LOCALAPPDATA%\Console2\console.xml or %APPDATA%\Console\console.xml.
  2. Replace the <colors> ... </colors> section with the following:
    <colors>
       <color id="0" r="7" g="54" b="66"/>         <!-- black -->
       <color id="1" r="38" g="139" b="210"/>      <!-- blue -->
       <color id="2" r="133" g="153" b="0"/>       <!-- green -->
       <color id="3" r="42" g="161" b="152"/>      <!-- cyan -->
       <color id="4" r="220" g="50" b="47"/>       <!-- red -->
       <color id="5" r="211" g="54" b="130"/>      <!-- magenta -->
       <color id="6" r="181" g="137" b="0"/>       <!-- yellow/brown -->
       <color id="7" r="238" g="232" b="213"/>     <!-- white -->
       <color id="8" r="0" g="43" b="54"/>         <!-- brblack --> 
       <color id="9" r="131" g="148" b="150"/>     <!-- brblue -->
       <color id="10" r="88" g="110" b="117"/>     <!-- brgreen -->
       <color id="11" r="147" g="161" b="161"/>    <!-- brcyan -->
       <color id="12" r="203" g="75" b="22"/>      <!-- brred -->
       <color id="13" r="108" g="113" b="196"/>    <!-- brmagenta/violet -->
       <color id="14" r="101" g="123" b="131"/>    <!-- bryellow -->
       <color id="15" r="253" g="246" b="227"/>    <!-- brwhite  -->
    </colors>
    
  3. Restart Console2.

Colors in vim look good:

Editing a CPP file in vim

Cygwin ls colors are a bit odd compared to other platforms:

Cygwin directory listing

Posted in Cygwin, Technology, Windows | Leave a comment

How to Build Microsoft Detours Express (32-bit) on 64-bit Windows

Microsoft Detours Express, which is 32-bit only, can still be built on 64-bit operating systems. Here’s how:

  1. Open a 32-bit Command Prompt (C:\Windows\SysWow64\cmd.exe).
  2. Run VCVARS32.BAT
    • VS2010: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
    • VS2008: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
  3. Set the target processor to x86 (set DETOURS_TARGET_PROCESSOR=X86).
  4. Build Detours using nmake.
Posted in Technology, Windows | Leave a comment

What Exactly Are ATL’s BEGIN_COM_MAP, END_COM_MAP, and COM_INTERFACE_ENTRY Macros?

There are many places where ATL’s COM_MAP macros are documented, but I haven’t seen it plainly stated what they actually mean.

Simply put, BEGIN_COM_MAP implements _InternalQueryInterface. COM_INTERFACE_ENTRY indicates that your class supports the specified interface. END_COM_MAP finishes the _InternalQueryInterface implementation.

Note: A QueryInterface implementation which calls this _InternalQueryInterface method must either be hand-coded, or supplied by CComObject, CComAggObject, etc.

For example:

class MyClass :
    public CComObjectRoot,
    public ISomeInterface
{
public:
    BEGIN_COM_MAP(MyClass)
        COM_INTERFACE_ENTRY(ISomeInterface)
    END_COM_MAP()
};

CComClass myInstance = new CComClass;

The COM_INTERFACE_ENTRY line indicates that MyClass implements ISomeInterface. If QueryInterface is called to requests an ISomeInterface pointer, the call will succeed. Without the COM_INTERFACE_ENTRY line, the QueryInterface call would fail.

Posted in C++, COM, Technology, Windows | Leave a comment

Enabling Wake-On-LAN on a Toshiba Satellite A505

This post describes how I fixed my Wake-On-LAN problem using the powercfg tool. My Toshiba Satellite A505-S6986 wouldn’t respond to magic packets sent over the network.

Before using powercfg, I first checked the following:

  1. Wake-On-LAN was enabled in the BIOS.
  2. All settings related to Wake-On-LAN were enabled in the adapter’s Advanced properties tab:
    • Shutdown Wake-On-Lan
    • Wake on Magic Packet
    • Wake on pattern match
  3. All wake-related settings were checked on the Power Management properties tab:
    • Allow this device to wake computer
    • Only allow a magic packet to wake the computer

Even with these settings configured properly, my laptop still wouldn’t respond to magic packets.
First, I opened a command prompt as administrator. A regular user doesn’t have the access rights to change power options.

Then, I checked to see if the LAN adapter is in the list of devices which can wake Windows:

C:\Windows\system32>powercfg -devicequery wake_armed
HID Keyboard Device (002)
HID-compliant mouse (001)
Logitech USB Wheel Mouse (004)

The Ethernet adapter isn’t in there, so I looked at the list of wake-programmable devices in order to find out the name of my LAN adapter:

C:\Windows\system32>powercfg -devicequery wake_programmable
HID-compliant device
Realtek PCIe FE Family Controller            <=== LAN adapter
HID Keyboard Device (002)
TOSHIBA Software Modem
HID-compliant mouse (001)
HID-compliant consumer control device (001)
Logitech USB Wheel Mouse (004)

Finally, I enabled wake for my Ethernet device, using the name "Realtex PCIe FE Family Controller":

C:\Windows\system32>powercfg -deviceenablewake "Realtek PCIe FE Family Controller"

(if you see an error like, "Invalid Parameters -- try "/?" for help," it most likely means that you mistyped the device name)

I am now able to wake my laptop from sleep and hibernate modes using the Wake On Lan app for my Android device.

Posted in Technology, Windows | 1 Comment

iTunes COM SDK for Windows and Encrypted File System

The “iTunes COM SDK for Windows” archive from the Apple Developer Center contains files which are marked as encrypted. Shortly after extracting the files to my libraries folder, I was surprised to receive a popup dialog from Windows 7, “Encrypting File System,” which prompted me to back up my encryption certificate and key:

Windows 7 "Encrypting File System" dialog

I used CIPHER.EXE to verify that the only encrypted contents on the volume were those of the Apple download:

C:\lib>cipher /u /n

Encrypted File(s) on your system:

C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\.DS_Store
C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\iTunesCOM.chm
C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\iTunesCOMInterface.h
C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\iTunesCOMInterface_i.c
C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\LicenseAgreement.rtf
C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\ReadMe.rtf
C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\SampleScripts\.DS_Store
C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\SampleScripts\CreateAlbumPlaylists.js
C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\SampleScripts\RemoveDeadTracks.js
C:\lib\24460_itunescomwindowssdk\iTunesCOMWindowsSDK\SampleScripts\RemoveUserPlaylists.js
C:\lib\24460_itunescomwindowssdk\__MACOSX\._iTunesCOMWindowsSDK
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\._.DS_Store
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\._iTunesCOM.chm
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\._iTunesCOMInterface.h
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\._iTunesCOMInterface_i.c
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\._LicenseAgreement.rtf
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\._ReadMe.rtf
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\._SampleScripts
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\SampleScripts\._.DS_Store
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\SampleScripts\._CreateAlbumPlaylists.js
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\SampleScripts\._RemoveDeadTracks.js
C:\lib\24460_itunescomwindowssdk\__MACOSX\iTunesCOMWindowsSDK\SampleScripts\._RemoveUserPlaylists.js

To fix this, I opened the properties for the iTunesCOMWindowsSDK folder, selected the General tab, clicked Advanced, and unselected “Encrypt contents to secure data”:

Posted in Technology, Windows | Leave a comment

Where is the iTunes SDK?

The Apple iTunes SDK (“iTunes COM SDK for Windows”) is astonishingly difficult to find. It can be found on the Dowloads & ADC Program Assets (connect.apple.com) page. In the “Downloads” box on the right, click on “Developer Tools,” then search the page for “iTunes COM SDK for Windows.”

The irritating thing is that there seems to be no direct path from the Apple Developer’s Center to this “Downloads & ADC Program Assets” page.

Posted in Technology, Windows | Leave a comment

id3v2: Command Line MP3 Tag Editor Compiled for Cygwin

id3v2 is a powerful command line tool for editing MP3 ID3 tags.  Getting it to compile on Windows under Cygwin, though, took a bit of effort.

For the convenience of others, here is id3v2 0.1.12 compiled under Cygwin.  It depends upon Cygwin and Cygwin’s zlib package.

Posted in Cygwin, Technology, Windows | 2 Comments

BluetoothAPIs.h Broken in Windows SDK

Summary

The Microsoft Windows SDK versions 7.0 and 7.1 appear to have broken BluetoothAPIs.h header files.

Update:  Microsoft has fixed the errors in the Bluetooth header as of SDK version 8.0 for Windows 8.

Details

So far, I have uncovered two types of errors in this header file:

    • The use of

#pragma deprecate

      instead of

#pragma deprecated

      , causing compiler warnings.

    • Several callback function pointer type definitions omit the

CALLBACK

      (

__stdcall

    ) calling convention, causing a crash.

The first error simply results in compiler warnings.

warning C4068: unknown pragma

The second type of error results in dereferencing of an invalid memory location when using BluetoothRegisterForAuthenticationEx and BluetoothAuthenticateDeviceEx. This is because the standard calling convention (__cdecl) assumes that the caller will clean up the stack. Since the caller in this case is assuming that the callback function minded its own stack, it immediately pops ESI, placing zero into the register:

5EBCFFE2  mov         ecx,dword ptr [ebp-4]  
5EBCFFE5  pop         esi  
5EBCFFE6  xor         ecx,ebp  
5EBCFFE8  pop         ebx  
5EBCFFE9  call        @__security_check_cookie@4 (5EBDBBBBh)

Later, ntdll.dll dereferences memory at ESI + 4, triggering an access violation:

774A8301  test        byte ptr [esi+4],4

“Unhandled exception at 0x774a8301 (ntdll.dll) in [Application]: 0xC0000005: Access violation reading location 0×00000004.

Solution

To the compiler warnings, I replaced all instances of

#pragma deprecate

with

#pragma deprecated

To fix the crash bug, I added the CALLBACK calling convention keyword to PFN_AUTHENTICATION_CALLBACK and PFN_AUTHENTICATION_CALLBACK_EX. They now appear as follows:

typedef BOOL (CALLBACK *PFN_AUTHENTICATION_CALLBACK)(LPVOID pvParam, PBLUETOOTH_DEVICE_INFO pDevice);

typedef BOOL (CALLBACK *PFN_AUTHENTICATION_CALLBACK_EX)(__in_opt LPVOID pvParam, __in PBLUETOOTH_AUTHENTICATION_CALLBACK_PARAMS pAuthCallbackParams);

Interestingly, the function pointer type definitions for the attribute-enumeration and device-selection callbacks (PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK and PFN_DEVICE_CALLBACK, respectively) are defined correctly, using CALLBACK or WINAPI. I suspect that the inconsistency is because someone at Microsoft was using the /Gz compiler switch, making __stdcall the default calling convention.

Posted in Technology, Win32, Windows | 2 Comments