[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Samuel L Matzen

12/6/2005 1:36:00 AM

Is there an easy way to retrieve a list of all open forms in Axpata?

I would like to place them on a docked form on either the left or right side
of the MDI form and allow the user to click the form name to activate.
Something similar to the behavior implemented in the Windows menu.

TIA,

-Sam


4 Answers

Flenciux

12/6/2005 4:44:00 AM

0

> Is there an easy way to retrieve a list of all open forms in Axpata?
>
> I would like to place them on a docked form on either the left or right side
> of the MDI form and allow the user to click the form name to activate.
> Something similar to the behavior implemented in the Windows menu.
>
> TIA,
>
> -Sam


Here is a piece of code that could help you:

static Map getWindowList(container _excludeWindow = connull())
{
HWND hWnd, hChildWnd;
HWND hSubChildWnd;
str windowname;
Map windowMap;
;
windowMap = new Map(types::String,types::Integer);

// Axapta main window
hWnd = AU_AxWindowEnum::getActiveWindow();
hChildWnd = WinApi::getWindow(hWnd, #GW_CHILD);
while( hChildWnd )
{
hSubChildWnd = hChildWnd;
// check for 'MDIClient'
if(AU_AxWindowEnum::GetClassName(hChildWnd) == "MDIClient" )
{
// get second level child windows
hSubChildWnd = CCUtil::getFirstChild(hChildWnd);
while( hSubChildWnd )
{
windowName = WinApi::getWindowText(hSubChildWnd);
if (conLen(_excludeWindow) &&
confind(_excludeWindow,windowName))
windowName = '';

if (AU_AxWindowEnum::isWindowVisible(hSubChildWnd) &&
strLTrim(strRTrim(windowName)) != '')

windowMap.insert(WinApi::getWindowText(hSubChildWnd),hSubChildWnd);
hSubChildWnd = WinApi::getWindow(hSubChildWnd,
#GW_HWNDNEXT);
}
}

// iterate througt the first level child windows
hChildWnd = WinApi::getWindow(hChildWnd, #GW_HWNDNEXT);
}
return windowMap;
}


static str getClassName(HWND _hwnd)
{
#define.MAXSTRINGSIZE(255)
DLL DLL;
DLLFunction DLLFunction;
binary buffer;
;
buffer = new Binary(#MAXSTRINGSIZE);
DLL = new DLL('User32');
DLLFunction = new DLLFunction(DLL,'GetClassNameA');
DLLFunction.returns(ExtTypes::DWord);


DLLFunction.arg(ExtTypes::DWord,ExtTypes::Pointer,ExtTypes::DWord);
DLLFunction.call(_hWnd, buffer, #MAXSTRINGSIZE);

return buffer.string(0);
}

static boolean isWindowVisible(int hWnd)
{
#define.UserDLL('USER32')
DLL _winApiDLL = new DLL(#UserDLL);
DLLFunction _isWindowVisible = new DLLFunction(_winApiDLL,
'IsWindowVisible');
int hDC;

_isWindowVisible.returns(ExtTypes::DWord);
_isWindowVisible.arg(ExtTypes::DWORD);
hDC = _isWindowVisible.call(hWnd);

return hDC;
}

Regards,
Vic


Samuel L Matzen

12/6/2005 3:32:00 PM

0

Vic,

Thanks, that is exactly what I needed.

Could you possibly also provide the AU_AxWindowEnum class?

-Sam


"Flenciux" <nomail@nohost.com> wrote in message
news:mn.33b07d5c8e002182.44008@nohost.com...
>> Is there an easy way to retrieve a list of all open forms in Axpata?
>>
>> I would like to place them on a docked form on either the left or right
>> side of the MDI form and allow the user to click the form name to
>> activate. Something similar to the behavior implemented in the Windows
>> menu.
>>
>> TIA,
>>
>> -Sam
>
>
> Here is a piece of code that could help you:
>
> static Map getWindowList(container _excludeWindow = connull())
> {
> HWND hWnd, hChildWnd;
> HWND hSubChildWnd;
> str windowname;
> Map windowMap;
> ;
> windowMap = new Map(types::String,types::Integer);
>
> // Axapta main window
> hWnd = AU_AxWindowEnum::getActiveWindow();
> hChildWnd = WinApi::getWindow(hWnd, #GW_CHILD);
> while( hChildWnd )
> {
> hSubChildWnd = hChildWnd;
> // check for 'MDIClient'
> if(AU_AxWindowEnum::GetClassName(hChildWnd) == "MDIClient" )
> {
> // get second level child windows
> hSubChildWnd = CCUtil::getFirstChild(hChildWnd);
> while( hSubChildWnd )
> {
> windowName = WinApi::getWindowText(hSubChildWnd);
> if (conLen(_excludeWindow) &&
> confind(_excludeWindow,windowName))
> windowName = '';
>
> if (AU_AxWindowEnum::isWindowVisible(hSubChildWnd) &&
> strLTrim(strRTrim(windowName)) != '')
>
> windowMap.insert(WinApi::getWindowText(hSubChildWnd),hSubChildWnd);
> hSubChildWnd = WinApi::getWindow(hSubChildWnd,
> #GW_HWNDNEXT);
> }
> }
>
> // iterate througt the first level child windows
> hChildWnd = WinApi::getWindow(hChildWnd, #GW_HWNDNEXT);
> }
> return windowMap;
> }
>
>
> static str getClassName(HWND _hwnd)
> {
> #define.MAXSTRINGSIZE(255)
> DLL DLL;
> DLLFunction DLLFunction;
> binary buffer;
> ;
> buffer = new Binary(#MAXSTRINGSIZE);
> DLL = new DLL('User32');
> DLLFunction = new DLLFunction(DLL,'GetClassNameA');
> DLLFunction.returns(ExtTypes::DWord);
>
> DLLFunction.arg(ExtTypes::DWord,ExtTypes::Pointer,ExtTypes::DWord);
> DLLFunction.call(_hWnd, buffer, #MAXSTRINGSIZE);
>
> return buffer.string(0);
> }
>
> static boolean isWindowVisible(int hWnd)
> {
> #define.UserDLL('USER32')
> DLL _winApiDLL = new DLL(#UserDLL);
> DLLFunction _isWindowVisible = new DLLFunction(_winApiDLL,
> 'IsWindowVisible');
> int hDC;
>
> _isWindowVisible.returns(ExtTypes::DWord);
> _isWindowVisible.arg(ExtTypes::DWORD);
> hDC = _isWindowVisible.call(hWnd);
>
> return hDC;
> }
>
> Regards,
> Vic
>
>


Flenciux

12/7/2005 11:09:00 PM

0

Hi Sam,
all the methods for this procedure of the class AU_WindowENum (except
GetActiveWindow) are listed below (getClassName, isWindowVisible). So
just change reference for those methods from AU_AxWindowEnum:: to
your's and it should be OK.
Missing method:

static int getActiveWindow()
{
DLL _WinApiDLL = new DLL('User32');
DLLFunction _getActiveWindow = new DLLFunction(_WinApiDLL,
'GetActiveWindow');
_GetActiveWindow.returns(EXTTYPES::DWORD);
return _getActiveWindow.call();
}


Vic


> Vic,
>
> Thanks, that is exactly what I needed.
>
> Could you possibly also provide the AU_AxWindowEnum class?
>
> -Sam
>
>
> "Flenciux" <nomail@nohost.com> wrote in message
> news:mn.33b07d5c8e002182.44008@nohost.com...
>>> Is there an easy way to retrieve a list of all open forms in Axpata?
>>>
>>> I would like to place them on a docked form on either the left or right
>>> side of the MDI form and allow the user to click the form name to
>>> activate. Something similar to the behavior implemented in the Windows
>>> menu.
>>>
>>> TIA,
>>>
>>> -Sam
>>
>>
>> Here is a piece of code that could help you:
>>
>> static Map getWindowList(container _excludeWindow = connull())
>> {
>> HWND hWnd, hChildWnd;
>> HWND hSubChildWnd;
>> str windowname;
>> Map windowMap;
>> ;
>> windowMap = new Map(types::String,types::Integer);
>>
>> // Axapta main window
>> hWnd = AU_AxWindowEnum::getActiveWindow();
>> hChildWnd = WinApi::getWindow(hWnd, #GW_CHILD);
>> while( hChildWnd )
>> {
>> hSubChildWnd = hChildWnd;
>> // check for 'MDIClient'
>> if(AU_AxWindowEnum::GetClassName(hChildWnd) == "MDIClient" )
>> {
>> // get second level child windows
>> hSubChildWnd = CCUtil::getFirstChild(hChildWnd);
>> while( hSubChildWnd )
>> {
>> windowName = WinApi::getWindowText(hSubChildWnd);
>> if (conLen(_excludeWindow) &&
>> confind(_excludeWindow,windowName))
>> windowName = '';
>>
>> if (AU_AxWindowEnum::isWindowVisible(hSubChildWnd) &&
>> strLTrim(strRTrim(windowName)) != '')
>>
>> windowMap.insert(WinApi::getWindowText(hSubChildWnd),hSubChildWnd);
>> hSubChildWnd = WinApi::getWindow(hSubChildWnd,
>> #GW_HWNDNEXT);
>> }
>> }
>>
>> // iterate througt the first level child windows
>> hChildWnd = WinApi::getWindow(hChildWnd, #GW_HWNDNEXT);
>> }
>> return windowMap;
>> }
>>
>>
>> static str getClassName(HWND _hwnd)
>> {
>> #define.MAXSTRINGSIZE(255)
>> DLL DLL;
>> DLLFunction DLLFunction;
>> binary buffer;
>> ;
>> buffer = new Binary(#MAXSTRINGSIZE);
>> DLL = new DLL('User32');
>> DLLFunction = new DLLFunction(DLL,'GetClassNameA');
>> DLLFunction.returns(ExtTypes::DWord);
>>
>> DLLFunction.arg(ExtTypes::DWord,ExtTypes::Pointer,ExtTypes::DWord);
>> DLLFunction.call(_hWnd, buffer, #MAXSTRINGSIZE);
>>
>> return buffer.string(0);
>> }
>>
>> static boolean isWindowVisible(int hWnd)
>> {
>> #define.UserDLL('USER32')
>> DLL _winApiDLL = new DLL(#UserDLL);
>> DLLFunction _isWindowVisible = new DLLFunction(_winApiDLL,
>> 'IsWindowVisible');
>> int hDC;
>>
>> _isWindowVisible.returns(ExtTypes::DWord);
>> _isWindowVisible.arg(ExtTypes::DWORD);
>> hDC = _isWindowVisible.call(hWnd);
>>
>> return hDC;
>> }
>>
>> Regards,
>> Vic
>>
>>


Samuel L Matzen

12/8/2005 4:21:00 AM

0

Vic,

Thanks for the additional method, it is exactly what I needed and provided
me with the jumpstart I needed.

You are the best.

-Sam


"Flenciux" <nomail@nohost.com> wrote in message
news:mn.42617d5cbd965120.44008@nohost.com...
> Hi Sam,
> all the methods for this procedure of the class AU_WindowENum (except
> GetActiveWindow) are listed below (getClassName, isWindowVisible). So just
> change reference for those methods from AU_AxWindowEnum:: to your's and it
> should be OK.
> Missing method:
>
> static int getActiveWindow()
> {
> DLL _WinApiDLL = new DLL('User32');
> DLLFunction _getActiveWindow = new DLLFunction(_WinApiDLL,
> 'GetActiveWindow');
> _GetActiveWindow.returns(EXTTYPES::DWORD);
> return _getActiveWindow.call();
> }
>
>
> Vic
>
>
>> Vic,
>>
>> Thanks, that is exactly what I needed.
>>
>> Could you possibly also provide the AU_AxWindowEnum class?
>>
>> -Sam
>>
>>
>> "Flenciux" <nomail@nohost.com> wrote in message
>> news:mn.33b07d5c8e002182.44008@nohost.com...
>>>> Is there an easy way to retrieve a list of all open forms in Axpata?
>>>>
>>>> I would like to place them on a docked form on either the left or right
>>>> side of the MDI form and allow the user to click the form name to
>>>> activate. Something similar to the behavior implemented in the Windows
>>>> menu.
>>>>
>>>> TIA,
>>>>
>>>> -Sam
>>>
>>>
>>> Here is a piece of code that could help you:
>>>
>>> static Map getWindowList(container _excludeWindow = connull())
>>> {
>>> HWND hWnd, hChildWnd;
>>> HWND hSubChildWnd;
>>> str windowname;
>>> Map windowMap;
>>> ;
>>> windowMap = new Map(types::String,types::Integer);
>>>
>>> // Axapta main window
>>> hWnd = AU_AxWindowEnum::getActiveWindow();
>>> hChildWnd = WinApi::getWindow(hWnd, #GW_CHILD);
>>> while( hChildWnd )
>>> {
>>> hSubChildWnd = hChildWnd;
>>> // check for 'MDIClient'
>>> if(AU_AxWindowEnum::GetClassName(hChildWnd) == "MDIClient" )
>>> {
>>> // get second level child windows
>>> hSubChildWnd = CCUtil::getFirstChild(hChildWnd);
>>> while( hSubChildWnd )
>>> {
>>> windowName = WinApi::getWindowText(hSubChildWnd);
>>> if (conLen(_excludeWindow) &&
>>> confind(_excludeWindow,windowName))
>>> windowName = '';
>>>
>>> if (AU_AxWindowEnum::isWindowVisible(hSubChildWnd) &&
>>> strLTrim(strRTrim(windowName)) != '')
>>>
>>> windowMap.insert(WinApi::getWindowText(hSubChildWnd),hSubChildWnd);
>>> hSubChildWnd = WinApi::getWindow(hSubChildWnd,
>>> #GW_HWNDNEXT);
>>> }
>>> }
>>>
>>> // iterate througt the first level child windows
>>> hChildWnd = WinApi::getWindow(hChildWnd, #GW_HWNDNEXT);
>>> }
>>> return windowMap;
>>> }
>>>
>>>
>>> static str getClassName(HWND _hwnd)
>>> {
>>> #define.MAXSTRINGSIZE(255)
>>> DLL DLL;
>>> DLLFunction DLLFunction;
>>> binary buffer;
>>> ;
>>> buffer = new Binary(#MAXSTRINGSIZE);
>>> DLL = new DLL('User32');
>>> DLLFunction = new DLLFunction(DLL,'GetClassNameA');
>>> DLLFunction.returns(ExtTypes::DWord);
>>>
>>> DLLFunction.arg(ExtTypes::DWord,ExtTypes::Pointer,ExtTypes::DWord);
>>> DLLFunction.call(_hWnd, buffer, #MAXSTRINGSIZE);
>>>
>>> return buffer.string(0);
>>> }
>>>
>>> static boolean isWindowVisible(int hWnd)
>>> {
>>> #define.UserDLL('USER32')
>>> DLL _winApiDLL = new DLL(#UserDLL);
>>> DLLFunction _isWindowVisible = new DLLFunction(_winApiDLL,
>>> 'IsWindowVisible');
>>> int hDC;
>>>
>>> _isWindowVisible.returns(ExtTypes::DWord);
>>> _isWindowVisible.arg(ExtTypes::DWORD);
>>> hDC = _isWindowVisible.call(hWnd);
>>>
>>> return hDC;
>>> }
>>>
>>> Regards,
>>> Vic
>>>
>>>
>
>