Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
DECLARE INTEGER ShellExecute IN "Shell32.dll" ;
INTEGER hwnd, ;
STRING lpVerb, ;
STRING lpFile, ;
STRING lpParameters, ;
STRING lpDirectory, ;
LONG nShowCmd
DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin
cFileName = "c:\Program Files\Windows Media Player\Wmplayer.exe"
cAction = "open"
ShellExecute(0,cAction,cFileName,"","",1)
#DEFINE WM_SYSCOMMAND 0x112
#DEFINE SC_CLOSE 0xF060
DECLARE INTEGER FindWindow IN user32;
INTEGER lpClassName, STRING lpWindowName
DECLARE SHORT PostMessage IN user32;
INTEGER hWnd, INTEGER Msg, INTEGER wParam,;
INTEGER lParam
LOCAL hWindow
hWindow = FindWindow(0, "Windows Media Player")
IF hWindow <> 0
= PostMessage(hWindow, WM_SYSCOMMAND, SC_CLOSE, 0)
ENDIF
** SAMPLE Use **
IF !FINDTITL("MyAppWindowTitle", .F., .T.)
* fire up the external app
ENDIF
* ....
** FINDTITL.PRG
PARAMETERS zcTitle, zlExact, zlUpper
** Checks to see if the Title sent in (zcTitle) matches the title
** of any active desktop window.
** The second parameter (zlExact) tells us to check the
** beginning of the title for an exact match or check
** anywhere in the title for zcTitle.
** zcTitle is CASE SENSITIVE unless zlUpper is .T.
** If the title is found then that window is brought forward
** and .T. is returned.
IF TYPE("ZCTITLE") != "C" OR TYPE("ZLEXACT") != "L" ;
OR TYPE("ZLUPPER") !="L"
** Bad parameter(s).
RETURN .F.
ENDIF
IF zlUpper
zcTitle = UPPER(zcTitle)
ENDIF
#DEFINE GW_HWNDNEXT 2
#DEFINE GW_CHILD 5
#DEFINE SW_RESTORE 9
DECLARE INTEGER GetWindow IN USER32 INTEGER, INTEGER
DECLARE INTEGER GetDesktopWindow IN USER32
DECLARE INTEGER GetWindowText IN USER32 INTEGER, STRING @, INTEGER
DECLARE INTEGER IsIconic IN USER32 INTEGER
DECLARE INTEGER SetActiveWindow IN USER32 INTEGER
DECLARE INTEGER ShowWindow IN USER32 INTEGER, INTEGER
PRIVATE qnHwnd, qlReturn
qlReturn = .F.
** Get the handle of the first window on the Desktop.
qnHwnd = GetWindow(GetDesktopWindow(), GW_CHILD)
** Loop through all active windows.
DO WHILE qnHwnd > 0
PRIVATE qcTitle, qnLen
qcTitle = REPL(CHR(0), 128)
qnLen = GetWindowText(qnHwnd, @qcTitle, 128)
qnLen = MIN(qnLen, 128)
qcTitle = SUBSTR(qcTitle, 1, qnLen)
IF zlUpper
qcTitle = UPPER(qcTitle)
ENDIF
IF ! EMPTY(qcTitle)
IF zlExact AND zcTitle == SUBSTR(qcTitle, 1, LEN(zcTitle))
qlReturn = .T.
EXIT
ENDIF
IF ! zlExact AND zcTitle $ qcTitle
qlReturn = .T.
EXIT
ENDIF
ENDIF
** Get the next window handle.
qnHwnd = GetWindow(qnHwnd, GW_HWNDNEXT)
ENDDO
IF qlReturn
** Attempt to bring the found window forward.
IF IsIconic(qnHwnd) > 0
=ShowWindow(qnHwnd, SW_RESTORE)
ENDIF
=SetActiveWindow(qnHwnd)
ENDIF
RETURN qlReturn
* ----