This is simple two window app code. When button '>>' in main window is pressed next window is create, but when press 'OK' button in next window, which will close window, next window stay visible. Second press 'OK' button destroy window. Use 'OK' button in right upper window corner move window in background mode.
Regards
Pawel
Code: Select all
#Include 'FwCe.Ch'
Function TestClose ()
Local oWnd := Nil
Define Window oWnd Title 'Test Close'
@ 100, 10 Say 'This is main window' Size 150, 15 Pixel
@ 200, 178 Button '>>' Size 60, 20 Pixel Action IIf (NextWindow (), Nil, oWnd : End ())
Activate Window oWnd On Init EmptyMenu (oWnd : hWnd)
Return .T.
Function NextWindow ()
Local oWnd := Nil
Local lRet := .F.
Define Window oWnd Title 'Next Window'
@ 100, 10 Say 'This is next window' Size 150, 15 Pixel
@ 200, 178 Button 'OK' Size 60, 20 Pixel Action (lRet := .T., oWnd : End ())
Activate Window oWnd On Init EmptyMenu (oWnd : hWnd)
Return lRet
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
#include <aygshell.h>
#include <uniqueid.h>
#include <objbase.h>
HB_FUNC (EMPTYMENU)
{
SHINITDLGINFO shidi;
HWND hWnd = (HWND) hb_parnl (1);
SHMENUBARINFO mbi;
shidi.dwMask = SHIDIM_FLAGS;
shidi.hDlg = hWnd;
shidi.dwFlags = SHIDIF_DONEBUTTON;
SHInitDialog (&shidi);
memset(&mbi, 0, sizeof (SHMENUBARINFO));
mbi.cbSize = sizeof (SHMENUBARINFO);
mbi.hwndParent = hWnd;
mbi.dwFlags = SHCMBF_EMPTYBAR;
SHCreateMenuBar (&mbi);
}
#pragma ENDDUMP