代码之家  ›  专栏  ›  技术社区  ›  Nikola Yovchev

如何使用JNA创建Microsoft Windows子窗口

  •  0
  • Nikola Yovchev  · 技术社区  · 14 年前

    这是我的声明 创建WindowsExa :

    public int CreateWindowExA(int i, String string, String string0, int i0, int i1, int i2, int i3, int i4, int ninja, Object object, Object object0, int i5);
    

    我这样称呼它:

    int childLabel = user32.CreateWindowExA
    (
       0, //sets style to default
       "STATIC", //window style is label
       "Show Message", //label text is show Message
       1342177280, // WS_CHILD + WS_VISIBLE  = &H40000000 + &H10000000
       10,         //x
       90,         //y
       100,        //width
       0,          //height 
       parentWindowHandler,   //a valid handler to a window (has been tested and is valid)
       null,    // a handler to a menu             
       null,  //A handle to the instance of the module to be associated with the window. (NO IDEA)
       0      //arguments list (no idea)
    );
    

    有效处理程序 但它是看不见的。调用getLastError和随后调用TranslateMessage给我 “功能已成功完成” . 另外,如果我调用GetAncestor(childButton,3),我会将句柄返回到parentWindowHandler。 显示消息 很明显,我已经创建了parentWindow的子窗口,它就在那里。但是,它不可见。接下来要记住的是,我的窗口/标签位于其父级的z索引的底部,因此必须进行一些其他调用,我打算这样做。但如果我走错了方向,我会浪费一点时间。

    我如何让这个孩子看得见,或者我做错了什么。 你应该注意,我不会在回拨或发送任何消息时调用它。

    有什么线索吗?

    1 回复  |  直到 14 年前
        1
  •  0
  •   Nikola Yovchev    14 年前

    是的,这正是我的想法,但有点不同。需要将WM_PAINT消息发送到父窗口以使其刷新。