Messagebox with function API and VFP
The messagebox API is the source of the vfp messagebox function.
this last one have many restrictions as
-the text length is limited to 1024 chars max.
-the text is occidental exclusively and dont support unicode.
this code make an experimental builder to simulate all situations generated with messagebox (ANSI) and messageboxW (unicode) API.
it worsk with occidental chars(as messagebox) and with unicode chars(as messageboxW).
the unicode texts must be saved as unicode txt (with notepad for ex.)
a working code is generated in the 2 cases(extended to all constants-can cut that not used at final result).
of course can use any unicode language with this method.
-the second part is a basic custom vfp messagebox made with a native form.
a class+2 tests codes from a prg and frm a form.
Before begin, copy this unicode arabic text with notepad and save as [arabic.txt] as unicode mandatory.its used in code below.
لا تزال الحكومة تدافع عن مشروع قانونها للمالية لسنة 2016، بتفويضها وزير المالية، عبد الرحمان بن خالفة، للدفاع
عن أول قانون مجسد لسياسة التقشف، أمام نواب غرفتي البرلمان، بعد أكثر
من عشرية عاشتها الجزائر في بحبوحة مالية، لتأتي تقلبات أسعار النفط في الأسواق النفطية وتخلط حسابات الحكومة وتفرغ قانون المالية
من محتواه وتضعه في مهب الريح، بعد أن نزلت أسعار البرميل إلى مستوى 36 دولارا للبرميل، بعيدا عن توقعات الحكومة للسنة المقبلة
ويتوقع الخبراء والمختصون في قطاع الطاقة، أن يبقى سعر البرميل منخفضا
خلال السبع سنوات المقبلة، ما يؤكد أن فجوة عجز الميزانية ستتعمق مع مرور السنوات، لتتجاوز المستوى المحدد في مشروع قانون المالية لسنة 2016
، والمقدر بـ30,64 مليار دولار. وكانت الحكومة قد اعتمدت، في إعداد قانون المالية لسنة 2016، على سعر مرجعي استقر عند 37 دولارا للبرميل،
في الوقت الذي قدرت متوسط سعر النفط لحساب الميزانية بـ45 دولارا للبرميل، ما يعني أن ما أقرته وزارة المالية في قانونها لسنة 2016، من تدابير
تخص زيادات في أسعار المواد الأساسية من كهرباء وغاز وإصرار على فتح رأسمال الشركات العمومية، لن تكفي لتدارك خسائر الخزينة العمومية.
Click on code to select [then copy] -click outside to deselect
*1*
*an extended code builder for messagebox function
*from:https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505%28v=vs.85%29.aspx
publi yform
yform=newObject("ymessagebox")
yform.show
read events
retu
*
DEFINE CLASS ymessagebox AS form
BorderStyle = 0
Height = 441
Width = 624
ShowWindow = 2
AutoCenter = .T.
Caption = "Messagebox API explained by a builder"
MaxButton = .F.
ycode = .F.
yunicode = 0
ystring = .F.
Name = "Form1"
ADD OBJECT optiongroup1 AS optiongroup WITH ;
AutoSize = .T., ;
ButtonCount = 7, ;
Value = 1, ;
Height = 141, ;
Left = 12, ;
Top = 12, ;
Width = 401, ;
Name = "Optiongroup1", ;
Option1.Caption = "Abort, Retry, and Ignore", ;
Option1.Value = 1, ;
Option1.Height = 17, ;
Option1.Left = 5, ;
Option1.Top = 5, ;
Option1.Width = 145, ;
Option1.AutoSize = .T., ;
Option1.Name = "Option1", ;
Option2.Caption = "Cancel, Try Again, Continue", ;
Option2.Height = 17, ;
Option2.Left = 5, ;
Option2.Top = 24, ;
Option2.Width = 169, ;
Option2.AutoSize = .T., ;
Option2.Name = "Option2", ;
Option3.Caption = "The message box contains one push button: OK", ;
Option3.Height = 17, ;
Option3.Left = 5, ;
Option3.Top = 43, ;
Option3.Width = 282, ;
Option3.AutoSize = .T., ;
Option3.Name = "Option3", ;
Option4.Caption = "The message box contains two push buttons: OK and Cancel", ;
Option4.Height = 17, ;
Option4.Left = 5, ;
Option4.Top = 62, ;
Option4.Width = 353, ;
Option4.AutoSize = .T., ;
Option4.Name = "Option4", ;
Option5.Caption = "The message box contains two push buttons: Retry and Cancel", ;
Option5.Height = 17, ;
Option5.Left = 5, ;
Option5.Top = 81, ;
Option5.Width = 364, ;
Option5.AutoSize = .T., ;
Option5.Name = "Option5", ;
Option6.Caption = "The message box contains two push buttons: Yes and No", ;
Option6.Height = 17, ;
Option6.Left = 5, ;
Option6.Top = 100, ;
Option6.Width = 334, ;
Option6.AutoSize = .T., ;
Option6.Name = "Option6", ;
Option7.Caption = "The message box contains three push buttons: Yes, No, and Cancel", ;
Option7.Height = 17, ;
Option7.Left = 5, ;
Option7.Top = 119, ;
Option7.Width = 391, ;
Option7.AutoSize = .T., ;
Option7.Name = "Option7"
ADD OBJECT check1 AS checkbox WITH ;
Top = 168, ;
Left = 12, ;
Height = 17, ;
Width = 233, ;
AutoSize = .T., ;
Alignment = 0, ;
Caption = "Adds a Help button to the message box", ;
Name = "Check1"
ADD OBJECT command1 AS commandbutton WITH ;
Top = 360, ;
Left = 444, ;
Height = 37, ;
Width = 168, ;
Caption = "Build messagebox", ;
MousePointer = 15, ;
SpecialEffect = 2, ;
BackColor = RGB(128,255,0), ;
Name = "Command1"
ADD OBJECT optiongroup2 AS optiongroup WITH ;
AutoSize = .T., ;
ButtonCount = 8, ;
Value = 1, ;
Height = 160, ;
Left = 432, ;
Top = 17, ;
Width = 143, ;
Name = "Optiongroup2", ;
Option1.Caption = "ICON EXCLAMATION", ;
Option1.Value = 1, ;
Option1.Height = 17, ;
Option1.Left = 5, ;
Option1.Top = 5, ;
Option1.Width = 133, ;
Option1.AutoSize = .T., ;
Option1.Name = "Option1", ;
Option2.Caption = "ICON WARNING", ;
Option2.Height = 17, ;
Option2.Left = 5, ;
Option2.Top = 24, ;
Option2.Width = 108, ;
Option2.AutoSize = .T., ;
Option2.Name = "Option2", ;
Option3.Caption = "ICON INFORMATION", ;
Option3.Height = 17, ;
Option3.Left = 5, ;
Option3.Top = 43, ;
Option3.Width = 132, ;
Option3.AutoSize = .T., ;
Option3.Name = "Option3", ;
Option4.Caption = "ICON ASTERISK", ;
Option4.Height = 17, ;
Option4.Left = 5, ;
Option4.Top = 62, ;
Option4.Width = 109, ;
Option4.AutoSize = .T., ;
Option4.Name = "Option4", ;
Option5.Caption = "ICON QUESTION", ;
Option5.Height = 17, ;
Option5.Left = 5, ;
Option5.Top = 81, ;
Option5.Width = 113, ;
Option5.AutoSize = .T., ;
Option5.Name = "Option5", ;
Option6.Caption = "ICON STOP", ;
Option6.Height = 17, ;
Option6.Left = 5, ;
Option6.Top = 100, ;
Option6.Width = 83, ;
Option6.AutoSize = .T., ;
Option6.Name = "Option6", ;
Option7.Caption = "ICON ERROR", ;
Option7.Height = 17, ;
Option7.Left = 5, ;
Option7.Top = 119, ;
Option7.Width = 95, ;
Option7.AutoSize = .T., ;
Option7.Name = "Option7", ;
Option8.Caption = "ICON HAND", ;
Option8.Height = 17, ;
Option8.Left = 5, ;
Option8.Top = 138, ;
Option8.Width = 85, ;
Option8.AutoSize = .T., ;
Option8.Name = "Option8"
ADD OBJECT edit1 AS editbox WITH ;
Height = 133, ;
Left = 12, ;
ToolTipText = "Messagebox text", ;
Top = 264, ;
Width = 396, ;
Name = "Edit1"
ADD OBJECT text1 AS textbox WITH ;
Height = 25, ;
Left = 12, ;
ToolTipText = "Messagebox title", ;
Top = 234, ;
Width = 397, ;
Name = "Text1"
ADD OBJECT check2 AS checkbox WITH ;
Top = 192, ;
Left = 12, ;
Height = 17, ;
Width = 150, ;
AutoSize = .T., ;
Alignment = 0, ;
Caption = "The text is right-justified.", ;
Name = "Check2"
ADD OBJECT check3 AS checkbox WITH ;
Top = 214, ;
Left = 12, ;
Height = 17, ;
Width = 382, ;
AutoSize = .T., ;
Alignment = 0, ;
Caption = "Displays message and caption text using right-to-left reading order", ;
Name = "Check3"
ADD OBJECT optiongroup3 AS optiongroup WITH ;
AutoSize = .T., ;
ButtonCount = 4, ;
Value = 1, ;
Height = 84, ;
Left = 442, ;
Top = 195, ;
Width = 127, ;
Name = "Optiongroup3", ;
Option1.Caption = "Button1 as default", ;
Option1.Value = 1, ;
Option1.Height = 17, ;
Option1.Left = 5, ;
Option1.Top = 5, ;
Option1.Width = 117, ;
Option1.AutoSize = .T., ;
Option1.Name = "Option1", ;
Option2.Caption = "Button2 as default", ;
Option2.Height = 17, ;
Option2.Left = 5, ;
Option2.Top = 24, ;
Option2.Width = 117, ;
Option2.AutoSize = .T., ;
Option2.Name = "Option2", ;
Option3.Caption = "Button3 as default", ;
Option3.Height = 17, ;
Option3.Left = 5, ;
Option3.Top = 43, ;
Option3.Width = 117, ;
Option3.AutoSize = .T., ;
Option3.Name = "Option3", ;
Option4.Caption = "Button4 as default", ;
Option4.Height = 17, ;
Option4.Left = 5, ;
Option4.Top = 62, ;
Option4.Width = 117, ;
Option4.AutoSize = .T., ;
Option4.Name = "Option4"
ADD OBJECT command3 AS commandbutton WITH ;
Top = 408, ;
Left = 456, ;
Height = 25, ;
Width = 145, ;
Caption = "Extended Code", ;
MousePointer = 15, ;
SpecialEffect = 2, ;
BackColor = RGB(255,128,0), ;
Name = "Command3"
ADD OBJECT command2 AS commandbutton WITH ;
Top = 408, ;
Left = 84, ;
Height = 25, ;
Width = 97, ;
Caption = "Unicode...", ;
MousePointer = 15, ;
SpecialEffect = 2, ;
BackColor = RGB(128,255,0), ;
Name = "Command2"
PROCEDURE ybuild
thisform.yconst()
*buttons
#define MB_ABORTRETRYIGNORE 0x00000002 &&The message box contains three push buttons: Abort, Retry, and Ignore.
#define MB_CANCELTRYCONTINUE 0x00000006 &&The message box contains three push buttons: Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
#define MB_HELP 0x00004000 &&Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner.
#define MB_OK 0x00000000 &&The message box contains one push button: OK. This is the default.
#define MB_OKCANCEL 0x00000001 &&The message box contains two push buttons: OK and Cancel.
#define MB_RETRYCANCEL 0x00000005 &&The message box contains two push buttons: Retry and Cancel.
#define MB_YESNO 0x00000004 &&The message box contains two push buttons: Yes and No.
#define MB_YESNOCANCEL 0x00000003 &&The message box contains three push buttons: Yes, No, and Cancel.
*Icons
#define MB_ICONEXCLAMATION 0x00000030 &&An exclamation-point icon appears in the message box.
#define MB_ICONWARNING 0x00000030 &&An exclamation-point icon appears in the message box.
#define MB_ICONINFORMATION 0x00000040 &&An icon consisting of a lowercase letter i in a circle appears in the message box.
#define MB_ICONASTERISK 0x00000040 &&An icon consisting of a lowercase letter i in a circle appears in the message box.
#define MB_ICONQUESTION 0x00000020 &&A question-mark icon appears in the message box. The question-mark message icon is no longer recommended because it does not clearly represent a specific type of message and because the phrasing of a message as a question could apply to any message type. In addition, users can confuse the message symbol question mark with Help information. Therefore, do not use this question mark message symbol in your message boxes. The system continues to support its inclusion only for backward compatibility.
#define MB_ICONSTOP 0x00000010 &&A stop-sign icon appears in the message box.
#define MB_ICONERROR 0x00000010 &&A stop-sign icon appears in the message box.
#define MB_ICONHAND 0x00000010 &&A stop-sign icon appears in the message box.
*To indicate the default button, specify one of the following values.
#define MB_DEFBUTTON1 0x00000000 &&The first button is the default button.
*MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
#define MB_DEFBUTTON2 0x00000100 &&The second button is the default button.
#define MB_DEFBUTTON3 0x00000200 &&The third button is the default button.
#define MB_DEFBUTTON4 0x00000300 &&The fourth button is the default button.
*To indicate the modality of the dialog box, specify one of the following values.
#define MB_APPLMODAL 0x00000000 &&The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other threads and work in those windows.
*Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the thread. All child windows of the parent of the message box are automatically disabled, but pop-up windows are not.
*MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
#define MB_SYSTEMMODAL 0x00001000 &&Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
#define MB_TASKMODAL 0x00002000 &&Same as MB_APPLMODAL except that all the top-level windows belonging to the current thread are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the calling thread without suspending other threads.
*To specify other options, use one or more of the following values.
#define MB_DEFAULT_DESKTOP_ONLY 0x00020000 &&Same as desktop of the interactive window station. For more information, see Window Stations.
*If the current input desktop is not the default desktop, MessageBox does not return until the user switches to the default desktop.
#define MB_RIGHT 0x00080000 &&The text is right-justified.
#define MB_RTLREADING 0x00100000 &&Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
#define MB_SETFOREGROUND 0x00010000 &&The message box becomes the foreground window. Internally, the system calls the SetForegroundWindow function for the message box.
#define MB_TOPMOST 0x00040000 &&The message box is created with the WS_EX_TOPMOST window style.
#define MB_SERVICE_NOTIFICATION 0x00200000 &&The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.
*Terminal Services: If the calling thread has an impersonation token, the function directs the message box to the session specified in the impersonation token.
*If this flag is set, the hWnd parameter must be NULL. This is so that the message box can appear on a desktop other than the desktop corresponding to the hWnd.
*For information on security considerations in regard to using this flag, see Interactive Services. In particular, be aware that this flag can produce interactive content on a locked desktop and should therefore be used for only a very limited set of scenarios, such as resource exhaustion.
*Return code/value &Description
#define IDABORT 3 &&The Abort button was selected.
#define IDCANCEL 2 &&The Cancel button was selected.
#define IDCONTINUE 11 &&he Continue button was selected.
#define IDIGNORE 5 &&The Ignore button was selected.
#define IDNO 7 &&The No button was selected.
#define IDOK 1 &&The OK button was selected.
#define IDRETRY 4 &&The Retry button was selected.
#define IDTRYAGAIN 10 &&The Try Again button was selected.
#define IDYES 6 &&The Yes button was selected.
**************************************************
local m.flag,m.xflag
m.flag=MB_APPLMODAL &&default
m.xflag="MB_APPLMODAL"
do case
case thisform.optiongroup1.value=1
m.flag=MB_ABORTRETRYIGNORE
m.xflag=m.xflag+"+MB_ABORTRETRYIGNORE"
case thisform.optiongroup1.value=2
m.flag=MB_CANCELTRYCONTINUE
m.xflag=m.xflag+"+MB_CANCELTRYCONTINUE"
case thisform.optiongroup1.value=3
m.flag=MB_OK
m.xflag=m.xflag+"+MB_OK "
case thisform.optiongroup1.value=4
m.flag=MB_OKCANCEL
m.xflag=m.xflag+"+MB_OKCANCEL"
case thisform.optiongroup1.value=5
m.flag=MB_RETRYCANCEL
m.xflag=m.xflag+"+MB_RETRYCANCEL"
case thisform.optiongroup1.value=6
m.flag=MB_YESNO
m.xflag=m.xflag+"+MB_YESNO"
case thisform.optiongroup1.value=7
m.flag=MB_YESNOCANCEL
m.xflag=m.xflag+"+MB_YESNOCANCEL"
endcase
if thisform.check1.value=1
m.flag=m.flag+MB_HELP
m.xflag=m.xflag+"+MB_HELP"
endi
do case
case thisform.optiongroup2.value=1
m.flag=m.flag+ MB_ICONEXCLAMATION
m.xflag=m.xflag+"+MB_ICONEXCLAMATION"
case thisform.optiongroup2.value=2
m.flag=m.flag+MB_ICONWARNING
m.xflag=m.xflag+"+MB_ICONWARNING"
case thisform.optiongroup2.value=3
m.flag=m.flag+MB_ICONINFORMATION
m.xflag=m.xflag+"+MB_ICONINFORMATION "
case thisform.optiongroup2.value=4
m.flag=m.flag+MB_ICONASTERISK
m.xflag=m.xflag+"+MB_ICONASTERISK"
case thisform.optiongroup2.value=5
m.flag=m.flag+MB_ICONQUESTION
m.xflag=m.xflag+"+MB_ICONQUESTION"
case thisform.optiongroup2.value=6
m.flag=m.flag+MB_ICONSTOP
m.xflag=m.xflag+"+MB_ICONSTOP"
case thisform.optiongroup2.value=7
m.flag=m.flag+MB_ICONERROR
m.xflag=m.xflag+"+MB_ICONERROR"
case thisform.optiongroup2.value=8
m.flag=m.flag+MB_ICONHAND
m.xflag=m.xflag+"+MB_ICONHAND"
endcase
if thisform.check2.value=1
m.flag=m.flag+MB_RIGHT
m.xflag=m.xflag+"+MB_RIGHT"
endi
if thisform.check3.value=1
m.flag=m.flag+MB_RTLREADING
m.xflag=m.xflag+"+MB_RTLREADING"
endi
do case
case thisform.optiongroup3.value=1
m.flag=m.flag+MB_DEFBUTTON1
m.xflag=m.xflag+"+MB_DEFBUTTON1 "
case thisform.optiongroup3.value=2
m.flag=m.flag+MB_DEFBUTTON2
m.xflag=m.xflag+"+MB_DEFBUTTON2 "
case thisform.optiongroup3.value=3
m.flag=m.flag+MB_DEFBUTTON3
m.xflag=m.xflag+"+MB_DEFBUTTON3 "
case thisform.optiongroup3.value=4
m.flag=m.flag+MB_DEFBUTTON4
m.xflag=m.xflag+"+MB_DEFBUTTON4 "
endcase
local m.xx
text to m.xx textmerge noshow
MessageBoxA(_vfp.hwnd,m.xtext,"<<thisform.text1.value>>",<<m.xflag>>)
endtext
thisform.ycode=thisform.ycode+chr(13)+m.xx
local m.retVal
m.retVal=MessageBoxA(_vfp.hwnd,thisform.edit1.value,thisform.text1.value,m.Flag)
do case
case m.retval=3
messagebox(" IDABORT 3 The Abort button was selected.",0+32+4096,'',1200)
case m.retVal=2
messagebox("IDCANCEL 2 The Cancel button was selected.",0+32+4096,'',1200)
case m.retval=11
messagebox("IDCONTINUE 11 he Continue button was selected.",0+32+4096,'',1200)
case m.retVal=5
messagebox("IDIGNORE 5 The Ignore button was selected.",0+32+4096,'',1200)
case m.retVal=7
messagebox("IDNO 7 The No button was selected.",0+32+4096,'',1200)
case m.retVAl=1
messagebox("IDOK 1 The OK button was selected.",0+32+4096,'',1200)
case m.retVal=4
messagebox("IDRETRY 4 The Retry button was selected.",0+32+4096,'',1200)
case m.retVal=10
messagebox("IDTRYAGAIN 10 The Try Again button was selected.",0+32+4096,'',1200)
case m.retVal=6
messagebox("IDYES 6 The Yes button was selected.",0+32+4096,'',1200)
endcase
ENDPROC
PROCEDURE yconst
TEXT to thisform.ycode noshow
DECLARE INTEGER MessageBox IN user32 As MessageBoxA;
INTEGER hwnd,;
STRING lpText,;
STRING lpCaption,;
INTEGER wType
DECLARE INTEGER MessageBoxW IN user32 ;
INTEGER hwnd,;
STRING lpText,;
STRING lpCaption,;
INTEGER wType
*buttons
#define MB_ABORTRETRYIGNORE 0x00000002
#define MB_CANCELTRYCONTINUE 0x00000006
#define MB_HELP 0x00004000
#define MB_OK 0x00000000
#define MB_OKCANCEL 0x00000001
#define MB_RETRYCANCEL 0x00000005
#define MB_YESNO 0x00000004
#define MB_YESNOCANCEL 0x00000003
*Icons
#define MB_ICONEXCLAMATION 0x00000030
#define MB_ICONWARNING 0x00000030
#define MB_ICONINFORMATION 0x00000040
#define MB_ICONASTERISK 0x00000040
#define MB_ICONQUESTION 0x00000020
#define MB_ICONSTOP 0x00000010
#define MB_ICONERROR 0x00000010
#define MB_ICONHAND 0x00000010
*To indicate the default button, specify one of the following values.
#define MB_DEFBUTTON1 0x00000000
#define MB_DEFBUTTON2 0x00000100
#define MB_DEFBUTTON3 0x00000200
#define MB_DEFBUTTON4 0x00000300
*To indicate the modality of the dialog box, specify one of the following values.
#define MB_APPLMODAL 0x00000000
#define MB_SYSTEMMODAL 0x00001000
#define MB_TASKMODAL 0x00002000
*To specify other options, use one or more of the following values.
#define MB_DEFAULT_DESKTOP_ONLY 0x00020000
#define MB_RIGHT 0x00080000
#define MB_RTLREADING 0x00100000
#define MB_SETFOREGROUND 0x00010000
#define MB_TOPMOST 0x00040000
#define MB_SERVICE_NOTIFICATION 0x00200000
*Return code
#define IDABORT 3
#define IDCANCEL 2
#define IDCONTINUE 11
#define IDIGNORE 5
#define IDNO 7
#define IDOK 1
#define IDRETRY 4
#define IDTRYAGAIN 10
#define IDYES 6
ENDTEXT
ENDPROC
PROCEDURE ybuildw
lparameters stringW
thisform.yconst()
*buttons
#define MB_ABORTRETRYIGNORE 0x00000002 &&The message box contains three push buttons: Abort, Retry, and Ignore.
#define MB_CANCELTRYCONTINUE 0x00000006 &&The message box contains three push buttons: Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
#define MB_HELP 0x00004000 &&Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner.
#define MB_OK 0x00000000 &&The message box contains one push button: OK. This is the default.
#define MB_OKCANCEL 0x00000001 &&The message box contains two push buttons: OK and Cancel.
#define MB_RETRYCANCEL 0x00000005 &&The message box contains two push buttons: Retry and Cancel.
#define MB_YESNO 0x00000004 &&The message box contains two push buttons: Yes and No.
#define MB_YESNOCANCEL 0x00000003 &&The message box contains three push buttons: Yes, No, and Cancel.
*Icons
#define MB_ICONEXCLAMATION 0x00000030 &&An exclamation-point icon appears in the message box.
#define MB_ICONWARNING 0x00000030 &&An exclamation-point icon appears in the message box.
#define MB_ICONINFORMATION 0x00000040 &&An icon consisting of a lowercase letter i in a circle appears in the message box.
#define MB_ICONASTERISK 0x00000040 &&An icon consisting of a lowercase letter i in a circle appears in the message box.
#define MB_ICONQUESTION 0x00000020 &&A question-mark icon appears in the message box. The question-mark message icon is no longer recommended because it does not clearly represent a specific type of message and because the phrasing of a message as a question could apply to any message type. In addition, users can confuse the message symbol question mark with Help information. Therefore, do not use this question mark message symbol in your message boxes. The system continues to support its inclusion only for backward compatibility.
#define MB_ICONSTOP 0x00000010 &&A stop-sign icon appears in the message box.
#define MB_ICONERROR 0x00000010 &&A stop-sign icon appears in the message box.
#define MB_ICONHAND 0x00000010 &&A stop-sign icon appears in the message box.
*To indicate the default button, specify one of the following values.
#define MB_DEFBUTTON1 0x00000000 &&The first button is the default button.
*MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
#define MB_DEFBUTTON2 0x00000100 &&The second button is the default button.
#define MB_DEFBUTTON3 0x00000200 &&The third button is the default button.
#define MB_DEFBUTTON4 0x00000300 &&The fourth button is the default button.
*To indicate the modality of the dialog box, specify one of the following values.
#define MB_APPLMODAL 0x00000000 &&The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other threads and work in those windows.
*Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the thread. All child windows of the parent of the message box are automatically disabled, but pop-up windows are not.
*MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
#define MB_SYSTEMMODAL 0x00001000 &&Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
#define MB_TASKMODAL 0x00002000 &&Same as MB_APPLMODAL except that all the top-level windows belonging to the current thread are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the calling thread without suspending other threads.
*To specify other options, use one or more of the following values.
#define MB_DEFAULT_DESKTOP_ONLY 0x00020000 &&Same as desktop of the interactive window station. For more information, see Window Stations.
*If the current input desktop is not the default desktop, MessageBox does not return until the user switches to the default desktop.
#define MB_RIGHT 0x00080000 &&The text is right-justified.
#define MB_RTLREADING 0x00100000 &&Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
#define MB_SETFOREGROUND 0x00010000 &&The message box becomes the foreground window. Internally, the system calls the SetForegroundWindow function for the message box.
#define MB_TOPMOST 0x00040000 &&The message box is created with the WS_EX_TOPMOST window style.
#define MB_SERVICE_NOTIFICATION 0x00200000 &&The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.
*Terminal Services: If the calling thread has an impersonation token, the function directs the message box to the session specified in the impersonation token.
*If this flag is set, the hWnd parameter must be NULL. This is so that the message box can appear on a desktop other than the desktop corresponding to the hWnd.
*For information on security considerations in regard to using this flag, see Interactive Services. In particular, be aware that this flag can produce interactive content on a locked desktop and should therefore be used for only a very limited set of scenarios, such as resource exhaustion.
*Return code/value &Description
#define IDABORT 3 &&The Abort button was selected.
#define IDCANCEL 2 &&The Cancel button was selected.
#define IDCONTINUE 11 &&he Continue button was selected.
#define IDIGNORE 5 &&The Ignore button was selected.
#define IDNO 7 &&The No button was selected.
#define IDOK 1 &&The OK button was selected.
#define IDRETRY 4 &&The Retry button was selected.
#define IDTRYAGAIN 10 &&The Try Again button was selected.
#define IDYES 6 &&The Yes button was selected.
**********************************************
local m.flag,m.xflag
m.flag=MB_APPLMODAL &&default
m.xflag="MB_APPLMODAL"
do case
case thisform.optiongroup1.value=1
m.flag=MB_ABORTRETRYIGNORE
m.xflag=m.xflag+"+MB_ABORTRETRYIGNORE"
case thisform.optiongroup1.value=2
m.flag=MB_CANCELTRYCONTINUE
m.xflag=m.xflag+"+MB_CANCELTRYCONTINUE"
case thisform.optiongroup1.value=3
m.flag=MB_OK
m.xflag=m.xflag+"+MB_OK "
case thisform.optiongroup1.value=4
m.flag=MB_OKCANCEL
m.xflag=m.xflag+"+MB_OKCANCEL"
case thisform.optiongroup1.value=5
m.flag=MB_RETRYCANCEL
m.xflag=m.xflag+"+MB_RETRYCANCEL"
case thisform.optiongroup1.value=6
m.flag=MB_YESNO
m.xflag=m.xflag+"+MB_YESNO"
case thisform.optiongroup1.value=7
m.flag=MB_YESNOCANCEL
m.xflag=m.xflag+"+MB_YESNOCANCEL"
endcase
if thisform.check1.value=1
m.flag=m.flag+MB_HELP
m.xflag=m.xflag+"+MB_HELP"
endi
do case
case thisform.optiongroup2.value=1
m.flag=m.flag+ MB_ICONEXCLAMATION
m.xflag=m.xflag+"+MB_ICONEXCLAMATION"
case thisform.optiongroup2.value=2
m.flag=m.flag+MB_ICONWARNING
m.xflag=m.xflag+"+MB_ICONWARNING"
case thisform.optiongroup2.value=3
m.flag=m.flag+MB_ICONINFORMATION
m.xflag=m.xflag+"+MB_ICONINFORMATION "
case thisform.optiongroup2.value=4
m.flag=m.flag+MB_ICONASTERISK
m.xflag=m.xflag+"+MB_ICONASTERISK"
case thisform.optiongroup2.value=5
m.flag=m.flag+MB_ICONQUESTION
m.xflag=m.xflag+"+MB_ICONQUESTION"
case thisform.optiongroup2.value=6
m.flag=m.flag+MB_ICONSTOP
m.xflag=m.xflag+"+MB_ICONSTOP"
case thisform.optiongroup2.value=7
m.flag=m.flag+MB_ICONERROR
m.xflag=m.xflag+"+MB_ICONERROR"
case thisform.optiongroup2.value=8
m.flag=m.flag+MB_ICONHAND
m.xflag=m.xflag+"+MB_ICONHAND"
endcase
&&arabic
*if thisform.check2.value=1
m.flag=m.flag+MB_RIGHT
m.xflag=m.xflag+"+MB_RIGHT"
*endi
*if thisform.check3.value=1
m.flag=m.flag+MB_RTLREADING
m.xflag=m.xflag+"+MB_RTLREADING"
*endi
do case
case thisform.optiongroup3.value=1
m.flag=m.flag+MB_DEFBUTTON1
m.xflag=m.xflag+"+MB_DEFBUTTON1 "
case thisform.optiongroup3.value=2
m.flag=m.flag+MB_DEFBUTTON2
m.xflag=m.xflag+"+MB_DEFBUTTON2 "
case thisform.optiongroup3.value=3
m.flag=m.flag+MB_DEFBUTTON3
m.xflag=m.xflag+"+MB_DEFBUTTON3 "
case thisform.optiongroup3.value=4
m.flag=m.flag+MB_DEFBUTTON4
m.xflag=m.xflag+"+MB_DEFBUTTON4 "
endcase
local m.xx
text to m.xx textmerge noshow
MessageBoxW(_vfp.hwnd,m.xtext,strconv("Unicode Arabic Messagebox",5)+chr(0),<<m.xflag>>)
endtext
thisform.ycode=thisform.ycode+chr(13)+m.xx
local m.retVal
m.retVal=MessageBoxW(_vfp.hwnd,stringW,strconv("Unicode Arabic Messagebox"+chr(0),5),m.Flag)
do case
case m.retval=3
messagebox(" IDABORT 3 The Abort button was selected.",0+32+4096,'',1200)
case m.retVal=2
messagebox("IDCANCEL 2 The Cancel button was selected.",0+32+4096,'',1200)
case m.retval=11
messagebox("IDCONTINUE 11 he Continue button was selected.",0+32+4096,'',1200)
case m.retVal=5
messagebox("IDIGNORE 5 The Ignore button was selected.",0+32+4096,'',1200)
case m.retVal=7
messagebox("IDNO 7 The No button was selected.",0+32+4096,'',1200)
case m.retVAl=1
messagebox("IDOK 1 The OK button was selected.",0+32+4096,'',1200)
case m.retVal=4
messagebox("IDRETRY 4 The Retry button was selected.",0+32+4096,'',1200)
case m.retVal=10
messagebox("IDTRYAGAIN 10 The Try Again button was selected.",0+32+4096,'',1200)
case m.retVal=6
messagebox("IDYES 6 The Yes button was selected.",0+32+4096,'',1200)
endcase
ENDPROC
PROCEDURE Load
DECLARE INTEGER MessageBox IN user32 As MessageBoxA;
INTEGER hwnd,;
STRING lpText,;
STRING lpCaption,;
INTEGER wType
DECLARE INTEGER MessageBoxW IN user32 ;
INTEGER hwnd,;
STRING lpText,;
STRING lpCaption,;
INTEGER wType
*Parameters:hWnd [in] Handle to the owner window of the message box to be created
*lpText [in] Pointer to a null-terminated string that contains the message to be displayed
*lpCaption [in] Pointer to a null-terminated string that contains the dialog box title
*uType [in] Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags
*Return value:If the function succeeds, the return value is one of the predefined menu-item values
_screen.windowstate=1
ENDPROC
PROCEDURE Init
set safe off
ENDPROC
PROCEDURE Destroy
erase addbs(sys(2023))+"ycode.txt"
clea events
ENDPROC
PROCEDURE command1.Click
thisform.yunicode=0
thisform.ybuild()
ENDPROC
PROCEDURE edit1.Init
text to this.value noshow
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac
rutrum nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst.
Nulla in iaculis nisi. Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non,
porta congue dolor. Aenean viverra auctor sagittis. Integer lobortis dignissim auctor.
Proin et volutpat massa.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac
rutrum nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst.
Nulla in iaculis nisi. Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non,
porta congue dolor. Aenean viverra auctor sagittis. Integer lobortis dignissim auctor.
Proin et volutpat massa.
* this is from:https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505%28v=vs.85%29.aspx
* MessageBox function
endtext
ENDPROC
PROCEDURE text1.Init
this.value="Your messagebox title here."
ENDPROC
PROCEDURE command3.Click
#define cr chr(13)+chr(10)
do case
case thisform.yunicode=0
local m.text
text to m.xtext textmerge noshow
<<thisform.edit1.value>>
endtext
local m.x
m.x="text to m.xtext noshow"+cr+m.xtext+cr+" endtext"+cr
case thisform.yunicode=1
text to m.x noshow
local m.lcfile,m.myvar
m.lcfile=getfile('txt') &&arabic txt file saved as unicode
if empty(m.lcfile)
return .f.
endi
m.xtext=filetostr(m.lcfile)+chr(0)
endtext
endcase
thisform.ycode=m.x+cr+thisform.ycode
local m.lcdest
m.lcdest=addbs(sys(2023))+"ycode.txt"
strtofile(thisform.ycode,m.lcdest)
run/n notepad &lcdest
*_cliptext=thisform.ycode
*messagebox(thisform.ycode,0+32+4096,"Complet code in clipboard")
ENDPROC
PROCEDURE command2.Click
local m.lcfile,m.myvar
m.lcfile=getfile('txt') &&arabic txt file saved as unicode
if empty(m.lcfile)
return .f.
endi
m.myvar=filetostr(m.lcfile)+chr(0)
thisform.ystring=m.myvar
&&arabic settings
thisform.check2.value=1
thisform.check3.value=1
thisform.yunicode=1
thisform.ybuildw(m.myvar)
ENDPROC
ENDDEFINE
*
*-- EndDefine: ymessagebox
this is a basic vfp messagebox made with a form and vfp controls.
infortunatly there is no autosize editbox to simplify the work(the drawtext API does that-see previous posts).
the form is modal and resizable manually with property desktop=.t..
there is an icon, title and text.
-i dont make the editbox scrollable(can be a solution...)
-colors in demo are set randomly (can fix one color in code).
-6 icons are integrated by code. click on picrture to change it.can add custom pictures in code.
-can customize more controls properties and adapt to more situations.
2 test codes for the class are shipped here:
-a test code as prg
-a test code as top level form
-it can embed big texts
-the title is trucated to a fixed length.
Click on code to select [then copy] -click outside to deselect
*2* save this code class as YMESSAGEBOX_COM.PRG
*!* how to use it (see the 2 test codes below)
*!* *local o
*!* *o=newObject("ymessagebox","F:\____ytests\ymessagebox\ymessagebox_com.prg","","this is my title","this is the messagebox text",4)
*!* *o.show(1)
*!* or
*!* *set proc to "F:\____YTESTS\YMESSAGEBOX\YFORM_MESSAGE\YMESSAGEBOX_COM.PRG" addi
*!* *o=createObject("ymessagebox","THIS IS MY TITLE","AZERTYZAZAZAZAZAZA AEZEZEZEZEZEZEZ ZEZEZEZEZEZ",5)
*!* *release proc "F:\____YTESTS\YMESSAGEBOX\YFORM_MESSAGE\YMESSAGEBOX_COM.PRG"
*!* *o.show(1)
*!* A basic messagebox with native vfp form 21 december 2015 Yousfi Benameur http://yousfi.over-blog.com
*!* of course can apply more customizing properties on all vfp controls on this form
*!* a demo can support long messages...
DEFINE CLASS ymessagebox AS form
BorderStyle = 3
Height = 334
Width = 502
ShowTips = .T.
AutoCenter = .T.
Caption = ""
MaxButton = .F.
MinButton = .F.
MaxWidth = 800
MinHeight = 150
MinWidth = 488
WindowType = 1
showWindow=1
desktop=.t. &&important
yimg = 0
Name = "Form1"
ADD OBJECT shape1 AS shape WITH ;
Top = 72, ;
Left = 5, ;
Height = 217, ;
Width = 493, ;
Anchor = 30, ;
BorderWidth = 2, ;
Curvature = 30, ;
BorderColor = RGB(128,0,255), ;
Name = "Shape1"
ADD OBJECT img AS image WITH ;
Anchor = 768, ;
Stretch = 2, ;
BackStyle = 0, ;
BorderStyle = 0, ;
Height = 64, ;
Left = 12, ;
MousePointer = 15, ;
Top = 3, ;
Width = 64, ;
ToolTipText = "Click to change Icon", ;
Name = "img"
ADD OBJECT label1 AS label WITH ;
FontBold = .T., ;
FontSize = 12, ;
Anchor = 768, ;
BackStyle = 0, ;
Caption = "Your title here", ;
Height = 37, ;
Left = 108, ;
Top = 24, ;
Width = 360, ;
Name = "Label1"
ADD OBJECT edit1 AS editbox WITH ;
FontName = "Courier New", ;
FontSize = 10, ;
Anchor = 30, ;
AddLineFeeds = .F., ;
BorderStyle = 0, ;
Enabled = .F., ;
Height = 199, ;
HideSelection = .F., ;
Left = 12, ;
Margin = 4, ;
ScrollBars = 0, ;
SpecialEffect = 0, ;
Top = 84, ;
Width = 480, ;
SelectedForeColor = RGB(0,0,0), ;
Name = "Edit1"
ADD OBJECT command1 AS commandbutton WITH ;
Top = 302, ;
Left = 203, ;
Height = 27, ;
Width = 108, ;
Anchor = 768, ;
Caption = "OK", ;
Name = "Command1"
PROCEDURE ysetimg
lparameters xx
do case
case empty (xx) or xx=0 or !between(xx,0,5)
text to m.myvar noshow
Qk1YCAAAAAAAADYEAAAoAAAAIAAAACEAAAABAAgAAAAAAAAAAAAQFwAAEBcAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADA3MAA8MqmAKo/KgD/PyoAAF8qAFVfKgCqXyoA/18qAAB/KgBVfyoAqn8qAP9/KgAAnyoAVZ8qAKqfKgD/nyoAAL8qAFW/KgCqvyoA/78qAADfKgBV3yoAqt8qAP/fKgAA/yoAVf8qAKr/KgD//yoAAABVAFUAVQCqAFUA/wBVAAAfVQBVH1UAqh9VAP8fVQAAP1UAVT9VAKo/VQD/P1UAAF9VAFVfVQCqX1UA/19VAAB/VQBVf1UAqn9VAP9/VQAAn1UAVZ9VAKqfVQD/n1UAAL9VAFW/VQCqv1UA/79VAADfVQBV31UAqt9VAP/fVQAA/1UAVf9VAKr/VQD//1UAAAB/AFUAfwCqAH8A/wB/AAAffwBVH38Aqh9/AP8ffwAAP38AVT9/AKo/fwD/P38AAF9/AFVffwCqX38A/19/AAB/fwBVf38Aqn9/AP9/fwAAn38AVZ9/AKqffwD/n38AAL9/AFW/fwCqv38A/79/AADffwBV338Aqt9/AP/ffwAA/38AVf9/AKr/fwD//38AAACqAFUAqgCqAKoA/wCqAAAfqgBVH6oAqh+qAP8fqgAAP6oAVT+qAKo/qgD/P6oAAF+qAFVfqgCqX6oA/1+qAAB/qgBVf6oAqn+qAP9/qgAAn6oAVZ+qAKqfqgD/n6oAAL+qAFW/qgCqv6oA/7+qAADfqgBV36oAqt+qAP/fqgAA/6oAVf+qAKr/qgD//6oAAADUAFUA1ACqANQA/wDUAAAf1ABVH9QAqh/UAP8f1AAAP9QAVT/UAKo/1AD/P9QAAF/UAFVf1ACqX9QA/1/UAAB/1ABVf9QAqn/UAP9/1AAAn9QAVZ/UAKqf1AD/n9QAAL/UAFW/1ACqv9QA/7/UAADf1ABV39QAqt/UAP/f1AAA/9QAVf/UAKr/1AD//9QAVQD/AKoA/wAAH/8AVR//AKof/wD/H/8AAD//AFU//wCqP/8A/z//AABf/wBVX/8Aql//AP9f/wAAf/8AVX//AKp//wD/f/8AAJ//AFWf/wCqn/8A/5//AAC//wBVv/8Aqr//AP+//wAA3/8AVd//AKrf/wD/3/8AVf//AKr//wD/zMwA/8z/AP//MwD//2YA//+ZAP//zAAAfwAAVX8AAKp/AAD/fwAAAJ8AAFWfAACqnwAA/58AAAC/AABVvwAAqr8AAP+/AAAA3wAAVd8AAKrfAAD/3wAAVf8AAKr/AAAAACoAVQAqAKoAKgD/ACoAAB8qAFUfKgCqHyoA/x8qAAA/KgBVPyoA8Pv/AKSgoACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AP////////////////b/rqWBgvb/////////////////////////////////9vbQy6R9ffb//////////////////////////////////8/Lyst9VQj////////////////////29vb2///////Qy8vLxsagVdD///////////////YIgVlZVQeCCP/20M/Py8rGx8KhVfb2////////////qn2prampXQcI09PPz8rLy8fGw8JRffb//////////1kwrc/Pz8/Pz8+pgYF9gXxUfcbCwr5VCP//////////8fCpz8/Sz9LPraSBpKmoy6FUx8O+vplV//////////+BMYHPz8/Pz8/Pz8/Py8vKpH3CwsK/nFUI////////////qlmpz8/PqK3Ly8/Oy8ulpMahwr66eYH/////////////ga3P0s/PgfX0gc/Ky8bHwsK/ur6dVf////////////aBz8+pz8/PgFQsfaXKy8bHwr6+u5hV9v//////////qoHPqS2tz8/Pz6mpqMfGx8LCv76+vlX2//////////aGgc+F8KnPz8/PzsvLysfGw76+urq+ear2////////9qqFz8swrc/Pz8/Ly8rLxsLCnb6/vru+eYL/////////9oHPranPz8/Oy6jLxsfGw8K+vrq+mL6YdaX/////////qqnPz8/Oz8/LqaTHxsfCwr+6vru+vr+cVar/////////hYHPz8/Py8/KpXylwsO+ur6+ur+6vrq+Var29v////+qWc/Pz8vPysvKoVSgwr++u76+ur67vrqYVfb/////9qmlz8/PzsrLy8bHoFG+vr6+vru+vrq+vr90Vfb/////98/Py8/Ly8vGx8bCwr+6dFGYvr66v767vrpR9/////aBz87PzsvKysvGw8O+nFV9qn1Qmb6+ur66vphV///29oHPy8/Ly8vHxsLCwn19qv///6pVUHWcmL6/unn///+vgc/PysvKx8alfarQr//////////2gXlRUFCcUP///wihzsvLysvGwlWq/////////////////9CCeSxR////CIHLysvGx8Z9gf////////////////////////////8IfcvLysfGoYL///////////////////////////////ZVysfGx3yG/////////////////////////////////1mlxsd49/b////////////////////////////////293zHxlX2///////////////////////////////////QVcJ5ff////////////////////////////////////99VFD29v////////////////////////////////////Ytff///////////////////////////////wAA
endtext
case xx=1
*warning
text to m.myvar noshow
Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAACAADEDgAAxA4AAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AP//+IiIiIiIiIiIiIiIiP///4iIiIiIiIiIiIiIiIiP/zAAAAAAAAAAAAAAAAiIiPO7u7u7u7u7u7u7u7twiIg7u7u7u7u7u7u7u7u7twiIO7u7u7u7u7u7u7u7u7sIiDu7u7u7u7cAe7u7u7u7CI87u7u7u7uwAAu7u7u7twiP87u7u7u7sAALu7u7u7CI//O7u7u7u7cAe7u7u7twiP//O7u7u7u7u7u7u7u7CI///zu7u7u7uwu7u7u7twiP///zu7u7u7cHu7u7u7CI////87u7u7uzA7u7u7twiP////87u7u7sAC7u7u7CI//////O7u7u3AAe7u7twiP//////O7u7swADu7u7CI///////zu7u7AAALu7twiP///////zu7uwAAC7u7CI////////87u7sAAAu7twiP////////87u7AAALu7CI//////////O7uwAAC7twiP//////////O7twAHu7CI///////////zu7u7u7twiP///////////zu7u7u7CI////////////87u7u7twiP////////////87u7u7CI//////////////O7u7twiP//////////////O7u7CI///////////////zu7twj////////////////zu3D//////////////////zM///////////
endtext
case xx=2
*information
text to m.myvar noshow
Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAACAADEDgAAxA4AAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AP////////////iP//////////////////+Ij//////////////////wCI//////////////////DwiP////////////////8P8Ij///////////////+A//CI//////////////iIgP/wiIiP//////////iIAAf/8IiIiI////////+AAH////cACIiI///////wB////////3AIiI//////B///////////cIiI////8P////////////8IiI///w//////////////8IiI//j/////zMzMzM////8IiP+H///////MzM//////cIiPj///////zMzP//////CIiH///////8zMz//////3CIj////////MzM///////wiI////////zMzP//////8IiP///////8zMz///////CIj////////MzM///////wiI///////MzMzP//////8I+H/////////////////3CP+P////////////////8I//h//////3zMx//////3D///j//////MzMz/////8P////j/////zMzM/////w//////j////3zMx/////D///////h///////////eP////////iH////////eI//////////+Ih////3iI//////////////iIiIiP////////
endtext
case xx=3
*question
text to m.myvar noshow
Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAACAADEDgAAxA4AAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AP////////////iP//////////////////+Ij//////////////////wCI//////////////////DwiP////////////////8P8Ij///////////////+A//CI//////////////iIgP/wiIiP//////////iIAAf/8IiIiI////////+AAH////cACIiI///////wB////////3AIiI//////B///////////cIiI////8P////////////8IiI///w//////fMf/////8IiI//j//////8zM//////8IiP+H///////MzP//////cIiPj///////fMf///////CIiH/////////////////3CIj////////8z////////wiI/////////Mf///////8IiP////////zM////////CIj////////3zM///////wiI//////fMf8zM//////8I+H/////8zM98zM/////3CP+P/////MzP/MzP////8I//h/////zP//zMz////3D///j////3x//MzH////8P////j////3zMzMf////w//////j/////////////D///////h///////////eP////////iH////////eI//////////+Ih////3iI//////////////iIiIiP////////
endtext
case xx=4
*stop
text to m.myvar noshow
Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAACAADEDgAAxA4AAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AP////////iIiIiP/////////////4iIiIiIiIj///////////iBERERGIiIj/////////gRGZmZmZERiIiP//////+BmZmZmZmZmRiIiP/////xGZmZmZmZmZmRGIiP////GZmZmZmZmZmZmZGIj///8ZmZmZmZmZmZmZmZGIj///GZmZmZmZmZmZmZmRiIj/8ZmZmfmZmZmZn5mZmRiI/xmZmZ//mZmZmf/5mZmRiP8ZmZn///mZmZ///5mZkYiPGZmZn///mZn///mZmZGIgZmZmZn///mf//+ZmZmZGIGZmZmZn//////5mZmZmRiBmZmZmZn/////mZmZmZkYgZmZmZmZn///+ZmZmZmZGIGZmZmZmZ////mZmZmZmRiBmZmZmZn/////mZmZmZkYgZmZmZmf//////mZmZmZGPGZmZmZ///5n///mZmZmRj/GZmZn///mZn///mZmZGI/xmZmf//+ZmZn///mZmRj/8ZmZmf/5mZmZn/+ZmZkf//8ZmZmfmZmZmZn5mZmRj///8ZmZmZmZmZmZmZmZGP////GZmZmZmZmZmZmZmR//////GZmZmZmZmZmZmZH///////EZmZmZmZmZmZEf////////8ZmZmZmZmZkf//////////8RGZmZmZER//////////////EREREf////////
endtext
case xx=5
*ie
text to m.myvar noshow
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
endtext
*can add others with same method
*_cliptext=strconv(filetostr(getpict()),13) and paste the content in text/endtext here
endcase
thisform.img.pictureval=strconv(m.myvar,14)
thisform.yimg=xx
ENDPROC
PROCEDURE Resize
thisform.lockscreen=.t.
with thisform.shape1
.top=.parent.img.top+.parent.img.height+1
.parent.autocenter=.t.
endwith
thisform.lockscreen=.f.
ENDPROC
PROCEDURE Init
parameters xtitle,xtext,ximg,xcolor
*!* xtitle=messagebox title
*!* xtext=messagebox texte
*!* *ximg:0,1,2,3,4,5 predefined oictures
*!* xcolor=edit1 disabledforecolor
sys(2002)
if empty(xcolor)
xcolor=rgb(0,0,0) &&0
endi
thisform.edit1.disabledForeColor=xcolor
if empty(ximg)
ximg=0
endi
thisform.ysetImg(ximg)
if empty(xtitle)
xtitle="Your messagebox title here."
endi
if len( allt(xtitle))>=42
xtitle=substr(allt(xtitle),1,42)+"..."
endi
thisform.label1.caption=xtitle
if empty(xtext)
text to xtext noshow
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac
rutrum nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst.
Nulla in iaculis nisi. Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non,
porta congue dolor. Aenean viverra auctor sagittis. Integer lobortis dignissim auctor.
Proin et volutpat massa.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac
rutrum nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst.
Nulla in iaculis nisi. Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non,
porta congue dolor. Aenean viverra auctor sagittis. Integer lobortis dignissim auctor.
Proin et volutpat mass
endtext
endi
thisform.edit1.value=xtext
retu
ENDPROC
PROCEDURE img.Click
with thisform
if .yimg<=4
.yimg=.yimg+1
else
.yimg=0
endi
.ysetImg(.yimg)
endwith
ENDPROC
PROCEDURE edit1.Init
this.disabledBackcolor=this.backcolor
this.disabledforecolor=this.forecolor
ENDPROC
PROCEDURE command1.Click
thisform.release
ENDPROC
ENDDEFINE
*
*-- EndDefine: ymessageBox
Click on code to select [then copy] -click outside to deselect
*3*
*test code as prg
**ymessagebox_com.prg class must be in same folder.
local m.myvar
text to m.myvar noshow
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac
rutrum nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst.
Nulla in iaculis nisi. Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non,
porta congue dolor. Aenean viverra auctor sagittis. Integer lobortis dignissim auctor.
Proin et volutpat massa.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac
rutrum nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst.
Nulla in iaculis nisi. Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non,
porta congue dolor. Aenean viverra auctor sagittis. Integer lobortis dignissim auctor.
Proin et volutpat mass
endtext
xtitle='Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
declare integer Sleep in kernel32 integer
local o
for i=0 to 5
o=newObject("ymessagebox","ymessagebox_com.prg","",m.xtitle,m.myvar,i,rgb(255*rand(),255*rand(),255*rand()))
o.show
endfor
Click on code to select [then copy] -click outside to deselect
*4*
*test code as form
*ymessagebox_com.prg class must be in same folder.
_screen.windowstate=1
local yform
yform=newObject("asup")
yform.show
read events
retu
*
DEFINE CLASS asup AS form
Top = 0
Left = 0
Height = 86
Width = 291
ShowWindow = 2
Caption = "test"
maxbutton=.f.
borderstyle=0
Name = "Form1"
ADD OBJECT command1 AS commandbutton WITH ;
Top = 12, ;
Left = 48, ;
Height = 61, ;
Width = 181, ;
FontBold = .T., ;
Caption = "Launch", ;
MousePointer = 15, ;
BackColor = RGB(128,255,0), ;
Name = "Command1"
PROCEDURE command1.Click
this.enabled=.f.
local m.myvar
text to m.myvar noshow
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac
rutrum nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst.
Nulla in iaculis nisi. Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non,
porta congue dolor. Aenean viverra auctor sagittis. Integer lobortis dignissim auctor.
Proin et volutpat massa.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac
rutrum nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst.
Nulla in iaculis nisi. Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non,
porta congue dolor. Aenean viverra auctor sagittis. Integer lobortis dignissim auctor.
Proin et volutpat mass
endtext
xtitle='Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
declare integer Sleep in kernel32 integer
local o
for i=0 to 5
thisform.caption="Demo:"+trans(i)+"/5"
o=newObject("ymessagebox","ymessagebox_com.prg","",m.xtitle,m.myvar,i,rgb(255*rand(),255*rand(),255*rand()))
o.show
endfor
thisform.caption="test"
this.enabled=.t.
ENDPROC
Procedure destroy
clea events
endproc
ENDDEFINE
*
*-- EndDefine: asup
/image%2F1435407%2F20151220%2Fob_05ebe8_demo1.png)
/image%2F1435407%2F20151220%2Fob_8d443e_demo2.jpg)
/image%2F1435407%2F20151221%2Fob_a3b685_demo3.jpg)
/image%2F1435407%2F20151221%2Fob_d0172a_demo1.jpg)
/image%2F1435407%2F20151221%2Fob_c76216_demo2.jpg)
/image%2F1435407%2F20151221%2Fob_94465d_demo3.jpg)
/image%2F1435407%2F20151221%2Fob_9421da_demo4.jpg)