示例#1
0
void Mint::EnableIME(bool bEnable)
{
	_ASSERT(GetHWND());
	if ( (bEnable == true) && MEvent::GetIMESupport()) {
		if (m_hImc) {
			ImmAssociateContext(GetHWND(), m_hImc);
			m_hImc = NULL;	// EnableIME(false) ÇÒ¶§ ´Ù½Ã ¼ÂÆõȴÙ
			::SetFocus(GetHWND());
		}
		m_bEnableIME = true;
	} else {
		// HIMC¸¦ m_hImc¿¡ Àӽà º¸°üÇØ µ×´Ù°¡, Enable¶§ º¹±¸ÇÑ´Ù.
		m_hImc = ImmGetContext(GetHWND());
		if (m_hImc) {
			ImmAssociateContext(GetHWND(), NULL);
			ImmReleaseContext(GetHWND(), m_hImc);
			::SetFocus(GetHWND());
		}
		//ImmDisableIME(0);
		m_bEnableIME = false;
	}

	// CompositionÁßÀÎ ¹®ÀÚ¿­ Á¦°Å
	HIMC hImc = ImmGetContext(GetInstance()->GetHWND());
	if(hImc!=NULL){
		ImmNotifyIME(hImc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
		ImmReleaseContext(GetInstance()->GetHWND(), hImc);
	}
}
示例#2
0
void QWindowsInputContext::setFocusObject(QObject *object)
{
    // ### fixme: On Windows 8.1, it has been observed that the Input context
    // remains active when this happens resulting in a lock-up. Consecutive
    // key events still have VK_PROCESSKEY set and are thus ignored.
    if (m_compositionContext.isComposing)
        imeNotifyCancelComposition(m_compositionContext.hwnd);

    const QWindow *window = QGuiApplication::focusWindow();
    if (object && window && window->handle()) {
        QWindowsWindow *platformWindow = QWindowsWindow::baseWindowOf(window);
        if (inputMethodAccepted()) {
            // Re-enable IME by associating default context saved on first disabling.
            if (platformWindow->testFlag(QWindowsWindow::InputMethodDisabled)) {
                ImmAssociateContext(platformWindow->handle(), QWindowsInputContext::m_defaultContext);
                platformWindow->clearFlag(QWindowsWindow::InputMethodDisabled);
            }
        } else {
            // Disable IME by associating 0 context. Store context first time.
            if (!platformWindow->testFlag(QWindowsWindow::InputMethodDisabled)) {
                const HIMC oldImC = ImmAssociateContext(platformWindow->handle(), 0);
                platformWindow->setFlag(QWindowsWindow::InputMethodDisabled);
                if (!QWindowsInputContext::m_defaultContext && oldImC)
                    QWindowsInputContext::m_defaultContext = oldImC;
            }
        }
    }
}
示例#3
0
文件: win.c 项目: zero-ui/btplay
ZuiVoid ZuiOsSetImeStatus(ZuiWindow Window, ZuiBool Status){
	if (Status){//打开
		ImmAssociateContext(Window->OsWindow->hWnd, Window->OsWindow->hIMC);
	}
	else{//关闭
		ImmAssociateContext(Window->OsWindow->hWnd, NULL);
	}
}
示例#4
0
BOOL
SetNLSMode(
    HWND hWnd,
    HANDLE hConsole,
    DWORD fdwConversion
    )
{
    PCONSOLE_TABLE ConTbl;
    HIMC hIMC;

    ConTbl = SearchConsole(hConsole);
    if (ConTbl == NULL) {
        DBGPRINT(("CONIME: Error! Cannot found registed Console\n"));
        return FALSE;
    }

    if (fdwConversion & IME_CMODE_DISABLE)
    {
        ImmSetActiveContextConsoleIME(hWnd, FALSE) ;
        ImmAssociateContext(hWnd, (HIMC)NULL);
        ConTbl->hIMC_Current = (HIMC)NULL;
    }
    else
    {
        ImmAssociateContext(hWnd, ConTbl->hIMC_Original);
        ImmSetActiveContextConsoleIME(hWnd, TRUE) ;
        ConTbl->hIMC_Current = ConTbl->hIMC_Original;
    }

    hIMC = ImmGetContext( hWnd ) ;
    if ( hIMC == (HIMC)NULL )
        return TRUE;

    ConTbl->fOpen =(fdwConversion & IME_CMODE_OPEN) ? TRUE : FALSE ;
    ImmSetOpenStatus(hIMC, ConTbl->fOpen);

    fdwConversion &= ~(IME_CMODE_DISABLE | IME_CMODE_OPEN);
    if (ConTbl->dwConversion != fdwConversion)
    {
        ConTbl->dwConversion = fdwConversion;
        ImmSetConversionStatus(hIMC,
                               ConTbl->dwConversion,
                               ConTbl->dwSentence );
    }

    ImmReleaseContext( hWnd, hIMC );

    return TRUE;
}
示例#5
0
void Input::EnableIME(HWND hWnd)
{
	if (m_hIMC)
	{
		ImmAssociateContext(hWnd, m_hIMC);
	}
}
示例#6
0
文件: conime.c 项目: conioh/os-design
BOOL
ConsoleKillFocus(
    HWND hWnd,
    HANDLE hConsole
    )
{
    PCONSOLE_TABLE ConTbl;

    ConTbl = SearchConsole(hConsole);
    if (ConTbl == NULL) {
        DBGPRINT(("CONIME: Error! Cannot found registed Console\n"));
        return FALSE;
    }

    if ( gfDoNotKillFocus ){
        gfDoNotKillFocus = FALSE;
    }
    else{
//v-hirshi Jun.13.1996 #if defined(LATER_DBCS)  // kazum
        ImmSetActiveContextConsoleIME(hWnd, FALSE);
//v-hirshi Jun.13.1996 #endif
        ImmAssociateContext(hWnd, ghDefaultIMC);
    }

#ifdef DEBUG_MODE
    DisplayInformation(hWnd, hConsole);
#endif

    return TRUE;
}
示例#7
0
LRESULT CIme::ImeProc( uint32 message, WPARAM wParam, LPARAM lParam )
{    
	HKL hCurKL = GetKeyboardLayout( 0 );
	if( m_hCurKL == hCurKL )
		return DefWindowProcW( m_hWnd, message, wParam, lParam );
	m_hCurKL = hCurKL;

	SetImeIcon();
	ImmAssociateContext( m_hWnd, m_hImc );
	LRESULT re = DefWindowProcW( m_hWnd, message, wParam, lParam );
	if( !m_bEnableIme )
		ImmAssociateContext( m_hWnd, NULL );

	m_uCharBuf = 0;
	return re;
}
示例#8
0
//ÆôÓᢹرÕÊäÈë·¨
void CIme::EnableIme( bool bEnable )
{ 
	if( m_bEnableIme == bEnable )
		return;

	ImmAssociateContext( m_hWnd, bEnable ? m_hImc : NULL );
	m_bEnableIme = bEnable;
}
示例#9
0
//--------------------------------------------------------------------------
void VeWindows::_DisableIME(Window* pkWindow)
{
	WindowData* pkData = (WindowData*)(VeRefObject*)pkWindow->m_spDriverData;
	if(!pkData->m_hImc)
	{
		pkData->m_hImc = ImmGetContext(pkData->m_hWnd);
		ImmAssociateContext(pkData->m_hWnd, NULL);
	}
}
示例#10
0
文件: ime.c 项目: AmesianX/wine
void IME_UpdateAssociation(HWND focus)
{
    ImmGetContext(focus);

    if (!focus || !hSelectedFrom)
        return;

    ImmAssociateContext(focus,RealIMC(FROM_X11));
}
示例#11
0
//--------------------------------------------------------------------------
void VeWindows::_EnableIME(Window* pkWindow)
{
	WindowData* pkData = (WindowData*)(VeRefObject*)pkWindow->m_spDriverData;
	if(pkData->m_hImc)
	{
		ImmAssociateContext(pkData->m_hWnd, pkData->m_hImc);
		ImmReleaseContext(pkData->m_hWnd, pkData->m_hImc);
		pkData->m_hImc = NULL;
	}
}
示例#12
0
文件: win.c 项目: zero-ui/btplay
ZuiOsWindow ZuiOsCreateWindow(ZuiInt Left, ZuiInt Top, ZuiInt Width, ZuiInt Height, ZuiText Title, ZuiBool ShowInTaskbar, ZuiBool PosMiddle, ZuiWindow Window) {
	static ZuiBool ClassRegistered;//是否注册WNDCLASS
	if (!ClassRegistered) {
		/*第一次调用该函数向系统注册ZuiUI.Window类*/
		WNDCLASSEXW WindowClass;
		memset(&WindowClass, 0, sizeof(WindowClass));
		WindowClass.cbSize = sizeof(WindowClass);
		WindowClass.lpfnWndProc = (WNDPROC)&ZuiOsWin32WindowProc;
		WindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
		WindowClass.lpszClassName = L"ZuiUI.Window";
		WindowClass.hCursor = LoadCursor(NULL, IDC_ARROW);/*箭头光标*/
		WindowClass.hInstance = GetModuleHandleA(NULL);
		RegisterClassExW(&WindowClass);
		ClassRegistered = 1;
	}
	if (PosMiddle) {
		/*窗口居中*/
		Left = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2;
		Top = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2;
	}
	MAKEVRECT(Window->Rect, Left, Top, Width, Height);
	HWND hWnd = CreateWindowExW(ShowInTaskbar ? FALSE : WS_EX_TOOLWINDOW,
		L"ZuiUI.Window",
		Title,
		-1811937280,
		Left,
		Top,
		Width,
		Height,
		NULL,
		NULL,
		NULL,
		NULL
		);
	if (!IsWindow(hWnd)) {
		return NULL;
	}
	/*保存相关参数到VOsWindow*/
	ZuiOsWindow OsWindow = (ZuiOsWindow)malloc(sizeof(ZOsWindow));
	if (OsWindow)
	{
		memset(OsWindow, 0, sizeof(ZOsWindow));
		OsWindow->hWnd = hWnd;
		OsWindow->hDC = GetDC(hWnd);
		OsWindow->hIMC = ImmGetContext(hWnd);//获取系统的输入法
		/*屏蔽输入法*/
		ImmAssociateContext(hWnd, NULL);
		SetPropW(OsWindow->hWnd, PROP_ID, (HANDLE)Window);
		return OsWindow;
	}
	return NULL;
}
示例#13
0
文件: conime.c 项目: conioh/os-design
VOID
ExitList(
    HWND hWnd
    )
{
    ULONG i ,j;
    PCONSOLE_TABLE FocusedConsole;

    DBGPRINT(("CONIME:ExitList Processing\n"));
    ImmAssociateContext(hWnd,ghDefaultIMC);

    LockConsoleTable();

    for (i = 1; i < NumberOfConsoleTable; i++) {
        FocusedConsole = ConsoleTable[i];
        if (FocusedConsole != NULL)
        {
            if (FocusedConsole->hConsole != NULL) {
                if (FocusedConsole->Enable) {
                    ImmDestroyContext(FocusedConsole->hIMC_Original);
                    if ( FocusedConsole->lpCompStrMem != NULL) {
                        LocalFree( FocusedConsole->lpCompStrMem );
                        FocusedConsole->lpCompStrMem = NULL;
                    }
                    for (j = 0; j < MAX_LISTCAND; j++){
                        if (FocusedConsole->lpCandListMem[j] != NULL) {
                            LocalFree(FocusedConsole->lpCandListMem[j]);
                            FocusedConsole->lpCandListMem[j] = NULL;
                            FocusedConsole->CandListMemAllocSize[j] = 0;
                        }
                    }
                    if (FocusedConsole->CandSep != NULL) {
                        LocalFree(FocusedConsole->CandSep);
                        FocusedConsole->CandSepAllocSize = 0;
                    }
                    FocusedConsole->Enable = FALSE;
                }
                else
                    FocusedConsole->LateRemove = TRUE;
            }
        }
    }
    LocalFree( ConsoleTable );
    UnlockConsoleTable();

    if (dwConsoleThreadId)
    {
        AttachThreadInput(GetCurrentThreadId(), dwConsoleThreadId, FALSE);
        UnregisterConsoleIME();
        dwConsoleThreadId = 0;
    }
}
示例#14
0
文件: conime.c 项目: conioh/os-design
BOOL
ConsoleSetFocus(
    HWND hWnd,
    HANDLE hConsole,
    HKL hKL
    )
{
    PCONSOLE_TABLE ConTbl;
    HKL OldhKL;

    ConTbl = SearchConsole(hConsole);
    if (ConTbl == NULL) {
        DBGPRINT(("CONIME: Error! Cannot found registed Console\n"));
        return FALSE;
    }

    if ( gfDoNotKillFocus ){
        gfDoNotKillFocus = FALSE;
    }

    OldhKL = ConTbl->hklActive ;
    ConTbl->hklActive = hKL;
    ActivateKeyboardLayout(ConTbl->hklActive, 0);
    ImmAssociateContext(hWnd, ConTbl->hIMC_Current);

    if (OldhKL == 0) {
        GetIMEName( ConTbl );
        ConTbl->ImmGetProperty = ImmGetProperty(ConTbl->hklActive , IGP_PROPERTY);
    }

//v-hirshi Jun.13.1996 #if defined(LATER_DBCS)  // kazum
    ImmSetActiveContextConsoleIME(hWnd, TRUE);
//v-hirshi Jun.13.1996 #endif

    LastConsole = hConsole;

#ifdef DEBUG_MODE
    DisplayInformation(hWnd, hConsole);
#endif

    ImeUISetOpenStatus( hWnd );
    if (ConTbl->lpCompStrMem != NULL)
        ReDisplayCompositionStr( hWnd );

    return TRUE;
}
示例#15
0
		static void setAlwaysOff(HWND hwnd)
		{
			ImmAssociateContext(hwnd, NULL);
		}
示例#16
0
void Input::DisableIME(HWND hWnd)
{
	m_hIMC = ImmAssociateContext(hWnd, nullptr);
}
示例#17
0
文件: imm32.c 项目: krofna/wine
static void test_ImmThreads(void)
{
    HIMC himc, otherHimc, h1;
    igc_threadinfo threadinfo;
    HANDLE hThread;
    DWORD dwThreadId;
    BOOL rc;
    LOGFONT lf;
    COMPOSITIONFORM cf;
    DWORD status, sentence;
    POINT pt;

    himc = ImmGetContext(hwnd);
    threadinfo.event = CreateEvent(NULL, TRUE, FALSE, NULL);
    threadinfo.himc = himc;
    hThread = CreateThread(NULL, 0, ImmGetContextThreadFunc, &threadinfo, 0, &dwThreadId );
    WaitForSingleObject(threadinfo.event, INFINITE);

    otherHimc = ImmGetContext(threadinfo.hwnd);

    todo_wine ok(himc != otherHimc, "Windows from other threads should have different himc\n");
    todo_wine ok(otherHimc == threadinfo.himc, "Context from other thread should not change in main thread\n");

    if (0) /* FIXME: Causes wine to hang */
    {
    h1 = ImmAssociateContext(hwnd,otherHimc);
    ok(h1 == NULL, "Should fail to be able to Associate a default context from a different thread\n");
    h1 = ImmGetContext(hwnd);
    ok(h1 == himc, "Context for window should remain unchanged\n");
    ImmReleaseContext(hwnd,h1);
    }


    /* OpenStatus */
    rc = ImmSetOpenStatus(himc, TRUE);
    ok(rc != 0, "ImmSetOpenStatus failed\n");
    rc = ImmGetOpenStatus(himc);
    ok(rc != 0, "ImmGetOpenStatus failed\n");
    rc = ImmSetOpenStatus(himc, FALSE);
    ok(rc != 0, "ImmSetOpenStatus failed\n");
    rc = ImmGetOpenStatus(himc);
    ok(rc == 0, "ImmGetOpenStatus failed\n");

    rc = ImmSetOpenStatus(otherHimc, TRUE);
    todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n");
    rc = ImmGetOpenStatus(otherHimc);
    todo_wine ok(rc == 0, "ImmGetOpenStatus failed\n");
    rc = ImmSetOpenStatus(otherHimc, FALSE);
    todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n");
    rc = ImmGetOpenStatus(otherHimc);
    ok(rc == 0, "ImmGetOpenStatus failed\n");

    /* CompositionFont */
    rc = ImmGetCompositionFont(himc, &lf);
    ok(rc != 0, "ImmGetCompositionFont failed\n");
    rc = ImmSetCompositionFont(himc, &lf);
    ok(rc != 0, "ImmSetCompositionFont failed\n");

    rc = ImmGetCompositionFont(otherHimc, &lf);
    ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont failed\n");
    rc = ImmSetCompositionFont(otherHimc, &lf);
    todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n");

    /* CompositionWindow */
    rc = ImmSetCompositionWindow(himc, &cf);
    ok(rc != 0, "ImmSetCompositionWindow failed\n");
    rc = ImmGetCompositionWindow(himc, &cf);
    ok(rc != 0, "ImmGetCompositionWindow failed\n");

    rc = ImmSetCompositionWindow(otherHimc, &cf);
    todo_wine ok(rc == 0, "ImmSetCompositionWindow should fail\n");
    rc = ImmGetCompositionWindow(otherHimc, &cf);
    ok(rc != 0 || broken(rc == 0), "ImmGetCompositionWindow failed\n");

    /* ConversionStatus */
    rc = ImmGetConversionStatus(himc, &status, &sentence);
    ok(rc != 0, "ImmGetConversionStatus failed\n");
    rc = ImmSetConversionStatus(himc, status, sentence);
    ok(rc != 0, "ImmSetConversionStatus failed\n");

    rc = ImmGetConversionStatus(otherHimc, &status, &sentence);
    ok(rc != 0 || broken(rc == 0), "ImmGetConversionStatus failed\n");
    rc = ImmSetConversionStatus(otherHimc, status, sentence);
    todo_wine ok(rc == 0, "ImmSetConversionStatus should fail\n");

    /* StatusWindowPos */
    rc = ImmSetStatusWindowPos(himc, &pt);
    ok(rc != 0, "ImmSetStatusWindowPos failed\n");
    rc = ImmGetStatusWindowPos(himc, &pt);
    ok(rc != 0, "ImmGetStatusWindowPos failed\n");

    rc = ImmSetStatusWindowPos(otherHimc, &pt);
    todo_wine ok(rc == 0, "ImmSetStatusWindowPos should fail\n");
    rc = ImmGetStatusWindowPos(otherHimc, &pt);
    ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n");

    ImmReleaseContext(threadinfo.hwnd,otherHimc);
    ImmReleaseContext(hwnd,himc);

    DestroyWindow(threadinfo.hwnd);
    TerminateThread(hThread, 1);

    himc = ImmGetContext(GetDesktopWindow());
    todo_wine ok(himc == NULL, "Should not be able to get himc from other process window\n");
}
示例#18
0
int  xWnd32IMEInput::associateContext(int hWndHandle, int hImc)
{
	ImmAssociateContext((HWND)hWndHandle, (HIMC)hImc);
	return 0;
}
示例#19
0
static BOOL
startup_main()
{
	WNDCLASS	wc;
	HWND		hWnd;
	RECT		rc;
	Uint32		x;
	Uint32		y;
	HWND		hWndTmp;

	ZeroMemory(&wc, sizeof(wc));
	wc.style		 = 0;
	wc.lpfnWndProc	 = startup_wnd_proc;
	wc.cbClsExtra	 = 0;
	wc.cbWndExtra	 = 0;
	wc.hInstance	 = _hInstance;
	wc.hIcon		 = LoadIcon(_hInstance, MAKEINTRESOURCE(OOTAKEICON)); //アイコンを読み込み。v2.00更新
	wc.hCursor		 = LoadCursor(NULL, IDC_ARROW);
	_hMyb = CreateSolidBrush(RGB(64,128,64)); //ブラシを作る
	wc.hbrBackground = _hMyb;
	wc.lpszMenuName  = "";
	wc.lpszClassName = _pCaption;

	if (RegisterClass(&wc) == 0)
		return FALSE;

	hWnd = CreateWindow(
		_pCaption,
		_pCaption,
		WS_SYSMENU | WS_CAPTION,
		CW_USEDEFAULT,
		CW_USEDEFAULT,
		0,
		0,
		NULL,
		NULL,
		_hInstance,
		NULL
	);

	if (hWnd == NULL)
		return FALSE;

	_hWnd = hWnd;

	//ボタンを作成
	x = _FontWidth*2 +1;
	y = _FontHeight*20 +3;
	hWndTmp = CreateWindow(
		"BUTTON", "Load &CD-ROM Game",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		x, y, _FontWidth*21, _FontHeight*2-4,
		_hWnd, (HMENU)BUTTON_CDROM, _hInstance, NULL
	);
	SendMessage(hWndTmp, WM_SETFONT, (WPARAM)_hFontB, MAKELPARAM(TRUE, 0));//文字のフォントを設定
	
	x += _FontWidth*21 +3;
	hWndTmp = CreateWindow(
		"BUTTON", "Load &Hu-CARD Game",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		x, y, _FontWidth*22, _FontHeight*2-4,
		_hWnd, (HMENU)BUTTON_HUCARD, _hInstance, NULL
	);
	SendMessage(hWndTmp, WM_SETFONT, (WPARAM)_hFontB, MAKELPARAM(TRUE, 0));//文字のフォントを設定
	
	x = _FontWidth*2 +1;
	y += _FontHeight*2 -2;
	hWndTmp = CreateWindow(
		"BUTTON", "Option",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		x, y, _FontWidth*9, _FontHeight + _FontHeight/2+2,
		_hWnd, (HMENU)BUTTON_OPTION, _hInstance, NULL
	);
	SendMessage(hWndTmp, WM_SETFONT, (WPARAM)_hFontB, MAKELPARAM(TRUE, 0));//文字のフォントを設定
/*
	x = _FontWidth*2;
	hWndTmp = CreateWindow(
		"BUTTON", "&Favorite",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		x, y, _FontWidth*11, _FontHeight + _FontHeight/2+2,
		_hWnd, (HMENU)BUTTON_FAVORITE, _hInstance, NULL
	);
	SendMessage(hWndTmp, WM_SETFONT, (WPARAM)_hFontB, MAKELPARAM(TRUE, 0));//文字のフォントを設定
*/
	x += _FontWidth*9 +3;
	hWndTmp = CreateWindow(
		"BUTTON", "&Play Installed CD",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		x, y, _FontWidth*21, _FontHeight + _FontHeight/2+2,
		_hWnd, (HMENU)BUTTON_CUE, _hInstance, NULL
	);
	SendMessage(hWndTmp, WM_SETFONT, (WPARAM)_hFontB, MAKELPARAM(TRUE, 0));//文字のフォントを設定

	x += _FontWidth*21 +3;
	hWndTmp = CreateWindow(
		"BUTTON", "&Replay",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		x, y, (_FontWidth*30 + 4 + _FontWidth*15)-x, _FontHeight + _FontHeight/2+2,
		_hWnd, (HMENU)BUTTON_REPLAY, _hInstance, NULL
	);
	SendMessage(hWndTmp, WM_SETFONT, (WPARAM)_hFontB, MAKELPARAM(TRUE, 0));//文字のフォントを設定

	ShowWindow(_hWnd, SW_SHOWNORMAL);
	UpdateWindow(_hWnd);
	GetWindowRect(_hWnd, &rc);
	SetWindowPos(_hWnd, HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_FRAMECHANGED); //手前に表示
	ImmAssociateContext(_hWnd, 0); //Kitao追加。IMEを無効にする。v0.79

	return TRUE;
}
示例#20
0
static HRESULT WINAPI ActiveIMMApp_AssociateContext(IActiveIMMApp* iface,
        HWND hWnd, HIMC hIME, HIMC *phPrev)
{
    *phPrev = ImmAssociateContext(hWnd,hIME);
    return S_OK;
}
示例#21
0
文件: mew.c 项目: redtower/rc
/******************************************************************
 *                        Setup                                   *
 ******************************************************************/
BOOL CALLBACK SetupMewDlgProc( HWND   hDlg,
			       UINT   uiMsg,
			       WPARAM wParam,
			       LPARAM lParam )
{
  BOOL fRet = TRUE;
  char *pt;
  char szFileName[MAX_PATH];
  OPENFILENAME of;

  switch ( uiMsg ){
  case WM_INITDIALOG:
    CheckRadioButton( hDlg, IDC_POP_APOP, IDC_POP_APOP, IDC_POP_APOP );
    ImmAssociateContext(GetDlgItem(hDlg, IDC_USERNAME), (HIMC)NULL);
    ImmAssociateContext(GetDlgItem(hDlg, IDC_MAILADDRESS), (HIMC)NULL);
    ImmAssociateContext(GetDlgItem(hDlg, IDC_SMTPSERVER), (HIMC)NULL);
    ImmAssociateContext(GetDlgItem(hDlg, IDC_POPSERVER), (HIMC)NULL);
    ImmAssociateContext(GetDlgItem(hDlg, IDC_POPUSER), (HIMC)NULL);
    SetDlgItemText(hDlg, IDC_CONFIGFILE, (LPCTSTR)lParam);
    ShowWindow( hDlg, SW_SHOW );
    UpdateWindow( hDlg );
    break;

  case WM_COMMAND:
    switch ( GET_WM_COMMAND_ID( wParam, lParam ) ){
    case IDC_FILESELECT:
	memset(szFileName, 0, sizeof(szFileName));
	memset(&of, 0, sizeof(of));
	of.lStructSize = sizeof(of);
	of.hwndOwner   = hDlg;
	of.lpstrFilter = "All Files(*.*)\0*.*\0";
	of.lpstrFile   = szFileName;
	of.nMaxFile    = MAX_PATH;
	of.Flags       = OFN_FILEMUSTEXIST|OFN_LONGNAMES|OFN_PATHMUSTEXIST;
	of.lpstrTitle  = "Select .emacs or .mew file.";
	if (GetOpenFileName(&of))
	    SetDlgItemText(hDlg, IDC_CONFIGFILE, szFileName);
	break;
    case IDOK:
      GetDlgItemText( hDlg, IDC_USERNAME, szUserFullName, sizeof(szUserFullName) );
      if ( ! strcmp( szUserFullName, "" ) ){
	BilErrorMessageBox( "User Name is empty.",
			    "User Name の欄が空白です" );
	break;
      }
      GetDlgItemText( hDlg, IDC_MAILADDRESS, szMailAddress, sizeof(szMailAddress) );
      if ( ! strcmp( szMailAddress, "" ) ){
	BilErrorMessageBox( "Mail Address is empty.",
			    "Mail Address の欄が空白です" );
	break;
      }
      pt = strchr( szMailAddress, '@' );
      if ( pt != NULL ){
	*pt = '\0';
	if ( *(pt+1) != '\0' ){
	  strcpy(szUserName,szMailAddress);
	  strcpy(szDomainName, pt+1 );
	  *pt = '@';
	} /* if ( *(pt+1) != '\0' ){ */
      } else {
	BilErrorMessageBox( "Invalid mail address.",
			    "メールアドレスが不正です" );
	SetDlgItemText( hDlg, IDC_MAILADDRESS, "" );
	fRet = FALSE;
	break;
      } /* if ( pt != NULL ){ */
      GetDlgItemText( hDlg, IDC_SMTPSERVER, szSmtpserver, sizeof(szSmtpserver) );
      if ( ! strcmp( szSmtpserver, "" ) ){
	BilErrorMessageBox( "SMTP Server is empty.",
			    "SMTP Server の欄が空白です" );
	break;
      }
      GetDlgItemText( hDlg, IDC_POPSERVER, szPopserver, sizeof(szPopserver) );
      if ( ! strcmp( szPopserver, "" ) ){
	BilErrorMessageBox( "POP3 Server is empty.",
			    "POP3 Server の欄が空白です" );
	break;
      }
      GetDlgItemText( hDlg, IDC_POPUSER, szPopUser, sizeof(szPopUser) );
      if ( ! strcmp( szPopUser, "" ) ){
	BilErrorMessageBox( "POP3 Username is empty.",
			    "POP3 Username の欄が空白です" );
	break;
      }
      if (IsDlgButtonChecked( hDlg, IDC_POP_APOP ) != BST_CHECKED){
	  fApopAuth = FALSE;
      }
      GetDlgItemText(hDlg, IDC_CONFIGFILE,
		     szConfFileName, sizeof(szConfFileName));
      EndDialog( hDlg, 0 );
      break;
    case IDCANCEL:
      fRet = FALSE;
      EndDialog( hDlg, -1 );
      break;
    }
  default:
    fRet = FALSE;
    break;
  } /* switch ( uiMsg ){ */
  
  return ( fRet );
}
示例#22
0
文件: Application.cpp 项目: taqu/lime
    bool Application::initInternal(InitParam& initParam, const char* title, WNDPROC wndProc)
    {
        System::setApplication(this);

        //Initialize Window
        //-----------------------------------------------------------------
        //ウィンドウサイズ、ビューポートサイズはバックバッファと同じにする。
        //デバイスのパラメータにウィンドウハンドルを渡す
        lgfx::Window::InitParam windowParam;
        windowParam.style_ = initParam.windowParam_.style_;
        windowParam.exStyle_ = initParam.windowParam_.exStyle_;
        windowParam.width_ = initParam.gfxParam_.backBufferWidth_;
        windowParam.height_ = initParam.gfxParam_.backBufferHeight_;
        windowParam.title_ = title;
        windowParam.wndProc_ = wndProc;
        if(!window_.create(windowParam)){
            return false;
        }
        System::setWindow(&window_);

        //Initialize Graphics
        //-----------------------------------------------------------------
        initParam.gfxParam_.windowHandle_ = window_.getHandle();
#if defined(_WIN32)
        ImmAssociateContext(initParam.gfxParam_.windowHandle_, NULL); //IME OFF
#endif
        if(false == lgfx::initializeGraphics(initParam.gfxParam_)){
            window_.destroy();
            return false;
        }

        //Initialize Input
        //-----------------------------------------------------------------
        initParam.inputParam_.windowHandle_ = initParam.gfxParam_.windowHandle_;
        if(linput::Error_None != input_.initialize(initParam.inputParam_)){
            return false;
        }
        System::setInput(&input_);

        //Initialize Timer
        //-----------------------------------------------------------------
        timer_.reset();
        System::setTimer(&timer_);

        //Initialize FileSystem
        //-----------------------------------------------------------------
        lcore::FileSystem* fileSystem = LNEW lcore::FileSystem();
        System::setFileSystem(fileSystem);

        //Initialize Sound
        //-----------------------------------------------------------------
        lsound::Context::InitParam soundInitParam;
        soundInitParam.numQueuedBuffers_ = initParam.soundParam_.numQueuedBuffers_;
        soundInitParam.maxPlayers_ = initParam.soundParam_.maxPlayers_;
        soundInitParam.maxUserPlayers_ = initParam.soundParam_.maxUserPlayers_;
        soundInitParam.waitTime_ = initParam.soundParam_.waitTime_;
        if(!lsound::Context::initialize(soundInitParam)){
            return false;
        }
        lsound::Context& context = lsound::Context::getInstance();
        context.setGain(initParam.soundParam_.masterGain_);

        //Initialize Resources
        //-----------------------------------------------------------------
        Resources* resources = Resources::create(4, fileSystem);
        resources->getInputLayoutFactory().loadDefaults();
        resources->getShaderManager().loadDefaultShaders();

        if(initParam.rendererParam_.renderWidth_<=0){
            initParam.rendererParam_.renderWidth_ = initParam.gfxParam_.backBufferWidth_;
        }
        if(initParam.rendererParam_.renderHeight_<=0){
            initParam.rendererParam_.renderHeight_ = initParam.gfxParam_.backBufferHeight_;
        }
        System::setResources(resources);

        //Initialize CollideManager
        //-----------------------------------------------------------------
        CollideManager* collideManager = LNEW CollideManager();
        System::setCollideManager(collideManager);

        //Initialize Renderer
        //-----------------------------------------------------------------
        initParam.rendererParam_.shadowMapFormat_ = initParam.gfxParam_.shadowMapFormat_;
        Renderer* renderer = LNEW Renderer();
        renderer->initialize(initParam.rendererParam_);
        System::setRenderer(renderer);

        //Initialize ECSManager
        //-----------------------------------------------------------------
        ECSManager* ecsManager = ECSManager::create(initParam.ecsParam_);
        if(NULL == ecsManager){
            return false;
        }
        System::setECSManager(ecsManager);

        //Initialize RenderGraph
        //-----------------------------------------------------------------
        graph::RenderGraph* renderGraph = LNEW graph::RenderGraph();
        System::setRenderGraph(renderGraph);

        return true;
    }
示例#23
0
LRESULT CALLBACK CompStrWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HIMC hIMC    = NULL;
    HIMC hOldIMC = NULL;

    switch (message) 
    {
        case WM_CREATE:
            hIMC = ImmCreateContext();
            hOldIMC = ImmAssociateContext(hWnd,hIMC);
            SetWindowLongPtr(hWnd, 0, (LONG_PTR)hOldIMC);
            fdwProperty = ImmGetProperty(GetKeyboardLayout(0), IGP_PROPERTY);
            break;

        case WM_CHAR:
            HandleChar(hWnd,wParam,lParam);
            break;

        case WM_LBUTTONUP:  /* fall-through */
        case WM_RBUTTONUP:
            if (hIMC = ImmGetContext(hWnd))
            {
                HMENU hMenu = NULL;

                InitMenuItemIDTable();
                hMenu = CreateImeMenu(hWnd, hIMC, NULL,(message == WM_RBUTTONUP));

                if (hMenu)
                {
                    DWORD dwItemData;
                    DWORD dwPos = (DWORD)GetMessagePos();
                    int nCmd;
                  
                    nCmd = TrackPopupMenuEx(hMenu,
                                            TPM_RETURNCMD | TPM_NONOTIFY | 
                                            TPM_LEFTBUTTON | TPM_LEFTALIGN | TPM_TOPALIGN, 
                                            LOWORD(dwPos), HIWORD(dwPos), 
                                            hWnd, NULL);

                    if (nCmd)
                    {
                        nCmd -= IDM_STARTIMEMENU;
                        dwItemData = FindItemData(nCmd);
                        ImmNotifyIME(hIMC, NI_IMEMENUSELECTED, nCmd, dwItemData);
                    }
                }
                EndMenuItemIDTable();

                DestroyMenu(hMenu);
            }
            break;

        case WM_IME_SETCONTEXT:
            if (fShowCand)
            {
                lParam &= ~ISC_SHOWUICANDIDATEWINDOW;
            }

            if (fdwProperty & IME_PROP_SPECIAL_UI)
            {
                // EMPTY
            }
            else if (fdwProperty & IME_PROP_AT_CARET)
            {
                lParam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
            }
            else
            {
                // EMPTY
            }

            return (DefWindowProc(hWnd, message, wParam, lParam));

        case WM_IME_STARTCOMPOSITION:
            // Normally, we should not call into HandleStartComposition
            // for IME_PROP_SPECIAL_UI and not IME_PROP_AT_CARET IMEs
            // we should pass this message to DefWindowProc directly for
            // this kind of IMEs

            HandleStartComposition(hWnd,wParam,lParam);

            // pass this message to DefWindowProc for IME_PROP_SPECIAL_UI
            // and not IME_PROP_AT_CARET IMEs

            if (fdwProperty & IME_PROP_SPECIAL_UI)
            {
                return (DefWindowProc(hWnd, message, wParam, lParam));
            }
            else if (fdwProperty & IME_PROP_AT_CARET)
            {
                // EMPTY
            }
            else
            {
                return (DefWindowProc(hWnd, message, wParam, lParam));
            }

            break;

        case WM_IME_ENDCOMPOSITION:
            // Normally, we should not call into HandleEndComposition
            // for IME_PROP_SPECIAL_UI and not IME_PROP_AT_CARET IMEs
            // we should pass this message to DefWindowProc directly for
            // this kind of IMEs

            HandleEndComposition(hWnd,wParam,lParam);

            // pass this message to DefWindowProc for IME_PROP_SPECIAL_UI
            // and not IME_PROP_AT_CARET IMEs

            if (fdwProperty & IME_PROP_SPECIAL_UI)
            {
                return (DefWindowProc(hWnd, message, wParam, lParam));
            }
            else if (fdwProperty & IME_PROP_AT_CARET)
            {
                // EMPTY
            }
            else
            {
                return (DefWindowProc(hWnd, message, wParam, lParam));
            }
            break;

        case WM_IME_COMPOSITION:
            // Normally, we should not call into HandleComposition
            // for IME_PROP_SPECIAL_UI and not IME_PROP_AT_CARET IMEs
            // we should pass this message to DefWindowProc directly for
            // this kind of IMEs

            HandleComposition(hWnd,wParam,lParam);

            // pass this message to DefWindowProc for IME_PROP_SPECIAL_UI
            // and not IME_PROP_AT_CARET IMEs

            if (fdwProperty & IME_PROP_SPECIAL_UI)
            {
                return (DefWindowProc(hWnd, message, wParam, lParam));
            }
            else if (fdwProperty & IME_PROP_AT_CARET)
            {
                // EMPTY
            }
            else
            {
                return (DefWindowProc(hWnd, message, wParam, lParam));
            }
            break;

        case WM_PAINT:
            HandlePaint(hWnd,wParam,lParam);
            break;

        case WM_IME_NOTIFY:
            {
                LRESULT lRet;

                // Normally, we should not call into HandleNotify
                // for IME_PROP_SPECIAL_UI and not IME_PROP_AT_CARET IMEs
                // we should pass this message to DefWindowProc directly for
                // this kind of IMEs

                lRet = HandleNotify(hWnd, message, wParam, lParam);
 
                // pass this message to DefWindowProc for IME_PROP_SPECIAL_UI
                // and not IME_PROP_AT_CARET IMEs

                if (fdwProperty & IME_PROP_SPECIAL_UI)
                {
                    return (DefWindowProc(hWnd, message, wParam, lParam));
                }
                else if (fdwProperty & IME_PROP_AT_CARET)
                {
                    // EMPTY
                }
                else
                {
                    return (DefWindowProc(hWnd, message, wParam, lParam));
                }

                return lRet;
            }

        case WM_DESTROY:
            hOldIMC = (HIMC)GetWindowLongPtr(hWnd, 0);
            hIMC = ImmAssociateContext(hWnd, hOldIMC);
            ImmDestroyContext(hIMC);
            break;

        case WM_INPUTLANGCHANGE:
            fdwProperty = ImmGetProperty(GetKeyboardLayout(0), IGP_PROPERTY);

            if (hIMC = ImmGetContext(hWnd))
            {
                CANDIDATEFORM cdf = {0};

                if (fdwProperty & IME_PROP_AT_CARET)
                {
                    cdf.dwIndex = 0;
                    cdf.dwStyle = CFS_CANDIDATEPOS;
                    cdf.ptCurrentPos.x = ptImeUIPos.x;
                    cdf.ptCurrentPos.y = ptImeUIPos.y;
                    ImmSetCandidateWindow(hIMC, &cdf);
                }
                else
                {
                    UINT i;

                    // The candidate position should be decided by a near caret
                    // IME. There are 4 candidate form in the input context

                    for (i = 0; i < 4; i++)
                    {
                        if (!ImmGetCandidateWindow(hIMC, i, &cdf))
                        {
                            continue;
                        }

                        if (cdf.dwStyle == CFS_DEFAULT)
                        {
                            continue;
                        }

                        cdf.dwStyle = CFS_DEFAULT;

                        ImmSetCandidateWindow(hIMC, &cdf);
                    }

                }

                ImmReleaseContext(hWnd, hIMC);
            }

            return (DefWindowProc(hWnd, message, wParam, lParam));

        default:
	        return (DefWindowProc(hWnd, message, wParam, lParam));
    }
    return 0L;
}