MRESULT hia_wmCreate(HWND hwnd,MPARAM mp1,MPARAM mp2) { HIA *hia = NULL; HIABuf *hiabuf = NULL; HIANotifWnd *notifList = NULL; ULONG notifListAllocSize = HIA_NOTIFLIST_DEFAULT_SIZE; HWND hwndOwner = WinQueryWindow(hwnd,QW_OWNER); USHORT Id = WinQueryWindowUShort(hwnd,QWS_ID); int i; if (DosAllocMem((PPVOID)&hiabuf,sizeof(HIABuf),fALLOC)) return MRFROMLONG(TRUE); #ifdef DEBUG assert(hiabuf!=NULL); #endif HIABufClear(hiabuf); if (DosAllocMem((PPVOID)¬ifList,sizeof(HIANotifWnd)*notifListAllocSize,fALLOC)) return MRFROMLONG(TRUE); #ifdef DEBUG assert(notifList!=NULL); #endif for (i=0;i<notifListAllocSize;i++) { notifList[i].hwnd = NULLHANDLE; notifList[i].id = 0; } if (DosAllocMem((PPVOID)&hia,sizeof(HIA),fALLOC)) return MRFROMLONG(TRUE); #ifdef DEBUG assert(hia!=NULL); #endif hia->hwndHIA = hwnd; hia->inbuf = hiabuf; hia->kbdtype = HAN_KBD_2; hia->hanmode = HCH_ENG; hia->insertmode = HAN_INSERT; hia->hcode = HCH_JSY; hia->isHanjaKey = hia_defaultHanjaKey; hia->isSpecialCharKey = hia_defaultSpecialCharKey; hia->notifListAllocSize = notifListAllocSize; hia->notifList = notifList; hia->notifList[0].hwnd = hwndOwner; hia->notifList[0].id = Id; hia->responseTo = &(hia->notifList[0]); hia->hwndHCHLB = NULLHANDLE; hia->fRunningHCHLB = FALSE; hia->scselIndex = 0; if (!WinSetWindowPtr(hwnd,WINWORD_INSTANCE,(PVOID)hia)) return MRFROMLONG(TRUE); return 0L; }
MRESULT hia_usermCancelBuf(HWND hwnd,MPARAM mp1,MPARAM mp2) { HIA *hia = WinQueryWindowPtr(hwnd,WINWORD_INSTANCE); ULONG temp; // printf("HIAM_CANCELBUF\n"); temp = hia->inbuf->newpos; HIABufClear(hia->inbuf); HIA_NotifyToConnected(hia,HIAN_COMPO_CANCEL,0); return MRFROMLONG(temp); }
MRESULT hia_usermCompleteHch(HWND hwnd,MPARAM mp1,MPARAM mp2) { HIA *hia = WinQueryWindowPtr(hwnd,WINWORD_INSTANCE); HANCHAR hch; // printf("HIAM_COMPLETEHCH\n"); if (hia->inbuf->newpos == HIABUF_NONE) return 0L; hch = HIABufPeekHch(hia->inbuf); HIA_NotifyToConnected(hia,HIAN_COMPO_COMPLETE,MPFROM2SHORT(hch,0)); HIA_NotifyToConnected(hia,HIAN_INSERTHCH,MPFROM2SHORT(hch,0)); HIABufClear(hia->inbuf); return MRFROM2SHORT(hch,0); }