En un ambiente MDI, desde WinMain abro un Dialog NOWAIT incrustado en una oChild MDICHILD con 2 xBrowses. Luego abro otro Dialog NOWAIT incrustado en otra MDICHILD. Este último quiero que el usuario no pueda abrirlo mas de 1 vez. Para esto utilizo las siguientes funciones que encontré aquí en el foro:
- Code: Select all Expand view
- Function ShowApplication(cWndTitle)
local hWnd := FindWnd( cWndTitle ) //cFileNoExt( HB_ARGV( 0 ) ) ) // Use the window title here!
if hWnd != nil
if IsIconic( hWnd )
ShowWindow( hWnd, SW_RESTORE )
endif
SetForeGroundWindow( hWnd )
endif
Return if(hWnd != nil, .t.,.f.) //nil
//----------------------------
Function FindWnd( cTitle )
local hWnd := GetWindow( GetDesktopWindow(), GW_CHILD )
while hWnd != 0
if Upper( cTitle ) $ Upper( GetWindowText( hWnd ) )
return hWnd
endif
hWnd = GetWindow( hWnd, GW_HWNDNEXT )
enddo
return nil
Aparentemente trabajan bien, pero no funcionan en algunos casos:
1 - Si abro por primera vez DIALOG NOWAIT incrustado en la oChild MAXIMIZADA y luego trato de abrir la misma ventana, las funciones detectan correctamente, pero si la minimizo, cambio su tamaño a NORMAL o abro otro DIALOG NOWAIT diferente superpuesto al anterior descrito, las funciones no detectan que tengo esa ventana abierta y permite abrirla nuevamente.
¿Cómo se puede solucionar esto?
Agradezco de antemano.
Saludos.