With PowerBasic you have to program plain WinAPI (like C),
it doesnt have built-in controls and all this.
With PureBasic you can also use the WinAPI and write plain
WinAPI programs.
But, additionaly, you have some hundred commands that make
your life easier.
Example: Open a window and create a button on it.
With PureBasic it looks like this:
Code: Select all
OpenWindow(0,200,200,300,300,#PB_Window_SystemMenu,"Window")
CreateGadgetList(WindowID())
ButtonGadget(0,10,10,100,20,"Button")
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
...and this works on Amiga,Windows,Linux and future versions.
(Macintosh, AMD-64, ...we will see

)
And now the plain API way like you have to code in C, PowerBasic
and other languages that dont have build-in controls:
Code: Select all
Procedure WindowCallback(Window,Message,wParam,lParam)
Select Message
Case #WM_CLOSE
DestroyWindow_(Window)
Case #WM_DESTROY
PostQuitMessage_(0)
Result = 0
Default
Result = DefWindowProc_(Window,Message,wParam,lParam)
EndSelect
ProcedureReturn Result
EndProcedure
WindowClass.s = "MyWindowClass"
wc.WNDCLASSEX
wc\cbSize = SizeOf(WNDCLASSEX)
wc\lpfnWndProc = @WindowCallback()
wc\hCursor = LoadCursor_(0, #IDC_ARROW)
wc\hbrBackground = #COLOR_WINDOW+1
wc\lpszClassName = @WindowClass
RegisterClassEx_(@wc)
hWndMain = CreateWindowEx_(0,WindowClass,"Window",#WS_SYSMENU,200,200,300,300,0,0,0,0)
button = CreateWindowEx_(0,"Button","Button",#WS_CHILD|#WS_VISIBLE,10,10,100,20,hWndMain,0,0,0)
hFont = createfont_(8,0,0,0,0,0,0,0,0,0,0,0,0,"MS Sans Serif")
SendMessage_(button,#WM_SETFONT,hFont,1)
ShowWindow_(hWndMain, #SW_SHOWDEFAULT)
UpdateWindow_(hWndMain)
While GetMessage_( msg.MSG, #NULL, 0, 0 )
TranslateMessage_(msg)
DispatchMessage_(msg)
Wend
DeleteObject_(hFont)
Of course this works only on Windows because its plain WinAPI.
With PureBasic you have *both* ways and you can decide
yourself what you want to use.
In PowerBasic you have only plain WinAPI like in C...
Decide yourself what you want, Mortamer - its up to you...