Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The Reappearing _SCREEN background screen
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
The Reappearing _SCREEN background screen
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01620910
Message ID:
01620910
Vues:
123
Hi Gang!

This is a WEIRD one, to be sure !

Now, this USED to work just fine under Windows XP SP3, but since we have moved to Windows 7 and soon 8 / 10, we have this problem.

We have 2 applications, one is POS and the other is EZSIGN. They both run all the time, and EZSIGN looks for a record to be placed in the POS table from the POS application. When it sees a record there, it starts to process the record. In processing the record, it asks the user to SIGN for the purchase on a signature pad (like a VeriFone pad).

What visually happens is that the POS application is full screen, and the EZSIGN app is minimized when not needed for visual interaction ( for instructions to the CLERK to tell the Customer to sign the pad or other instructions. When it is not minimized, it is brought back to its normal size and forefront on the screen by the WINDOWSTATE property of the form. So, in the code, the Windowstate of the form and the _SCREEN was set to 0 for NORMAL size, and 1 for MINIMIZED.

This worked great under Windows XP, but Windows 7 changed the rules. One form cannot control another form in this way. We now have to use API's, and a little trickery to pull it off.

It works just fine, BUT we get the FoxPro Background Screen to pop up when we bring the EZSIGN screen back to normal size ( as in the attachment ).

Here is the code for the bringing the form to the Foreground.

Is there anything we can do to stop the FoxPro Background Screen from popping up ?

Here is the code in a method of the form that is called to make the form NORMAL and put it to the FRONT on the screen
DECLARE Long FindWindow In Win32API String, String
LOCAL lnHWND
lnHWND = FindWindow(Null,thisform.caption)
If lnHWND >0
    =ForceForegroundWindow(lnHWND)
ENDIF
Here is the code in a method of the form that is called to make the form MINIMIZED to the Taskbar.
DECLARE Long FindWindow In Win32API String, String
LOCAL lnHWND
lnHWND = FindWindow(Null,thisform.caption)
If lnHWND >0
    =BringWindowToBottom(lnHWND)
ENDIF
Here is the code that makes it NORMAL and to the front
FUNCTION ForceForegroundWindow(lnHWND)
    LOCAL nForeThread, nAppThread
    =decl()
    
    nForeThread = GetWindowThreadProcessId(GetForegroundWindow(), 0)
    nAppThread = GetCurrentThreadId()

    IF nForeThread != nAppThread
        AttachThreadInput(nForeThread, nAppThread, .T.)
        BringWindowToTop(lnHWND)
        ShowWindow(lnHWND,9)
        AttachThreadInput(nForeThread, nAppThread, .F.)
    ELSE
         BringWindowToTop(lnHWND)
         ShowWindow(lnHWND,9) &&  The 9 forces the window to restore (SW_RESTORE)
    ENDIF
ENDFUNC
Here is the code that makes it MINIMIZED to the Taskbar.
FUNCTION BringWindowToBottom(lnHWND)
    LOCAL nForeThread, nAppThread
    =decl()
    
    nForeThread = GetWindowThreadProcessId(GetForegroundWindow(), 0)
    nAppThread = GetCurrentThreadId()

    IF nForeThread != nAppThread
        AttachThreadInput(nForeThread, nAppThread, .T.)
        BringWindowToTop(lnHWND)
        ShowWindow(lnHWND,6)
        AttachThreadInput(nForeThread, nAppThread, .F.)
    ELSE
        BringWindowToTop(lnHWND)
        ShowWindow(lnHWND,6)   &&  The 6 forces the window to minimize (SW_MINIMIZE)
    ENDIF
ENDFUNC
<PRE>

and the Declarations...
<PRE>
FUNCTION Decl
*!*        DECLARE INTEGER SetForegroundWindow IN user32 INTEGER hwnd  
    DECLARE Long BringWindowToTop In Win32API Long

    DECLARE Long ShowWindow In Win32API Long, Long

    DECLARE INTEGER GetCurrentThreadId; 
        IN kernel32
     
    DECLARE INTEGER GetWindowThreadProcessId IN user32; 
        INTEGER   hWnd,; 
        INTEGER @ lpdwProcId  
     
    DECLARE INTEGER GetCurrentThreadId; 
        IN kernel32  
        
    DECLARE INTEGER AttachThreadInput IN user32 ;
        INTEGER idAttach, ;
        INTEGER idAttachTo, ;
        INTEGER fAttach

    DECLARE INTEGER GetForegroundWindow IN user32  
    
ENDFUNC
Tommy Tillman A+ NetWork+ MCP
Répondre
Fil
Voir

Click here to load this message in the networking platform