How to obtain Handle of the window it activates (REDEFINES, MDI, WINDOW, MDICHILD, etc) of APPS, how?
Example below, opens MDI, to press F3 to add MDICHILDs, F2 should obtain Handle.
- Code: Select all Expand view
#include 'mxbase.ch' // FiveWin.ch, etc, etc
//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
function Main()
local oWin
SETKEY(VK_F2, {||WinInfo()})
SETKEY(VK_F3, {||AddWinChild()})
DEFINE WINDOW oWin TITLE 'Janela MDI' MDI
@15,10 SAY 'F2 - WinInfo()' SIZE 100,30
@18,10 SAY 'F3 - AddWinChild()' SIZE 100,30
//oWin:SetKey( VK_F2,{||ALERT('VK_F2 da janela')})
ACTIVATE WINDOW oWin ON INIT oWin:cTitle:=oWin:cTitle + ' oWin:hWnd=> ' + NTRIM(oWin:hWnd) + ' ' + GetClassName(oWin:hWnd) MAXIMIZED
return nil
//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
function AddWinChild()
static nsNumber:=0
local oWin
DEFINE WINDOW oWin TITLE 'Janela MDICHILD # ' + NTRIM(++nsNumber) MDICHILD COLOR 'N/BG'
@15,10 BUTTON 'F2 - WinInfo()' SIZE 100,30
@18,10 BUTTON 'F3 - AddWinChild()' SIZE 100,30
ACTIVATE WINDOW oWin ON INIT oWin:cTitle:=oWin:cTitle + ' oWin:hWnd=> ' + NTRIM(oWin:hWnd) + ' ' + GetClassName(oWin:hWnd)
return nil
//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
// Here, I need to know Handle of the Window activate (MDI, MDICHILD ou any)
function WinInfo()
? GetActiveWindow() // Only to illustrate
return nil
//--------------------------------------------------------------------------
//I tried other forms using
//function WinInfo()
// GetWindow()
// NEXTDLGTAB()
// GetActiveWindow()
// GetFocus()
// GetParent()
// return nil