Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
craigber said:This is one of those things that should be left to users to control and set the font how they want it. If they want it small, it should be.
rgbean said:I know I like the way my system is set up - it allows me to be productive.
IF VARTYPE(_screen.msgboxtimer) <> "U"
_SCREEN.RemoveObject("msgboxtimer")
ENDIF
_SCREEN.AddObject("msgboxtimer", "Tmsgbox")
WITH _SCREEN.msgboxtimer
.FontName = "Times New Roman"
.FontSize = 24
* note carriage returns added to the end of the message
* to increase its height
.MsgBox("The MessageBox dialog with adjustable font. " +;
Repli(Chr(13),5), 64, "MessageBox")
ENDWITH
* end of main
DEFINE CLASS Tmsgbox As Timer
#DEFINE GW_HWNDFIRST 0
#DEFINE GW_HWNDLAST 1
#DEFINE GW_HWNDNEXT 2
#DEFINE GW_CHILD 5
#DEFINE GWL_ID -12
Interval=0
hDialog=0 && dialog window handle
DlgMessage=""
DlgTitle=""
DlgType=0
DlgResult=0
FontName="Arial"
FontSize=16
FontItalic=0
FontWeight=400
PROCEDURE Init
DECLARE INTEGER GetActiveWindow IN user32
DECLARE INTEGER GetWindow IN user32 INTEGER hwnd, INTEGER wFlag
DECLARE INTEGER GetWindowLong IN user32 INTEGER hWnd, INTEGER nIndex
DECLARE INTEGER ReleaseDC IN user32 INTEGER hwnd, INTEGER hdc
DECLARE INTEGER DeleteObject IN gdi32 INTEGER hObject
DECLARE INTEGER SelectObject IN gdi32 INTEGER hdc, INTEGER hObject
DECLARE INTEGER GetWindowDC IN user32 INTEGER hWnd
DECLARE INTEGER CreateFont IN gdi32;
INTEGER nHeight, INTEGER nWidth, INTEGER nEscapement,;
INTEGER nOrientation, INTEGER fnWeight, INTEGER fdwItalic,;
INTEGER fdwUnderline, INTEGER fdwStrikeOut, INTEGER fdwCharSet,;
INTEGER fdwOutPrecis, INTEGER fdwClipPrecis, INTEGER fdwQuality,;
INTEGER fdwPitchAndFamily, STRING lpszFace
DECLARE INTEGER GetWindowText IN user32;
INTEGER hwnd, STRING @lpString, INTEGER cch
DECLARE INTEGER SendMessage IN user32;
INTEGER hWnd, INTEGER Msg, INTEGER wParam, INTEGER lParam
PROCEDURE MsgBox(cMsg, nType, cTitle)
WITH THIS
.DlgMessage = cMsg
.DlgType = m.nType
.DlgTitle = Iif(VARTYPE(cTitle)="C", m.cTitle, VERSION())
.Interval = 100
.DlgResult = MessageB(THIS.DlgMessage, .DlgType, .DlgTitle)
.hDialog = 0
ENDWITH
RETURN THIS.DlgResult
PROCEDURE Timer
IF THIS.hDialog = 0
IF THIS.DialogFound()
THIS.SetMessageFont
ENDIF
THIS.Interval = 0
ENDIF
PROTECTED FUNCTION DialogFound
LOCAL hWindow, cTitle
hWindow = GetActiveWindow()
cTitle = THIS.GetWinText(hWindow)
THIS.hDialog = IIF(cTitle=THIS.DlgTitle, hWindow, 0)
RETURN (THIS.hDialog <> 0)
PROTECTED FUNCTION GetWinText(hWindow)
LOCAL nBufsize, cBuffer
nBufsize = 128
cBuffer = Repli(Chr(0), nBufsize)
nBufsize = GetWindowText(hWindow, @cBuffer, nBufsize)
RETURN Iif(nBufsize=0, "", Left(cBuffer, nBufsize))
PROTECTED PROCEDURE SetMessageFont
#DEFINE OUT_OUTLINE_PRECIS 8
#DEFINE CLIP_STROKE_PRECIS 2
#DEFINE PROOF_QUALITY 2
#DEFINE WM_SETFONT 48
LOCAL hFirst, hWindow, hLast, hTarget, nId, hDC, hFont
hFirst = GetWindow(THIS.hDialog, GW_CHILD)
hWindow = GetWindow(hFirst, GW_HWNDFIRST)
hLast = GetWindow(hFirst, GW_HWNDLAST)
hTarget = 0
DO WHILE .T.
nId = GetWindowLong(m.hWindow, GWL_ID)
cText = THIS.GetWinText(m.hWindow)
DO CASE
CASE m.cText = THIS.DlgMessage
hTarget = m.hWindow
EXIT
CASE hWindow = m.hLast
EXIT
ENDCASE
hWindow = GetWindow(m.hWindow, GW_HWNDNEXT)
ENDDO
IF hTarget <> 0
hDC = GetWindowDC(m.hTarget)
hFont = CreateFont(THIS.FontSize,;
0, 0,0, THIS.FontWeight,THIS.FontItalic,0,0,;
0, OUT_OUTLINE_PRECIS, CLIP_STROKE_PRECIS,;
PROOF_QUALITY, 0, THIS.FontName)
= SendMessage (m.hTarget, WM_SETFONT, m.hFont, 1)
= ReleaseDC(m.hTarget, m.hDC)
= DeleteObject(hFont)
ENDIF
ENDDEFINE
Courtesy of www.news2news.com
objShell = Createobject("WScript.Shell")
Declare Sleep In kernel32 Integer dwMilliseconds
objIE = Createobject("InternetExplorer.Application")
strIETitle ="Message box"
strMsg ="This is my new style message box"
With objIE
.Toolbar = .F.
.StatusBar = .F.
.Resizable = .F.
.Navigate("about:blank")
With .Document
With .ParentWindow
intWidth = .Screen.AvailWidth
intHeight = .Screen.AvailHeight
intWidthW = .Screen.AvailWidth * .40
intHeightW = .Screen.AvailHeight * .05
.resizeto(300,200)
.moveto( (.Screen.AvailWidth)/6, (.Screen.AvailHeight)/6)
Endwith
.Write( "<body> " + strMsg + " </body></html>")
With .ParentWindow.Document.body
.Style.backgroundcolor = "LightBlue"
.Scroll="no"
.Style.Font = "20pt 'Arial'"
.Style.BorderStyle = "outset"
.Style.BorderWidth = "4px"
Endwith
.Title = strIETitle
=Sleep(100)
objShell.AppActivate(strIETitle)
Endwith
Endwith
objIE.Visible = .T.