{-------------------------------------------------------------------------------
  过程名:  TabCtrlSetItemIndex
  作  者:  cjsh(wjh_wy@163.com)
  日  期:  2004-2-4
  功  能:  选择外部程序中指定的选项页
  参  数:  aTitle: String; i: Integer
-------------------------------------------------------------------------------}
procedure TabCtrlSetItemIndex(aTitle: String; i: Integer);
var
  hWindowsHandle, hTabHandle: Integer;
begin
  hWindowsHandle := FindWindow(Nil, PChar(aTitle));
  if hWindowsHandle = 0 then Exit;
  hTabHandle := FindWindowEx(hWindowsHandle, 0,
    'SysTabControl32', Nil);
  if hTabHandle = 0 then Exit;
  SendMessage(hTabHandle, TCM_SETCURFOCUS, i, 0);
end;

//测试如下代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
  {打开控件面板程序中的“鼠标 属性”到“移动”属性页}
  WinExec('RunDLL32.exe Shell32.dll,Control_RunDLL Main.cpl', SW_SHOWNORMAL);
  TabCtrlSetItemIndex('鼠标 属性', 2);
 {打开控件面板程序中的“键盘 属性”到“输入法区域设置”属性页}
  WinExec('RunDLL32.exe Shell32.dll,Control_RunDLL Main.cpl @1', SW_SHOWNORMAL);
  TabCtrlSetItemIndex('键盘 属性', 1);
end;

版权所有 2004 cjsh 保留所有权利。我的邮箱:wjh_wy@163.com

相关文章:

  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
相关资源
相似解决方案