using dialog resources in PB
Posted: Thu Sep 29, 2005 2:24 pm
ts-soft posted an example of how to use
(dialog) resources in PB on german forum .
you can find the thread here:
http://forums.purebasic.com/german/viewtopic.php?t=4188
dialog.rc
pb source: (sorry for german comments, but i am lazy)
and a demo by fgk:

download:
http://home.tiscali.de/pbsource/PB_Stuf ... EdDemo.exe
the best dialog / resource editor we found seens ResEd.
download: http://radasm.visualassembler.com/projects/ResEd.zip (written in MASM with source code)
after some tests playing with the dialog editor i created an
example how to use the "custom-controls" that can be found
at http://radasm.visualassembler.com/:

source:
http://rzserv2.fhnon.de/~lg016586/downl ... ogTest.zip
then i modified the original ResEd to export the resource names as
PB constants.

you can download this modified version of ResEd at:
http://rzserv2.fhnon.de/~lg016586/downl ... modded.exe (i will release modified source in some hours/days /EDIT: PureBasic is now supported in official release of ResEd)
thanks @ts-soft and @fgk for the thread on german forum.
i hope this info is interesting for someone here, too.
it's an good alternative (at least for me) to the windows created with the
visual designers.
(dialog) resources in PB on german forum .
you can find the thread here:
http://forums.purebasic.com/german/viewtopic.php?t=4188
dialog.rc
Code: Select all
// Einfache AboutBox für PureBasic
// by TS-Soft
1000 DIALOG 0, 0, 109, 52
LANGUAGE LANG_NEUTRAL, 0
STYLE DS_CENTER | DS_MODALFRAME | DS_SETFONT | WS_BORDER | WS_DLGFRAME | WS_POPUP | WS_SYSMENU | WS_VISIBLE
FONT 9, "Arial"
CAPTION "Über..."
BEGIN
CONTROL "PureBasic 3.94 Beta 4 Feel the ...Pure... Power", 1001, "Static", WS_GROUP | WS_VISIBLE, 19, 7, 102, 20
CONTROL "&Okay", 1002, "Button", BS_BOTTOM | BS_CENTER | BS_DEFPUSHBUTTON | BS_TOP | WS_MAXIMIZEBOX | WS_VISIBLE, 35, 30, 50, 15
END
Code: Select all
; Simples Beispiel für eine AboutBox als Resource
; erstellt von TS-Soft
;/############################################################################
Procedure GetResDialog(DialogId, *DialogProcedure)
ProcedureReturn DialogBoxParam_(GetModuleHandle_(0), DialogId, 0, *DialogProcedure, 0)
EndProcedure
;/############################################################################
;/ Deklaration von Konstanten
; #define IDD_DLG1 1000
; #define IDC_LBL1 1001
; #define IDC_BTN1 1002
#IDD_DLG1 = 1000
#IDC_LBL1 = 1001
#IDC_BTN1 = 1002
; Beispiel einer DialogProcedure
Procedure DlgProc(hDlg, uMsg, wParam, lParam)
Select uMsg
Case #WM_INITDIALOG
MessageBeep_(#MB_ICONINFORMATION)
Case #WM_CLOSE
EndDialog_(hDlg, 0)
Case #WM_COMMAND
ID = wParam & $FFFF
Select ID
Case #IDC_BTN1
EndDialog_(hDlg, #IDC_BTN1) ; 1002 als Rückgabewert bei okay
EndSelect
EndSelect
EndProcedure
; Aufruf der DialogResource
Select GetResDialog(#IDD_DLG1, @DlgProc())
Case 0
MessageRequester("Dialog-Test", "Dialog wurde geschlossen")
Case #IDC_BTN1
MessageRequester("Dialog-Test", "Benutzer hat Okay gedrückt zum beenden")
EndSelect

download:
http://home.tiscali.de/pbsource/PB_Stuf ... EdDemo.exe
the best dialog / resource editor we found seens ResEd.
download: http://radasm.visualassembler.com/projects/ResEd.zip (written in MASM with source code)
after some tests playing with the dialog editor i created an
example how to use the "custom-controls" that can be found
at http://radasm.visualassembler.com/:

source:
http://rzserv2.fhnon.de/~lg016586/downl ... ogTest.zip
then i modified the original ResEd to export the resource names as
PB constants.

you can download this modified version of ResEd at:
http://rzserv2.fhnon.de/~lg016586/downl ... modded.exe (i will release modified source in some hours/days /EDIT: PureBasic is now supported in official release of ResEd)
thanks @ts-soft and @fgk for the thread on german forum.
i hope this info is interesting for someone here, too.
it's an good alternative (at least for me) to the windows created with the
visual designers.