Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Position Of Message Box
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00766286
Message ID:
00766305
Vues:
22
>The MessageBox function places a dialog window on the screen. Theoretically it is possible to retrieve a handle to this window (e.g. with the FindWindow API function) and then change its position with the MoveWindow or SetWindowPos API functions.
>
>After calling the MessageBox, Visual FoxPro (as one-process and one-thread application) stops and waits until this function returns. That means there is no way to run FindWindow and MoveWindow (as well as hooking a window) in parallel with the MessageBox window processing.
>
>So either use an external module solution, or create your own MessageBox function mimicking the standard behaviour.

I'm not really sure that I get your point. If you mean that we can't change the position of MessageBox (correct me if I'm wrong), I had the function to do this (DLL). It can change any windows/dialog position. Using hook means that it intercept before or after (whenever you want to) the window is display

Here is the workaround for Positioning MB from VFP (tested in W2K / VFP7)
This code use timer only
Local lc_Title

oSetPos = CreateObject('MyTimer')
oSetPos.Enabled = .T.
lc_Title = '  Testing'
oSetPos.cTitle = lc_Title

MessageBox('test', 16, lc_Title)

oSetPos = Null
Release oSetPos
Clear all

Define Class MyTimer as Timer
#DEFINE SWP_NoSize		0x0001

   Interval = 10
   Enabled = .F.
   cTitle = ''

   Procedure Init
      Declare Long FindWindowEx in User32 ;
         Long hwndParent, Long hwndChildAfter, String lpszClass, String lpszWindow

      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
      ln_hWnd = FindWindowEx(0, 0, Null, This.cTitle)
      If (ln_hWnd != 0)
         This.Enabled = .F.
         SetWinPos(ln_hWnd, 0, 10, 10, 0, 0, SWP_NoSize)
      endif
   EndProc

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

Click here to load this message in the networking platform