GetProp(Handle, MakeIntAtom(ControlAtom));
请问各位前辈这个函数的原理是什么呢?
MakeIntAtom这个函数是作什么用的?
谢谢!

解决方案 »

  1.   


    The GetProp function retrieves a data handle from the property list of the given window. The given character string identifies the handle to be retrieved. The string and handle must have been added to the property list by a previous call to the SetProp function. HANDLE GetProp(    HWND hWnd, // handle of window
        LPCTSTR lpString  // atom or address of string
       );
     ParametershWndIdentifies the window whose property list is to be searched. lpStringPoints to a null-terminated character string or contains an atom that identifies a string. If this parameter is an atom, it must have been created by using the GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of the lpString parameter; the high-order word must be zero.  Return ValuesIf the property list contains the given string, the return value is the associated data handle. Otherwise, the return value is NULL.
      

  2.   

     MakeIntAtom这个貌似没有吧,是自己写的函数吧。
      

  3.   

      查了一下,原来有MAKEINTATOM,是个宏。尴尬。不知道。
      

  4.   

    MakeIntAtom不是函数,是数据类型,D2009以下,是PAnsiChar,以上(包含D2009)则是PWideCharGetProp作用是查询窗口的属性列表或清单,在前一个帖子已说明了在VCL中的用途
      

  5.   

    GetProp  函数功能:该函数从给定窗口的属性列表中检索数据句柄。给定的字符串标识了要检索的句柄。该字符串和句柄必须在前一次调用SetProp函数时已经加到属性表中。   函数原型:HANDLE GetProp(HWND hWnd,LPCTSTR lpString);   参数:   hWnd:指向要搜索属性表的窗口。   LpString:指向以null结尾的字符串指针,或者包含一个标识字符串的原子。如果该参数是一个原子,那么它必须是使用GlobalAddAtom函数创建的。原子是16位的数据值,它必须是放置在lpstring参数的低位率中,而高位字必须为O。   返回值:如果属性表中包含了给定的字符串,那么返回值为相关的数据句柄。否则,返回值为NULL。   速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:不支持:头文件:winuser.h;库文件:user32。lib;Unicode:在Windows NT环境中以Unicode和ANSI版本实现。
      

  6.   

    终于搞明白了,其实GetProp就是返回一个数据结构。这个数据结构随便不同的控件有所不同。
    其实所谓控件的实例也就是一存在和有数据的数据结构。可以通过EnumPropsEx来查询到这一数据结构。
    也可以通过GetProp和原子来查找这一数据结构。不过有一点不明白就是EnumPropsEx函数,我在百度上面看到的描述是这样的
    函数功能:该函数将窗口属性表中的所有项列举出来,依次传送给指定的回调函数,直到列举到最后一项,或者回调函数返回FALSE为止。
    下面代码的nProp值为3,那么就是说这个窗口属性表有三个项,这个项指的是什么呢?
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      function WinPropProc(hSubClass:HWND;lpszString:LPSTR;hData:THandle):Bool;stdcall;
    implementation{$R *.dfm}function WinPropProc(hSubClass:HWND;lpszString:LPSTR;hData:THandle):Bool;stdcall;
    {$j+}
    const
        nProp:Integer=1;
    {$j-}
    var
        sAtom:TAtom;
        dData:TButton;
    begin
        sAtom:=GlobalFindAtom(lpszString);
        if sAtom<>0 then begin
            dData:=TButton(GetProp(hSubClass,lpszString));
            ShowMessage(dData.Caption);
        end;
        nProp:=nProp+1;
        result:=True;
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
        EnumPropsEx(Button2.Handle, @WinPropProc, 0);
    end;end.
      

  7.   

    你是想知道数据结构吗?
    http://hi.csdn.net/space-24500-do-album-picid-491634.html