When information on all IMs is required, first call WinIMQueryIM with NULL in pRecSize. The GTR will return the required total buffer size at the address pointed to by pRecSize. Then call WinIMQueryIM with the required buffer size in pRecSize.
For example:
ULONG pRecSize = 0;
PIMREC pIMRecs = 0;
WinIMQueryIM( &pRecSize, &pIMRecs );
pIMRecs = malloc( pRecSize );
WinIMQueryIM( &pRecSize, &pIMRecs );
This function requires ulSize and IMName when information for a specific IM is queried.
If the hwndIM is NULL, it means that the IM is not currently loaded. When the IM is loaded, this field contains the window handle.