关于获取实例句柄h和窗口句柄的若干方法

Posted on 2008-02-18 17:55  少林  阅读(7195)  评论(1编辑  收藏

1.根据id获取窗口句柄
  Hwnd hwnd = GetDlgItem(hwndParent,id).
2.根据窗口句柄,获取id
    id = GetWindowLong(hwndChild,GWL_ID)
    id = GetDlgCtrlID(hwndchild).
3.获取实例句柄的若干方法
    hInst = GetWindowLong(hwnd,GWL_HINSTANCE)
    把HINSTANCE 作为全局变量保存.
    当建立窗口时,参数lparam指向了一个建立结构的地址.
    可以这样获取实例句柄
    hInst = ((LPCREATESTRUCT)lParam)->hInstance.

posts - 70, comments - 306, trackbacks - 0, articles - 4

Copyright © 2020 少林
Powered by .NET 5.0.0 on Kubernetes