Source / code snippets | | | | - Page 1 - |
| | Andreas Miethe, URL=www.paules-pc-forum.de/forum/special/123967-messagebox-with-option.html#mail754182, ZEITPUNKT=26.12.2009
Messagebox with option an small Spielerei with of/ one Messagebox and one Hook. Perhaps kanns Yes someone use. $H windows.ph
$H Messages.ph
#############################
Messagebox-Konstanten
DEF &IDOK 1
DEF &IDCANCEL 2
DEF &IDABORT 3
DEF &IDRETRY 4
DEF &IDIGNORE 5
DEF &IDYES 6
DEF &IDNO 7
DEF &IDICON 20
DEF &IDPROMPT $FFFF
DEF &IDSTATIC $CAFE
#############################
Struct CWPSTRUCT = lParam&,wParam&,message&,hwnd&
Struct Rect = left&,top&,right&,bottom&
Declare Hook&,OldProc&
Declare B&,B1&
Proc MB
Parameters wnd&,msg&,wparam&,lparam&
Declare Result&
select msg&
Caseof ~WM_INITDIALOG
Var Rect# = New(Rect)
~GetWindowRect(wnd&,Rect#)
~Movewindow(wnd&,Rect#.left&,rect#.top&,width(wnd&)+12,Height(wnd&)+40,1)
B& = Create("CheckBox",wnd&,"Diese Message not again anzeigen",0,height(wnd&)-18,width(wnd&),18)
SendMessage(B&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
SendMessage(~GetDlgItem(wnd&,&IDICON),~STM_SETIMAGE,~IMAGE_ICON,~LoadIcon(%hInstance,"EIMER"))
Result& = 1
Caseof ~WM_COMMAND
If lparam& = b&
If Getcheck(B&)
B1& = 1
Endif
Endif
Caseof ~WM_NCDESTROY
~UnhookWindowsHookEx(Hook&)
Result& = 1
Endselect
Result& = ~CallWindowProc(OldProc&,wnd&,msg&,wparam&,lparam&)
Return Result&
Endproc
Proc SetHook
Parameters nCode&, wParam&, lParam&
Select nCode&
Caseof ~HC_ACTION
Var pw# = New(CWPSTRUCT)
pw# = lparam&
If pw#.message& = ~WM_INITDIALOG
OldProc& = ~SetWindowlong(pw#.hwnd&,~GWL_WNDPROC,ProcAddr("MB",4))
Endif
EndSelect
Return ~CallNextHookEx(Hook&, nCode&, wParam&, lParam&)
ENDPROC
Proc PRF_Messagebox
Set("Fastmode",1)
Parameters body$, title$, flags&
Declare Result&
Flags& = Flags& | ~MB_ICONQUESTION
Hook& = ~SetWindowsHookEx(~WH_CALLWNDPROC, ProcAddr("SetHook",3), 0,~GetCurrentThreadId())
Result& = MessageBox(title$,body$, flags&)
Set("Fastmode",0)
Return Result&
ENDPROC
cls
Print PRF_Messagebox("Titel","Wirklich delete ? ",~MB_YESNO)
Print IF(B1&=1,"Nicht again anzeigen","wieder anzeigen")
Waitinput
greeting Andreas
too very beautiful with Hyperlinks: [...]
Andreas Miethe, Beitrag=55999, Zeitpunkt=06.02.2010
Per Hook goes a crowd $H windows.ph
$H Messages.ph
Struct CWPSTRUCT = lParam&,wParam&,message&,hwnd&
Struct Rect = left&,top&,right&,bottom&
#############################
Messagebox-Konstanten
DEF &IDOK 1
DEF &IDCANCEL 2
DEF &IDABORT 3
DEF &IDRETRY 4
DEF &IDIGNORE 5
DEF &IDYES 6
DEF &IDNO 7
DEF &IDHELP 9
DEF &IDTRYAGAIN 10
DEF &IDCONTINUE 11
DEF &IDICON 20
DEF &IDPROMPT $FFFF
DEF &IDSTATIC $CAFE
#############################
Proc MB
Parameters wnd&,msg&,wparam&,lparam&
Declare Result&,W&,H&,b&
Result& = ~CallWindowProc(OldProc&,wnd&,msg&,wparam&,lparam&)
select msg&
Caseof ~WM_INITDIALOG
Var SRect# = New(Rect)
~GetWindowRect(wnd&,SRect#)
dialog vergrössern and Center
W& = SRect#.right& - SRect#.left&
H& = SRect#.bottom& -SRect#.top& + 40
~Movewindow(wnd&,((%maxx/2)-(W&/2)),((%maxy/2)-(H&/2)),W&,H&,1)
positions the Controls 40 Pixel to untern verchieben
~Getwindowrect(~GetDlgItem(wnd&,&IDSTATIC),SRect#)
~Mapwindowpoints(0,wnd&,SRect#,2)
~Movewindow(~GetDlgItem(wnd&,&IDSTATIC),0,SRect#.Top&+40,SRect#.Right&,SRect#.Bottom&,1)
Whileloop 1,11
If ~IsWindow(~GetDlgItem(wnd&,&Loop))
~Getwindowrect(~GetDlgItem(wnd&,&Loop),SRect#)
~Mapwindowpoints(0,wnd&,SRect#,2)
~Setwindowpos(~GetDlgItem(wnd&,&Loop),0,SRect#.Left&,SRect#.Top&+40,0,0,~SWP_NOSIZE | ~SWP_NOZORDER)
Endif
Endwhile
position of PROMPT fetch
~Getwindowrect(~GetDlgItem(wnd&,&IDPROMPT),SRect#)
~Mapwindowpoints(0,wnd&,SRect#,2)
LINKS under PROMPT lay out
Link& = Control("SysLink","<a>Besuch my Homepage</a>",$50000000,SRect#.Left&,SRect#.Bottom&+10,width(wnd&),18,wnd&,4000,0,0)
SendMessage(Link&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
Mail& = Control("SysLink","<a>Schick me Mail</a>",$50000000,SRect#.Left&,SRect#.Bottom&+30,width(wnd&),18,wnd&,4001,0,0)
SendMessage(Mail&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
Dispose SRect#
Result& = 1
Caseof ~WM_NOTIFY
Link inquire
If (Long(lparam&,8) = -2) and (Long(lParam&,0) = LINK&)
ShellExec("https://www.ampsoft.eu","open",~SW_SHOWNORMAL)
endif
If (Long(lparam&,8) = -2) and (Long(lParam&,0) = Mail&)
ShellExec("Mailto://","open",~SW_SHOWNORMAL)
endif
Result& = 1
Caseof ~WM_NCDESTROY
~UnhookWindowsHookEx(Hook&)
Result& = 1
Endselect
Return Result&
Endproc
Proc SetHook
Parameters nCode&, wParam&, lParam&
Select nCode&
Caseof ~HC_ACTION
Var pw# = New(CWPSTRUCT)
pw# = lparam&
If pw#.message& = ~WM_INITDIALOG
OldProc& = ~SetWindowlong(pw#.hwnd&,~GWL_WNDPROC,ProcAddr("MB",4))
Dispose pw#
Endif
EndSelect
Return ~CallNextHookEx(Hook&, nCode&, wParam&, lParam&)
ENDPROC
Proc PRF_Messagebox
Set("Fastmode",1)
Parameters body$, title$, flags&
Declare Result&
Hook& = ~SetWindowsHookEx(~WH_CALLWNDPROC, ProcAddr("SetHook",3), 0,~GetCurrentThreadId())
Result& = MessageBox(title$,body$, flags&)
Set("Fastmode",0)
Return Result&
ENDPROC
here GEHTS go
Declare Hook&,OldProc&
Declare LINK&,Mail&
cls
Print PRF_Messagebox("Eine question...","Wirklich delete ?",~MB_YESNOCANCEL | ~MB_DEFBUTTON2 | ~MB_ICONQUESTION | ~MB_APPLMODAL)
Waitinput
|
| | | | |
| | | | | - Page 1 - |
| Andreas Miethe
| Jörg Sellmeyer, Beitrag=55605, Zeitpunkt=27.12.2009
Very beautiful! by me becomes though, instead of the Textes in the Checkbox, only one schwarzer beam displayed. is really your ~DeleteObject() something other as the profane or could one too simply DeleteObject h& use?
Related to the black beam understand I do not, I habs Yes extra XP tested and fotografiert.
~DeleteObject() or profanes DeleteObject is well the same. |
| | | Gruss Andreas ________ ________ ________ ________ _ Profan 3.3 - XProfanX2 Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher Homepage : [...] | 12/27/09 ▲ |
| |
| | | H.Brill, Beitrag=55597, Zeitpunkt=27.12.2009
iF: EndProcedure in the code changed in ENDPROC.
Programmierste stereo -> PureBasic + XProfan ?
So I Have no PB and custom too keins in order to know, that EndProcedure well one ENDPROC had go should. ^^ |
| | | | |
| | Frank Abbing | whom black beam can I confirm. |
| | | | |
| | Jörg Sellmeyer | so sees the then from:
|
| | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 12/27/09 ▲ |
| |
| | | | - Page 2 - |
| | Rolf Koch | How always The Manifesto, which this black beam attend can! |
| | | | |
| | Jörg Sellmeyer | With me is Profan no Manifesto-File. |
| | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 12/28/09 ▲ |
| |
| | Dieter Zornow | | | | Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2 | 12/28/09 ▲ |
| |
| | Andreas Miethe
| | | | Gruss Andreas ________ ________ ________ ________ _ Profan 3.3 - XProfanX2 Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher Homepage : [...] | 12/28/09 ▲ |
| |
| | Jörg Sellmeyer | | | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 12/28/09 ▲ |
| |
| | Paul Glatz | How is it possible whom Text the Buttons To Change? |
| | | | |
| | | well at the latest z.B. with FindWindowEx Buttons find weils The Params allows and so many Buttons ne MSG-Box not has but GetDlgItem goes certainly too... and then hold SetText. |
| | | | |
| | Paul Glatz | I see. in the bunteren example is the Text Yes yellow how can I it another colour give?
EDIT: whom Text the Yes Buttons Change: settext ~GetDlgItem(wnd&,&IDYES),"t1" |
| | | | |
|
Zum QuelltextTopic-Options | 12.593 Views |
Themeninformationenthis Topic has 9 subscriber: |