switch to other Form from same App

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

switch to other Form from same App

Post 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.
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: switch to other Form from same App

Post 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
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: switch to other Form from same App

Post by AUGE_OHR »

hi,

can someone please teach me how to write a HB_FUNC() from those HMG_CallDLL() :idea:
have fun
Jimmy
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: switch to other Form from same App

Post 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
BPD
Convert Dream into Reality through HMG
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: switch to other Form from same App

Post 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:
have fun
Jimmy
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: switch to other Form from same App

Post 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
Attachments
Untitled.png
Untitled.png (21.32 KiB) Viewed 2047 times
BPD
Convert Dream into Reality through HMG
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: switch to other Form from same App

Post 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
have fun
Jimmy
Post Reply