易截截图软件、单文件、免安装、纯绿色、仅160KB

delphi 动态控制窗口置顶且界面不闪

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE)
else
SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE);
end;//使用Self.FormStyle := fsStayOnTop;会使界面闪烁一下

为什么使用FormStyle会出现界面闪烁呢?跟踪了一下代码,我觉得TWinControl.UpdateShowing有很大嫌疑……
关于SetWindowPos的使用可从 delphi 提供的帮助得知。
The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen.
BOOL SetWindowPos(
    HWND hWnd, // handle of window
    HWND hWndInsertAfter, // placement-order handle
    int X, // horizontal position
    int Y, // vertical position
    int cx, // width
    int cy, // height
    UINT uFlags  // window-positioning flags
   );
HWND_NOTOPMOST Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOPMOST Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
SWP_NOMOVE Retains the current position (ignores the X and Y parameters).
SWP_NOSIZE Retains the current size (ignores the cx and cy parameters).


相关文档:

delphi 多态

 什么是多态,字面意思就是“多种形态”,用对象来讲就是子类继承基类,而不同的子类又分别对基类进行功能的扩展。
多态在Object Pascal中是通过虚方法实现的(Virtual Method),在Object Pascal中基类的虚方法是可以被派生类覆盖(Override)的 ......

delphi获得网卡的MAC地址


 
获得网卡的MAC地址在很多地方都有很大的用处,下面的函数以XX-XX-XX-XX-XX-XX 的格式返回远程或本地机器的MAC地址。
Function to return the MAC address of a remote or local machine in the format XX-XX-XX-XX-XX-XX
返回的MAC地址是一个能用在多个方面的唯一标识。使用方法:
ShowMessage(GetMacAddress( ......

delphi中的几个符号@、^、$

 
@符号返回一个变量的地址  
例:  
var  
      f:string;  
      p:^string;   //声明一个字符串类型的指针
begin  
      f   ='demo';  ......

Delphi Shl与Shr 移位操作介绍

 格式:操作数 Shl/Shr 移动位数
说明:操作数与返回值都是整数
例子:16(10) = 10000(2)
     16(10) Shr 1 = 10000(2) Shr 1 = 1000(2) = 8(10)
     16(10) Shr 2 = 10000(2) Shr 2 = 100(2) = 4(10)
说明:一个整数(I)按位左移一位,相当于把它乘以2,即 I * 2
&n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号