Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Repositioning messageboxes
Message
 
 
To
04/01/2000 15:24:12
Stephen Hunt
Admit Computer Services Inc.
Farmingdale, New York, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00312704
Message ID:
00313051
Views:
63
Stephen,

It's kind of a hack and the messagebox will pop up centered and then move, but this will work:
ox = createobject( "mytimer" )

#define SWP_NOSIZE          0x0001
#define HWND_NOTOPMOST  -2

declare integer FindWindow in win32api ;
  string lpClassName, ; && pointer to class name
  string lpWindowName   && pointer to window name

declare integer SetWindowPos IN win32api ;
  integer hWnd,            ; && handle to window
  integer hWndInsertAfter, ; && placement-order handle
  integer X,               ; && horizontal position
  integer Y,               ; && vertical position  
  integer cx,              ; && width
  integer cy,              ; && height
  integer uFlags             && window-positioning flags

=messagebox( "test", 0, "My Title" )
ox = .null.
return

define class MyTimer as timer

procedure Init()
this.Interval = 1
this.Enabled = .t.
endproc

procedure Timer()
this.Enabled = .f.
local lnHWND
lnHWND = FindWindow( .null., "My Title" )
SetWindowPos( lnHWND, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE )
endproc

enddefine
The timer is needed because the MessageBox is modal as far as VFP is concerned.

>when using the =MESSAGEBOX() is there a way to reposition the messagebox to a different location on the screen instead of it allways being in the middle ?
>
>Thanks for your help !
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform