看Delphi自带的window sdk帮助呀,这没什么好学的。

解决方案 »

  1.   

    例子,使用API很简单,但要掌握方法和技巧,要学会举一反三
    临时路径 
    有时需要Windows的临时路径来做备份等工作,那么就要知道路径在哪,下面的程序
    var aa:pchar;
    begin
    GetTempPath(20,aa); //返回路径名
    edit1.text:=aa;
    end;
      

  2.   

    还是看看<<windows程序设计>>
      

  3.   

    多看看Delphi自带的帮助,一切问题都会变得更易。
    yxg20803(爱好和平的大灰狼) 就是一个简单的例程。
    var aa:pchar;
    begin
    GetTempPath(20,aa); //返回路径名
    edit1.text:=aa;
    end;
      

  4.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      T : TRect;
    begin
      PostMessage(Edit1.Handle, WM_KEYDOWN, 72, 0);//模拟edit按下了a键
      T := Edit2.BoundsRect;
      MapWindowPoints(Handle,0,T,2);
      ClipCursor(@T);
    end;
    ---------------嘻嘻,为xgto灌灌水----------俺不要你的分,嘻嘻-------
    -------------这段时间不见你了啊,俺的API也不太好,还要学一学,学好了,嘻嘻俺教你---------------------
      

  5.   

    API你会在无形中使用的
    当然最好你有一些API函数的用法表和实例表
    help就很不错的!
      

  6.   

    findWindow,
    delphi中可以直接调用api,
    如果你想学api,不要看delphi的书,要看windows编程的书。
      

  7.   

    到http://delphi.mychangshu.com上有关于delphi中api的用法,比我们一个一个给你讲强多了!
      

  8.   

    winexec(Pchar('ABCD'),sw_Show); 
      
      其中"ABCD"代表以下命令之一:
      
      "rundll32 shell32,Control_RunDLL" - 运行控制面板
      
      "rundll32 shell32,OpenAs_RunDLL" - 打开"打开方式"窗口
      
      "rundll32 shell32,ShellAboutA Info-Box" - 打开"关于"窗口
      
      "rundll32 shell32,Control_RunDLL desk.cpl" - 打开"显示属性"窗口
      
      "rundll32 user,cascadechildwindows" - 层叠全部窗口
      
      "rundll32 user,tilechildwindows" - 最小化所有的子窗口
      
      "rundll32 user,repaintscreen" - 刷新桌面
      
      "rundll32 shell,shellexecute Explorer" - 重新运行Windows Explorer 
      
      "rundll32 keyboard,disable" - 锁写键盘
      
      "rundll32 mouse,disable" - 让鼠标失效
      
      "rundll32 user,swapmousebutton" - 交换鼠标按钮
      
      "rundll32 user,setcursorpos" - 设置鼠标位置为(0,0)
      
      "rundll32 user,wnetconnectdialog" - 打开"映射网络驱动器"窗口
      
      "rundll32 user,wnetdisconnectdialog" - 打开"断开网络驱动器"窗口
      
      "rundll32 user,disableoemlayer" - 显示BSOD窗口, (BSOD) = Blue Screen Of Death, 即蓝屏
      
      "rundll32 diskcopy,DiskCopyRunDll" - 打开磁盘复制窗口
      
      "rundll32 rnaui.dll,RnaWizard" - 运行"Internet连接向导", 如果加上参数"/1"则为silent模式
      
      "rundll32 shell32,SHFormatDrive" - 打开"格式化磁盘(A)"窗口
      
      "rundll32 shell32,SHExitWindowsEx -1" - 冷启动Windows Explorer 
      
      "rundll32 shell32,SHExitWindowsEx 1" - 关机
      
      "rundll32 shell32,SHExitWindowsEx 0" - 退当前用户
      
      "rundll32 shell32,SHExitWindowsEx 2" Windows9x 快速重启
      
      "rundll32 krnl386.exe,exitkernel" - 强行退出Windows 9x(无确认) 
      
      "rundll rnaui.dll,RnaDial "MyConnect" - 运行"网络连接"对话框
      
      "rundll32 msprint2.dll,RUNDLL_PrintTestPage" - 选择打印机和打印测试页
      
      "rundll32 user,setcaretblinktime" - 设置光标闪烁速度
      
      "rundll32 user, setdoubleclicktime" - 测试鼠标双击速度
      
      "rundll32 sysdm.cpl,InstallDevice_Rundll" - 搜索非PnP设备
      

  9.   

    ------------嘻嘻,俺再给你一点现成的,嘻嘻---------------------
    procedure TForm1.Button1Click(Sender: TObject);
    var
       Res: Cardinal;  // WinExe的返回结果
    begin
         // 显示控制面板
         Res:=WinExec('rundll32.exe shell32.dll,Control_RunDLL',9);
         if Res=0 then
            MessageBox(Handle,'程序超出内存。','错误',MB_OK+MB_ICONERROR)
         else if Res=ERROR_BAD_FORMAT then
            MessageBox(Handle,'命令错误。','错误',MB_OK+MB_ICONERROR)
         else if Res=ERROR_FILE_NOT_FOUND then
            MessageBox(Handle,'指定文件没找到。','错误',MB_OK+MB_ICONERROR)
         else if Res=ERROR_PATH_NOT_FOUND then
            MessageBox(Handle,'指定路径没找到。','错误',MB_OK+MB_ICONERROR);
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
         // 辅助选项 | 键盘
         WinExec('rundll32.exe shell32.dll,Control_RunDLL access.cpl,,1',9);
    end;procedure TForm1.Button3Click(Sender: TObject);
    begin
         // 添加/删除程序 属性 | 安装/卸载
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Appwiz.cpl,,1',9);
    end;procedure TForm1.Button4Click(Sender: TObject);
    begin
         // 显示 属性 | 背景
         WinExec('rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0',9);
    end;procedure TForm1.Button5Click(Sender: TObject);
    begin
         // Internet 属性 | 常规
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Inetcpl.cpl,,0',9);
    end;procedure TForm1.Button6Click(Sender: TObject);
    begin
         // 区域设置 属性 | 区域设置
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Intl.cpl,,0',9);
    end;procedure TForm1.Button7Click(Sender: TObject);
    begin
         // 游戏控制器 | 一般
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Joy.cpl,,0',9);
    end;procedure TForm1.Button8Click(Sender: TObject);
    begin
         // 鼠标 属性 | 按钮
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Main.cpl',9);
    end;procedure TForm1.Button9Click(Sender: TObject);
    begin
         // 多媒体 属性 | 音频
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Mmsys.cpl,,0',9);
    end;procedure TForm1.Button10Click(Sender: TObject);
    begin
         // 调制解调器 属性
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Modem.cpl',9);
    end;procedure TForm1.Button11Click(Sender: TObject);
    begin
         // 网络 | 配置
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Netcpl.cpl',9);
    end;procedure TForm1.Button12Click(Sender: TObject);
    begin
         // 密码 属性 | 更改密码
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Password.cpl',9);
    end;procedure TForm1.Button13Click(Sender: TObject);
    begin
         // 扫描仪与数字相机 属性 | 设备
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Sticpl.cpl',9);
    end;procedure TForm1.Button14Click(Sender: TObject);
    begin
         // 系统 属性 | 常规
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Sysdm.cpl,,0',9);
    end;procedure TForm1.Button15Click(Sender: TObject);
    begin
         // 日期/时间 属性 | 日期和时间
         WinExec('rundll32.exe shell32.dll,Control_RunDLL timedate.cpl',9);
    end;procedure TForm1.Button16Click(Sender: TObject);
    begin
         // 电源管理 属性 | 电源方案
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Powercfg.cpl',9);
    end;procedure TForm1.Button17Click(Sender: TObject);
    begin
         // 拨号 属性 | 我的位置
         WinExec('rundll32.exe shell32.dll,Control_RunDLL Telephon.cpl',9);
    end;end.
      

  10.   

    嘻嘻---------------灌水啦--------不要分的,嘻嘻
    procedure TForm1.FormCreate(Sender: TObject);
    var
      tmp:integer;
      flag:integer;
    begin
      tmp:= 0;
    Flag:= 1;
    //屏蔽 Alt-Tab
    SystemParametersInfo( SPI_SETFASTTASKSWITCH, Flag, @tmp, 0);
    //屏蔽 Ctrl-Alt-Del
    SystemParametersInfo( SPI_SCREENSAVERRUNNING,Flag, @tmp, 0);
    end;
    //当你要恢复功能键时用以下代码:
    //Flag := 0;
    //SystemParametersInfo(SPI_SCREENSAVERRU-NNING,Flag,@temp,0);
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
      hidetaskbar;
    end;
    procedure Tform1.hideTaskbar;
    //隐藏
    var wndHandle : THandle;
    wndClass : array[0..50] of Char;
    begin
    StrPCopy(@wndClass[0], 'Shell_TrayWnd');
    wndHandle := FindWindow(@wndClass[0], nil);
    ShowWindow(wndHandle, SW_HIDE);
    End;
    procedure showTaskbar;
    var wndHandle : THandle;
    wndClass : array[0..50] of Char;
    begin
    StrPCopy(@wndClass[0], 'Shell_TrayWnd');
    wndHandle := FindWindow(@wndClass[0], nil);
    ShowWindow(wndHandle, SW_RESTORE);
    end;
      

  11.   

    看些书,主要看怎么引用api,然后看看windonws 程序设计,手头有一份msdn,还有一定要会一点c什么的
      

  12.   

    在Delphi的帮助文件中,有一个目录是Win32 SDK,里面就是Borland“翻译”的Win32API了(当然,内容还不只这些)。你可以去里面看一下,一开始先查一些好用一些的API,比如FindWindowEx什么的。有一份叫Core Win32 API的帮助文档是不错的,里面把部分Win32 API翻译成了Object Pascal,对我们Delphi程序员的帮助是大大的。你可以去下载一下,如果没有我可以给你。我的信箱是[email protected]。学习Win32 API最好的资料其实就是MSDN。当然,前提是你要懂一点C/C++。你会发现MSDN里面的东西实在是太丰富了,光靠Borland那一点点资料我们几乎不可能接触到系统的底层(当然,微软也不会让你接触到最核心的那部分的)。
      

  13.   

    Application Programming Interface 应用编程接口闭眼一想,定会有: 处理文件的API、处理驱动器的API、处理管道通讯的API、处理图形图象的API、处理多媒体的API、控制键盘的API、控制鼠标的API.........网上搜索“WINAPI.TXT”,下载来看看
    看来API的数量真是庞大,要掌握可要花不少时间
    在实际工作中慢慢积累、安装一个MSDN很有用处
    另外,参考VCL的源代码也是一个学习API很好的手段
    即使我现在是用VC++编程,也可以从VCL中学习到API的使用方法(*//
    //From <<Kingron猛料>>
    授人以鱼,不如授人以渔,教你一个方法:
    当你有一个API不知道在那个单元的时候,可以使用查找法:把这个API的函数名复制下来,然后用查找文件的方法,查找包含这个API名字的*.pas文件,如果Delphi声明了的话,肯定在某个pas文件中,否则的话,就是没有声明了,必须自己声明这个API。
    //*)
      

  14.   

    <<Kingron猛料>>
    所说的方法,扩充到在网上搜索更管用,还搜出很多例子
      

  15.   

    有意思,不知道你要学到什么程度?
    如果要学会很大一部分,那么去看Windows驱动程序开发的书;(保证是极好的爬虫杀手)
    如果要学会一部分,那么去写Windows的控件、组件。(“消息”会让你晕头转向);
    如果要一点就可以了,那么看一下《Windows程序设计》就够用了。
      

  16.   

    老师,你也来了啊;
    TO TommyTong(童童) 我的信用分太低了啊,这个贴子对每个人都有好处的嘛,加进精化贴里不可以吗?
      

  17.   

    TO TommyTong(童童) 你说的那本书在那儿找啊?
      

  18.   

    shellExecute(handle,'open','c:\aa\aa.exe',nil,nil,sw_show);hehe…………
      

  19.   

    呵呵!
    老这么用功会坏眼的!
      所以:     ExitWindowsEx(1,0);//关机睡觉!
      

  20.   

    var
      comp : array[0..250] of char
    begin
      GetComputerName( comp,251);
    end;
    得到当前计算机名
      

  21.   

    在Form的成员函数中:
    SetWindowRgn(Handle,CreateEllipticRgn(0,0,Width,Height));
    创建一个椭圆形窗体.
      

  22.   

    呵呵,你问问有个"超级猛料"的king......
      

  23.   

    其实大家说了那么多对一个初学者来说有点怎么说呢?太牵强了吧。想学"API"?不明白。写程序都是一步一步来的。自己多想一些题目做一做,或在CSDN看到有不错的题目自己Test一下,里面直接使用API函数的很多的。只要你对编程很感兴趣,而且不是太笨你就一定可以学到很多东西,当然包括你所说的"API"了。古人说"温故而知新",很有道理的。我觉得对我们编程的人来说,"温故"并不是简单的去看一前写过的程序,而是边看边改,这样不知不觉中就增长了你的编程水平。一个"API"就能体现一个人的编程水平吗?并不绝对。踏踏实实的学才是最重要的。
      

  24.   

    看微软的MSDN,不过不是针对Delphi的,这不太重要的吧。
      

  25.   

    procedure TForm1.Button1Click(Sender: TObject);
    Var
      Yx:TNotifyIconData;
      dd:Ticon;
    begin
      dd:=Ticon.Create;
      dd.LoadFromFile('F:\Windows98Se\drivers\display\intel\i810\i81xcfg.ico');
      Yx.cbSize:=sizeof(yx);
      //yx.Wnd:=handle;
      //yx.uID:=2;
      yx.uFlags:=NIF_ICON;
      yx.hIcon:=dd.Handle;
      Shell_NotifyIcon(NIM_ADD,@Yx); 在系统托盘中加入图标!
      //Shell_NotifyIcon(NIM_delete,@Yx);
    end;procedure TForm1.Button2Click(Sender: TObject);
    Var
      dd:Ticon;
    begin
      dd:=Ticon.Create;
      dd.LoadFromFile('F:\Windows98Se\drivers\display\intel\i810\i81xcfg.ico');
      ShellAbout(handle,'ss','ddd',dd.handle); 可能是版本信息!!
    end;window_shell的API
      

  26.   

    说穿了,api函数和一般概念上的函数是一样的。只不过这些函数是直接和操作系统相关的,由系统的一些dll提供
      

  27.   

    去下一个coreapi,里面有超过200个api的delphi例程.
      

  28.   

    去http://202.103.176.81/erun/sealife/ 
    下个API的详细的中文说明。
    不过那声明是VB的。
      

  29.   

    To:robinhunter(深空)
    请问coreapi哪儿可以下的.
    我在Torry's找不到。
      

  30.   

    我有详细的API介绍和例子!
    需要的话,请留下Email