Page 1 of 1

switch to other Form from same App

Posted: Sat Feb 22, 2020 4:33 am
by AUGE_OHR
hi

i do start a multiple Form with Browse/Grid and DBF.
when try to use same DBF i want to switch to that Form and setfocus to Browse/Grid

under Xbase++ i have have SetAppFocus() and SetAppWindow() and i know "setfocus" but what about "setWindow" :idea:
i know FindWindow() & Co but i hope there is a HMG Command ... who can help please.

Re: switch to other Form from same App

Posted: Sat Feb 22, 2020 5:19 am
by AUGE_OHR
while i did not found what i need i have re-write some Xbase++ Code to HMG Syntax using HMG_CallDLL()
FINDWIN.ZIP
(329 Bytes) Downloaded 143 times
Syntax : DoFindWin( cTitle )

cTitle is the exact Name on Titlebar ( can´t find without Titlebar )
if success Window appear in front :D

Re: switch to other Form from same App

Posted: Mon Feb 24, 2020 10:19 am
by AUGE_OHR
hi,

can someone please teach me how to write a HB_FUNC() from those HMG_CallDLL() :idea:

Re: switch to other Form from same App

Posted: Mon Feb 24, 2020 10:38 am
by bpd2000
AUGE_OHR wrote: Mon Feb 24, 2020 10:19 am hi,

can someone please teach me how to write a HB_FUNC() from those HMG_CallDLL() :idea:
Suppose we would like to create function SETFOCUS

Refer link for c++ code for SetFocus function

https://docs.microsoft.com/en-us/window ... r-setfocus

Now refer line no. 358 of c:\hmg\source\c_controlmisc.c

Now compare code, how to create function in HMG

Re: switch to other Form from same App

Posted: Mon Feb 24, 2020 11:20 am
by AUGE_OHR
hi

thx for Tip
i have look for HB_FUNC( SetFocus ) but it does not have right Parameter ( Hwnd = Number )

i search for Title of Window so it must be a String ... not sure if "A" or "W" is need :?:
i guess it must be something like this

Code: Select all

   TCHAR *cTitle     = (TCHAR *) HMG_parc  (1)
but how to translate next line

Code: Select all

   nWin := HMG_CallDLL( "User32.dll", DLL_OSAPI, "FindWindow", 0, cTitle)

   nWin = FindWindow( 0, cTitle)
how to "init" nWin :idea:

Re: switch to other Form from same App

Posted: Mon Feb 24, 2020 12:38 pm
by bpd2000
Jimmy
Refer link it may help you to
Find running program from the windows title / process, once found kill said program
http://hmgforum.com/viewtopic.php?f=5&t ... 513#p39513

Re: switch to other Form from same App

Posted: Mon Feb 24, 2020 9:04 pm
by AUGE_OHR
hi,

thx for help.

it is not the Function itself, which is working, it is HB_FUNC() Syntax and Parameter Type like HMG_parc / hb_parc