1
Developer's Corner / New Twist on Basic
« on: April 26, 2011, 11:28 PM »
There's a new Indy Basic that I think has a lot of potential.
MiniBasic
Accesses the API, NASM, small executable, compiles resources, OOP and some COM.
Here's an example program of a modeless dialog.
MiniBasic
Accesses the API, NASM, small executable, compiles resources, OOP and some COM.
Here's an example program of a modeless dialog.
##INCLUDE "windows.inc"
##NOCONSOLE
##define IDD_DLG1 1000
##define IDC_STC1 1001
##define IDC_BTN1 1002
##define ERROR_ALREADY_EXISTS 183
@API DestroyWindow(hwnd:int),int
@API CreateDialogParamA(hInstance:int,lpTemplateName:pointer,hWndParent:int,lpDialogFunc:int,dwInitParam:int),int
WINDOW win
int hinstance,hwnd,hdialog,hicon,item
win.Open(0,0,240,180,WS_OVERLAPPEDWINDOW|WS_VISIBLE|BUFFERED|CENTERED,0,"Modeless Dialog",NULL,&handler)
win.AddControlEx("BUTTON","Click Me!",120,5,70,25,0,0,100)
hicon = ExtractIconA(hinstance,"dia2.exe",0)
SendMessageA(win.GetHandle(),WM_SETICON,0,hicon)
hinstance= GetModuleHandleA(0)
do:processmessages():until win.GetHandle()=NULL
func handler(WINDOW wnd),int
select wnd.Message
case ID_CLOSE
DestroyWindow(hdialog)
wnd.Close()
case ID_CONTROL
select wnd.ControlID
case 100
if wnd.NotifyCode = 0 and item = 0 then
hdialog = CreateDialogParamA(hinstance,IDD_DLG1,hwnd,&ToolDlgProc,0)
ShowWindow(hdialog,SW_SHOW)
item = 1
end if
end select
end select
return 0
endf
func ToolDlgProc(hwnd:int, Message:uint,wParam:int,lParam:int)
Select Message
Case WM_COMMAND
If LOWORD(wParam) = IDC_BTN1 then DestroyWindow(hdialog)
item = 0
End Select
Return 0
endf
Give it a look, there's a demo version and if you like it it's only $21.95....License includes free updates.##NOCONSOLE
##define IDD_DLG1 1000
##define IDC_STC1 1001
##define IDC_BTN1 1002
##define ERROR_ALREADY_EXISTS 183
@API DestroyWindow(hwnd:int),int
@API CreateDialogParamA(hInstance:int,lpTemplateName:pointer,hWndParent:int,lpDialogFunc:int,dwInitParam:int),int
WINDOW win
int hinstance,hwnd,hdialog,hicon,item
win.Open(0,0,240,180,WS_OVERLAPPEDWINDOW|WS_VISIBLE|BUFFERED|CENTERED,0,"Modeless Dialog",NULL,&handler)
win.AddControlEx("BUTTON","Click Me!",120,5,70,25,0,0,100)
hicon = ExtractIconA(hinstance,"dia2.exe",0)
SendMessageA(win.GetHandle(),WM_SETICON,0,hicon)
hinstance= GetModuleHandleA(0)
do:processmessages():until win.GetHandle()=NULL
func handler(WINDOW wnd),int
select wnd.Message
case ID_CLOSE
DestroyWindow(hdialog)
wnd.Close()
case ID_CONTROL
select wnd.ControlID
case 100
if wnd.NotifyCode = 0 and item = 0 then
hdialog = CreateDialogParamA(hinstance,IDD_DLG1,hwnd,&ToolDlgProc,0)
ShowWindow(hdialog,SW_SHOW)
item = 1
end if
end select
end select
return 0
endf
func ToolDlgProc(hwnd:int, Message:uint,wParam:int,lParam:int)
Select Message
Case WM_COMMAND
If LOWORD(wParam) = IDC_BTN1 then DestroyWindow(hdialog)
item = 0
End Select
Return 0
endf