Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with lockwindowupdate() APi call...
Message
De
16/02/2003 18:05:18
 
 
À
16/02/2003 15:06:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00753913
Message ID:
00753935
Vues:
29
>On WinNT4 and VFP7, the following trick (that I learned on UT) works fine, but it does not work on VFP7 running on XP Pro or Home.
>
>The intent here is to hide the "Printing..." window when running a report. I have seen many people ask how to do this, and I had it working on NT4, but XP seems to ignore it.
>
>Can anyone re-produce this?
>
>
>
>DECLARE INTEGER GetDesktopWindow IN WIN32API
>DECLARE INTEGER LockWindowUpdate IN WIN32API INTEGER lnHandle
>
>hWin = GetDeskTopWindow()
>=LockWindowUpdate(hWin)
>
>report form ...
>
>=LockWindowUpdate(0)

It's better if you only lock the VFP main desktop rather than lock the window desktop itself. Cause windows is multitasking environment, maybe there are some internal system needs to redraw the desktop or the system.

Since I don't have NT4 or XP system here I can't test your code. The other workaround is to use timer. But maybe you can still see the window flash a bit.

This is my code to hide the Print Preview window, so you need to adjust it
oHide = CreateObject('MyTimer')
oHide.cTitle = 'Preview'
oHide.Enabled = .T.
Report form MyForm preview

oHide = Null
Release oHide
Clear all

Define Class MyTimer as Timer
#DEFINE SWP_NoSize       0x0001
#DEFINE SWP_NoMove       0x0002
#DEFINE SWP_HideWindow   0x0080
#DEFINE SWP_None         SWP_NoSize+SWP_NoMove+SWP_HideWindow
#DEFINE VFP_Preview      'Print Preview'

   Interval = 48
   Enabled = .F.
   cTitle = ''

   Procedure Init
      * You can download this from UT download area
      * or change this with FindWindow / FindWindowEx
      Declare Long FindWTitle in HTWindow  ;
         String @cTitle, Integer nCase, Integer nShow

      Declare Short SetWindowPos in User32 as SetWinPos ;
         Long hwnd, Long hWndInsertAfter, ;
         Integer nHorz, Integer nVert, Integer nWidth, Integer nHeight, Long nFlags
   EndProc

   Procedure Timer
   Local ln_hWnd, lc_Title
*        If WVisible(VFP_Preview)
*           Hide window VFP_Preview
*        endif
      lc_Title = This.cTitle + replicate(chr(0), 64)
      ln_hWnd = FindWTitle(lc_Title, 1, 0)
      If (ln_hWnd != 0)
         This.Enabled = .F.
         SetWinPos(ln_hWnd, 0, 0, 0, 0, 0, SWP_None)
      endif
   EndProc

   Procedure Destroy
      Clear Dlls FindWTitle, SetWinPos
   EndProc
EndDefine
Herman
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform