線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:6908
推到 Plurk!
推到 Facebook!

列出所有輸入法(含語言輸入)、切換輸入法、監視目前輸入法

 
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-09-25 00:22:02 IP:61.224.xxx.xxx 未訂閱
這是下一個我要寫的 geOShell 的 plugins,先用 BCB 測試的 code,提供參考。
//---------------------------------------------------------------------------
// IME Tester version 0.01                                             
//
// @ List All IMEs of the windows system
// @ Switch IMEs
// @ Monitor Current IMEs (not work on other Apps)
//
// <2003-09-24>   dllee   http://dllee.ktop.com.tw
//---------------------------------------------------------------------------
#include 
#pragma hdrstop    #include "Unit1.h"
//----------------------------------------------------------------------------//
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;    typedef struct _LanguageID
{
  unsigned short ID;
  char Language[38];
} TLanguageID, *PLanguageID;    TLanguageID lidList[]={
 //Identifier Language
   {  0x0000,  "Language Neutral"},                 //  001
   {  0x007f,  "LOCALE_INVARIANT"},                 //  002
   {  0x0400,  "User Default Language"},            //  003
   {  0x0800,  "System Default Language"},          //  004
   {  0x0436,  "Afrikaans"},                        //  005
   {  0x041c,  "Albanian"},                         //  006
   {  0x0401,  "Arabic (Saudi Arabia)"},            //  007
   {  0x0801,  "Arabic (Iraq)"},                    //  008
   {  0x0c01,  "Arabic (Egypt)"},                   //  009
   {  0x1001,  "Arabic (Libya)"},                   //  010
   {  0x1401,  "Arabic (Algeria)"},                 //  011
   {  0x1801,  "Arabic (Morocco)"},                 //  012
   {  0x1c01,  "Arabic (Tunisia)"},                 //  013
   {  0x2001,  "Arabic (Oman)"},                    //  014
   {  0x2401,  "Arabic (Yemen)"},                   //  015
   {  0x2801,  "Arabic (Syria)"},                   //  016
   {  0x2c01,  "Arabic (Jordan)"},                  //  017
   {  0x3001,  "Arabic (Lebanon)"},                 //  018
   {  0x3401,  "Arabic (Kuwait)"},                  //  019
   {  0x3801,  "Arabic (U.A.E.)"},                  //  020
   {  0x3c01,  "Arabic (Bahrain)"},                 //  021
   {  0x4001,  "Arabic (Qatar)"},                   //  022
   {  0x042b,  "Armenian (Unicode only)"},          //  023
   {  0x042c,  "Azeri (Latin)"},                    //  024
   {  0x082c,  "Azeri (Cyrillic)"},                 //  025
   {  0x042d,  "Basque"},                           //  026
   {  0x0423,  "Belarusian"},                       //  027
   {  0x0402,  "Bulgarian"},                        //  028
   {  0x0455,  "Burmese"},                          //  029
   {  0x0403,  "Catalan"},                          //  030
   {  0x0404,  "Chinese (Taiwan)"},                 //  031
   {  0x0804,  "Chinese (PRC)"},                    //  032
   {  0x0c04,  "Chinese (Hong Kong SAR, PRC)"},     //  033
   {  0x1004,  "Chinese (Singapore)"},              //  034
   {  0x1404,  "Chinese (Macau SAR)"},              //  035
   {  0x041a,  "Croatian"},                         //  036
   {  0x0405,  "Czech"},                            //  037
   {  0x0406,  "Danish"},                           //  038
   {  0x0465,  "Divehi (Unicode only)"},            //  039
   {  0x0413,  "Dutch (Netherlands)"},              //  040
   {  0x0813,  "Dutch (Belgium)"},                  //  041
   {  0x0409,  "English (United States)"},          //  042
   {  0x0809,  "English (United Kingdom)"},         //  043
   {  0x0c09,  "English (Australian)"},             //  044
   {  0x1009,  "English (Canadian)"},               //  045
   {  0x1409,  "English (New Zealand)"},            //  046
   {  0x1809,  "English (Ireland)"},                //  047
   {  0x1c09,  "English (South Africa)"},           //  048
   {  0x2009,  "English (Jamaica)"},                //  049
   {  0x2409,  "English (Caribbean)"},              //  050
   {  0x2809,  "English (Belize)"},                 //  051
   {  0x2c09,  "English (Trinidad)"},               //  052
   {  0x3009,  "English (Zimbabwe)"},               //  053
   {  0x3409,  "English (Philippines)"},            //  054
   {  0x0425,  "Estonian"},                         //  055
   {  0x0438,  "Faeroese"},                         //  056
   {  0x0429,  "Farsi"},                            //  057
   {  0x040b,  "Finnish"},                          //  058
   {  0x040c,  "French (Standard)"},                //  059
   {  0x080c,  "French (Belgian)"},                 //  060
   {  0x0c0c,  "French (Canadian)"},                //  061
   {  0x100c,  "French (Switzerland)"},             //  062
   {  0x140c,  "French (Luxembourg)"},              //  063
   {  0x180c,  "French (Monaco)"},                  //  064
   {  0x0456,  "Galician"},                         //  065
   {  0x0437,  "Georgian (Unicode only)"},          //  066
   {  0x0407,  "German (Standard)"},                //  067
   {  0x0807,  "German (Switzerland)"},             //  068
   {  0x0c07,  "German (Austria)"},                 //  069
   {  0x1007,  "German (Luxembourg)"},              //  070
   {  0x1407,  "German (Liechtenstein)"},           //  071
   {  0x0408,  "Greek"},                            //  072
   {  0x0447,  "Gujarati (Unicode only)"},          //  073
   {  0x040d,  "Hebrew"},                           //  074
   {  0x0439,  "Hindi (Unicode only)"},             //  075
   {  0x040e,  "Hungarian"},                        //  076
   {  0x040f,  "Icelandic"},                        //  077
   {  0x0421,  "Indonesian"},                       //  078
   {  0x0410,  "Italian (Standard)"},               //  079
   {  0x0810,  "Italian (Switzerland)"},            //  080
   {  0x0411,  "Japanese"},                         //  081
   {  0x044b,  "Kannada (Unicode only)"},           //  082
   {  0x0457,  "Konkani (Unicode only)"},           //  083
   {  0x0412,  "Korean"},                           //  084
   {  0x0812,  "Korean (Johab)"},                   //  085
   {  0x0440,  "Kyrgyz"},                           //  086
   {  0x0426,  "Latvian"},                          //  087
   {  0x0427,  "Lithuanian"},                       //  088
   {  0x0827,  "Lithuanian (Classic)"},             //  089
   {  0x042f,  "FYRO Macedonian"},                  //  090
   {  0x043e,  "Malay (Malaysian)"},                //  091
   {  0x083e,  "Malay (Brunei Darussalam)"},        //  092
   {  0x044e,  "Marathi (Unicode only)"},           //  093
   {  0x0450,  "Mongolian"},                        //  094
   {  0x0414,  "Norwegian (Bokmal)"},               //  095
   {  0x0814,  "Norwegian (Nynorsk)"},              //  096
   {  0x0415,  "Polish"},                           //  097
   {  0x0416,  "Portuguese (Brazil)"},              //  098
   {  0x0816,  "Portuguese (Portugal)"},            //  099
   {  0x0446,  "Punjabi (Unicode only)"},           //  100
   {  0x0418,  "Romanian"},                         //  101
   {  0x0419,  "Russian"},                          //  102
   {  0x044f,  "Sanskrit (Unicode only)"},          //  103
   {  0x0c1a,  "Serbian (Cyrillic)"},               //  104
   {  0x081a,  "Serbian (Latin)"},                  //  105
   {  0x041b,  "Slovak"},                           //  106
   {  0x0424,  "Slovenian"},                        //  107
   {  0x040a,  "Spanish (Spain, Traditional Sort)"},//  108
   {  0x080a,  "Spanish (Mexican)"},                //  109
   {  0x0c0a,  "Spanish (Spain, Modern Sort)"},     //  110
   {  0x100a,  "Spanish (Guatemala)"},              //  111
   {  0x140a,  "Spanish (Costa Rica)"},             //  112
   {  0x180a,  "Spanish (Panama)"},                 //  113
   {  0x1c0a,  "Spanish (Dominican Republic)"},     //  114
   {  0x200a,  "Spanish (Venezuela)"},              //  115
   {  0x240a,  "Spanish (Colombia)"},               //  116
   {  0x280a,  "Spanish (Peru)"},                   //  117
   {  0x2c0a,  "Spanish (Argentina)"},              //  118
   {  0x300a,  "Spanish (Ecuador)"},                //  119
   {  0x340a,  "Spanish (Chile)"},                  //  120
   {  0x380a,  "Spanish (Uruguay)"},                //  121
   {  0x3c0a,  "Spanish (Paraguay)"},               //  122
   {  0x400a,  "Spanish (Bolivia)"},                //  123
   {  0x440a,  "Spanish (El Salvador)"},            //  124
   {  0x480a,  "Spanish (Honduras)"},               //  125
   {  0x4c0a,  "Spanish (Nicaragua)"},              //  126
   {  0x500a,  "Spanish (Puerto Rico)"},            //  127
   {  0x0430,  "Sutu"},                             //  128
   {  0x0441,  "Swahili (Kenya)"},                  //  129
   {  0x041d,  "Swedish"},                          //  130
   {  0x081d,  "Swedish (Finland)"},                //  131
   {  0x045a,  "Syriac (Unicode only)"},            //  132
   {  0x0449,  "Tamil (Unicode only)"},             //  133
   {  0x0444,  "Tatar (Tatarstan)"},                //  134
   {  0x044a,  "Telugu (Unicode only)"},            //  135
   {  0x041e,  "Thai"},                             //  136
   {  0x041f,  "Turkish"},                          //  137
   {  0x0422,  "Ukrainian"},                        //  138
   {  0x0420,  "Urdu (Pakistan)"},                  //  139
   {  0x0820,  "Urdu (India)"},                     //  140
   {  0x0443,  "Uzbek (Latin)"},                    //  141
   {  0x0843,  "Uzbek (Cyrillic)"},                 //  142
   {  0x042a,  "Vietnamese"} };                     //  143
#define _TotalLanguageCount_ 143    //----------------------------------------------------------------------------//
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
}
//----------------------------------------------------------------------------//    void __fastcall TForm1::Button1Click(TObject *Sender)
{
  UINT cnt;
  HKL FAR *lpKL;
  HKL hKL;
  char szImeName[30];
  char szImeDesr[80];      cnt = GetKeyboardLayoutList(0, NULL);
  if (!cnt)  return;      lpKL = (HKL FAR *)LocalAlloc(LPTR, sizeof(HKL) * cnt);
  if (!lpKL) return;      cnt = GetKeyboardLayoutList(cnt, lpKL);
  if (!cnt) return;      for(UINT ii=0;iiItems->AddObject(String(ii) " " IntToHex(int(hKL),8) " "
                    String(szImeDesr),(TObject *)(hKL));
  }      LocalFree(lpKL);
}
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------////----------------------------------------------------------------------------////----------------------------------------------------------------------------//
void __fastcall TForm1::ListBox1Click(TObject *Sender)
{
  if(ListBox1->ItemIndex>=0)
  {
    if(ListBox1->Items->Objects[ListBox1->ItemIndex]!=NULL)
    {
      HKL hKL=(HKL)ListBox1->Items->Objects[ListBox1->ItemIndex];
      ActivateKeyboardLayout(hKL, 0);
    }
  }
}
//----------------------------------------------------------------------------//
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
  char szImeName[30];
  char szImeDesr[80];
  HKL hKL=GetKeyboardLayout(0);
  ImmGetIMEFileName(hKL, szImeName, sizeof(szImeName));
  ImmGetDescription(hKL, szImeDesr, sizeof(szImeDesr));      if(StrLen(szImeName)==0)
  {
      szImeDesr[0]='\0';
      unsigned short usID=int(hKL)&0xFFFF;
      for(int i=0;i<_TotalLanguageCount_;i  )
      {
        if(lidList[i].ID==usID)
        {
          strcpy(szImeDesr,lidList[i].Language);
          break;
        }
      }
  }      Panel2->Caption="CurrentIME: " IntToHex(int(hKL),8) " " String(szImeDesr);
}
//----------------------------------------------------------------------------//
void __fastcall TForm1::ButtonPreClick(TObject *Sender)
{
  ActivateKeyboardLayout((HKL)HKL_PREV, 0);
}
//----------------------------------------------------------------------------//    void __fastcall TForm1::ButtonNextClick(TObject *Sender)
{
  ActivateKeyboardLayout((HKL)HKL_NEXT, 0);
}
//----------------------------------------------------------------------------//
沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
附加檔案:37920_IMETester.zip
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-09-25 07:57:10 IP:61.224.xxx.xxx 未訂閱
對不起,目前的版本只能控制自已,不能控制或監視別的 Apps  請期待可以控制別的 > <>沒空更新的網頁... href="http://dllee.adsldns.org">http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-09-26 14:56:12 IP:61.231.xxx.xxx 未訂閱
已完成可以切換別的程式的輸入法了 < > 真是太高興了 < > 害我三天沒睡好 在 > <>沒空更新的網頁... href="http://dllee.adsldns.org">http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
領航天使
站長


發表:12216
回覆:4186
積分:4084
註冊:2001-07-25

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-09-26 16:17:17 IP:192.168.xxx.xxx 未訂閱
引言: 已完成可以切換別的程式的輸入法了 < > 真是太高興了 < > 害我三天沒睡好 在 > <>沒空更新的網頁... href="http://dllee.adsldns.org">http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....
恭喜恭喜 分享您的喜悅 ~~~Delphi K.Top討論區站長~~~
------
~~~Delphi K.Top討論區站長~~~
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-09-27 09:30:43 IP:61.224.xxx.xxx 未訂閱
引言: 恭喜恭喜 分享您的喜悅 ~~~Delphi K.Top討論區站長~~~
謝謝 其實應該早點向天使大人討教,或許就不會在 > <>沒空更新的網頁... href="http://dllee.adsldns.org">http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
yatim
一般會員


發表:0
回覆:1
積分:0
註冊:2007-11-07

發送簡訊給我
#6 引用回覆 回覆 發表時間:2008-03-28 14:45:30 IP:60.248.xxx.xxx 訂閱
大大您好:
您提到可以切換別的程式的輸入法了,不知方法為何,
可否提示一下,我在原文內看了一下,只看到切換自己視窗的程式

===================引 用 dllee 文 章===================
已完成可以切換別的程式的輸入法了
真是太高興了
害我三天沒睡好 在 MSDN 上亂逛...
今天可要好好睡一覺

沒空更新的網頁...
http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....
conly_li
一般會員


發表:1
回覆:6
積分:1
註冊:2008-03-28

發送簡訊給我
#7 引用回覆 回覆 發表時間:2008-03-28 22:54:07 IP:222.72.xxx.xxx 訂閱
大哥在上,小妹有礼了。
初来乍到,已收下代码学习中....
以后要多指教啊!呵呵,先谢谢啦!
------
我相信人与人之间一定有感应,有缘人一定能相遇,相识,相知!
系統時間:2024-11-22 20:04:48
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!