想不想get新技能酷炫一下,今天图老师小编就跟大家分享个简单的一个设置任意窗口透明度的命令行Delphi程序教程,一起来看看吧!超容易上手~
【 tulaoshi.com - 编程语言 】
必须是在Windows2000以下的系统才支持SetLayeredWindowAttributes这个API,原理就是先找到窗口句柄,然后设置窗口属性
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)program opacity;
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/){$APPTYPE CONSOLE}
  uses
    SysUtils,
    Windows;
  var
  handle,AStyle:integer;
  begin
    try
      if ParamCount2 then
      begin
        Writeln('parameter must');
        exit;
      end;
      handle:=findwindow(nil,pchar(ParamStr(1)));//目前是找窗口的Text,也可以是找ClassName
      AStyle := GetWindowLong(Handle, GWL_EXSTYLE);
      SetWindowLong(Handle, GWL_EXSTYLE, AStyle or WS_EX_LAYERED);
      if SetLayeredWindowAttributes(Handle, 0, strtoint(ParamStr(2)),LWA_ALPHA) then
          Writeln(ParamStr(1)+' update successed to '+ParamStr(2))
        else
          Writeln('Opacity update failed');
      except
        Writeln('parameter error');
      end;
  end. 
  http://blog.csdn.net/redbirdli/archive/2007/02/15/1510602.aspx
来源:http://www.tulaoshi.com/n/20160219/1626263.html
看过《一个设置任意窗口透明度的命令行Delphi程序》的人还看了以下文章 更多>>