如何得到一个窗体的句柄?
如何得到一个可视控件的句柄?
窗体的句柄与可视控件的句柄有和差别与联系? 谢谢。

解决方案 »

  1.   

    EnumThreadWindows
    利用CreateProcess的返回参数lpProcessInformation.dwThreadId
    以前见到一大哥写的。你看看有没有帮助。
    The IsWindow function determines whether the specified window handle identifies an existing window. BOOL IsWindow(    HWND hWnd  // handle of window
       );
     ParametershWndSpecifies the window handle.  Return ValuesIf the window handle identifies an existing window, the return value is nonzero.
    If the window handle does not identify an existing window, the return value is zero.
      

  2.   

    form.handle;//获得窗体的句柄
    control.handle;//控件的句柄  有的控件没有几乎是一样的
      

  3.   

    窗口包括delphi中的form,button....(所有windows标准控件,也就是delphi中可视化控件)
    句柄是指向窗口对象的动态指针(因为对象在内存中会变动地址)。
    delphi中handle是一个可视化控件的属性,比如:form1.handle就可以得到。
    “窗体的句柄与可视控件的句柄的差别与联系”,正如窗口的句柄和窗口的句柄的关系,正如句柄的含义。
      

  4.   

    可视控件大多数本质上就是窗口
    label。static text等控件除外所以它们的都有handle
      

  5.   

    Twincontrol控件有句柄。句柄是unsigned 32位WORD类型的整型,它是一个指向地址的指针。有很多Api函数需要这个参数。可以看一些操作系统方面的书,不是很难。