高手请进!!!100分(100分)

  • 主题发起人 主题发起人 michael.xiang
  • 开始时间 开始时间
M

michael.xiang

Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位大虾,我要用delphi编程实现控制面板中区域语言的设置,该怎么做啊。急!!<br>哪里有代码?不胜感激!!
 
引用Shell.pas.<br>使用winexec('...pls.'....函数就可以了。<br>但是我忘记了区域的动态库了。是什么..pls了。你查找一下。
 
Winexec('rundll32.exe shell32.dll,Control_RunDLL Intl.cpl',9);
 
请问myid0602,这是把区域语言设置为哪种语言啊,我要做一个切换,中文和英文的
 
myid0602,你的语句我试过了,但这只是弹出个区域选项,我的意思是说点击一下按扭直接切换到英文,再点击一下切换到中文。
 
Winexec('rundll32.exe shell32.dll,Control_RunDLL Intl.cpl',9);
 
是不是切换输入法啊?<br>下面是切换到智能全拼的。<br>unit Unit1;<br><br>interface<br><br>uses<br> &nbsp;Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> &nbsp;Dialogs, StdCtrls;<br><br>type<br> &nbsp;TForm1 = class(TForm)<br> &nbsp; &nbsp;Edit1: TEdit;<br> &nbsp; &nbsp;Edit2: TEdit;<br> &nbsp; &nbsp;procedure Edit1Enter(Sender: TObject);<br> &nbsp;private<br> &nbsp; &nbsp;{ Private declarations }<br> &nbsp;public<br> &nbsp; &nbsp;{ Public declarations }<br> &nbsp;end;<br><br>var<br> &nbsp;Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Edit1Enter(Sender: TObject);<br>const<br> &nbsp;KbLayoutRegSubkey = 'layout text'; // do not localize<br>var<br>KbList: array[0..63] of HKL;<br>TotalKbLayout,i,Bufsize: Integer;<br>ImeFileName: array [0..1024] of Char;<br>filename:string;<br>myhkl: hkl;<br>j: &nbsp; &nbsp; integer;<br>subkey: array[0..2048] of char;<br>qKey: HKey;<br>begin<br>TotalKbLayout := GetKeyboardLayoutList(64, KbList);<br>for I := 0 to TotalKbLayout - 1 do<br>begin<br> &nbsp; &nbsp;if Imm32IsIME(KbList) then<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp;strpcopy(subkey,'System/CurrentControlSet/Control/Keyboard Layouts/'+inttohex(KbList,8));<br> &nbsp; &nbsp; &nbsp; &nbsp;if RegOpenKeyEx(HKEY_LOCAL_MACHINE,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;subkey, 0, KEY_READ,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;qKey) = ERROR_SUCCESS then<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bufsize := 1024;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if RegQueryValueEx(qKey, KbLayoutRegSubKey, nil, nil,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @ImeFileName, @Bufsize) = ERROR_SUCCESS then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;filename:=ImeFileName;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;j:= pos('智能',filename);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if j &gt;= 0 then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;myhkl:= hkl(KbList);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;activatekeyboardlayout(myhkl,KLF_ACTIVATE);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp;RegCloseKey(qKey);<br> &nbsp; &nbsp; &nbsp;end;<br>end;<br>end;<br><br><br>end.
 
WinExec只能启动界面而已,对界面的操纵可以用模拟键盘操作来完成。<br><br>请参考:<br> &nbsp;Delphi中的SendKeys函数<br> &nbsp;http://www.pcdog.com/p/html/20041019/191020043731_1.htm
 
谢谢各位拉!!!
 
后退
顶部