Include "window.h"
SetWindow("Top Secet",800,600,w_1)
sys_mode=4
cls 0xcf8c8c8
SetFont 14,32,0,"symbol"
SetText "This is proper size of...",20, 20,rgb(0,0,200)
SetText "Courier New font -> 10,400,flag-Italic=0",20, 40,rgb(0,0,200)
SetText "Font size start at 14 which is size 8",20, 60,rgb(0,0,200)
SetFont 12,32,0,"Courier New"
SetText "Courier New standard size -> 8,400,flag-Italic=0",20, 100,rgb(0,0,0)
SetFont 13,32,0,"times"
SetText "Times New standard size -> 9,400,flag-Italic=0",20, 120,rgb(200,0,0)
SetFont 14,32,0,""
SetText "Standard New standard size -> 10,400,flag-Italic=0",20, 140,rgb(0,0,200)
SetFont 15,32,0,"system"
SetText "System New standard size -> 11,400,flag-Italic=1",20, 160,rgb(0,140,0)
DoEvents
SwapBuffers
Pause
WinEnd
Type WNDCLASSEX
cbSize as long
Style as long
lpfnwndproc as long
cbClsextra as long
cbWndExtra as long
hInstance as long
hIcon as long
hIconSm as long
hCursor as long
hbrBackground as long
lpszMenuName as long
lpszClassName as long
End Type
Type WNDCLASS
Style as sys
lpfnwndproc as sys
cbClsextra as sys
cbWndExtra as sys
hInstance as sys
hIcon as sys
hCursor as sys
hbrBackground as sys
lpszMenuName as sys
lpszClassName as sys
End Type
Type Point
x as sys
y as sys
End Type
Type MSG
hwnd as sys
message as sys
wParam as sys
lParam as sys
time as sys
pt as sys
End Type
Type RECT
Left as sys
Top as sys
Right as sys
Bottom as sys
End Type
% IDI_APPLICATION= 32512
% CS_DBLCLKS = 8
% SW_NORMAL = 1
% SW_SHOWDEFAULT = 10
% SW_SHOW = 5
% CS_VREDRAW = 1
% CS_HREDRAW = 2
% CS_OWNDC = 32
% SM_CXSCREEN = 0
% SM_CYSCREEN = 1
% IDI_WINLOGO = 32517
% IDC_ARROW = 32512
% WM_CREATE = 1
% WM_DESTROY = 2
% WM_PAINT = 15
% WM_QUIT = 18
% WM_SIZE = 5
% WM_MOVE = 3
% WM_CHAR = 258
% WM_KEYDOWN = 256
% WM_KEYUP = 257
% WM_MOUSEMOVE = 512
% WM_MBUTTONDOWN = 519
% WM_LBUTTONDOWN = 513
% WM_RBUTTONDOWN = 516
% WM_LBUTTONUP = 514
% WM_RBUTTONUP = 517
% WM_MBUTTONUP = 520
% WS_OVERLAPPEDWINDOW = 0x00cf0000
% WS_SYSMENU = 524288
% WS_OVERLAPPED = WS_SYSMENU
% WS_POPUP = 0x80000000
% WS_DLGFRAME = 0x400000
% WHITE_BRUSH = 0
% BLACK_BRUSH = 4
Declare Function SetTextColor Lib "gdi32.dll" (ByVal hdc As Long, ByVal crColor As Long) As Long
Declare Function TextOut Lib "gdi32.dll" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Declare Function DestroyWindow Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function SetBkColor Lib "gdi32.dll" (ByVal hdc As Long, ByVal crColor As Long) As Long
Declare Function SetBkMode Lib "gdi32.dll" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Long) As Long
Declare Function GetStockObject Lib "gdi32.dll" (ByVal nIndex As Long) As Long
Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Declare Function GetSystemMetrics Lib "user32.dll" (ByVal nIndex As Long) As Long
Declare Function ValidateRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT) As Long
Declare Function InvalidateRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT, ByVal bErase As Long) As Long
Declare Function DefWindowProc Lib "user32.dll" Alias "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, ByRef lpParam As Any) As Long
Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function DispatchMessage Lib "user32.dll" Alias "DispatchMessageA" (ByRef lpMsg As MSG) As Long
Declare Function TranslateMessage Lib "user32.dll" (ByRef lpMsg As MSG) As Long
Declare Function GetMessage Lib "user32.dll" Alias "GetMessageA" (ByRef lpMsg As MSG, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Declare Function RegisterClass Lib "user32.dll" Alias "RegisterClassA" (ByRef Class As WNDCLASS) As Long
Declare Function RegisterClassEx Lib "user32.dll" Alias "RegisterClassExA" (ByRef pcWndClassEx As WNDCLASSEX) As Long
Declare Function LoadCursor Lib "user32.dll" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As String) As Long
Declare Function LoadIcon Lib "user32.dll" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As String) As Long
Declare Function GetCommandLine Lib "kernel32.dll" Alias "GetCommandLineA" () As String
Declare Function GetModuleHandle Lib "kernel32.dll" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Declare Function Beep Lib "kernel32.dll" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
Declare Function GetPixel Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Declare Function SetPixel Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Declare Function Rectangle Lib "gdi32.dll" Alias "Rectangle" (ByVal hdc As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As Long
Declare Sub ExitProcess Lib "kernel32.dll" (ByVal uExitCode As Long)
Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Declare Sub PostQuitMessage Lib "user32.dll" (ByVal nExitCode As Long)
sys wx, wy, ww, wh, scr, inst, sys_hwnd, sys_hdc, caption, style
Dim wdx as WNDCLASSEX
Dim wm as MSG
String s = "SIMPLE WINDOW"
Function HiWord(sys high) as sys
shr high,16
Return high
End Function
Function LoWord(sys low) as sys
and low,&hFFFF
Return low
End Function
Function WndProc(sys hWnd, wMsg, wParam, lparam) as long callback
iF wMsg = WM_CREATE
'
ElseiF wMsg = WM_PAINT
SetBkMode sys_hdc,1
SetTextColor sys_hdc,255
TextOut sys_hdc,240,200,s,Len(s)
SetTextColor sys_hdc,0x008000
TextOut sys_hdc,240,212,s,Len(s)
ValidateRect hwnd, 0
'
ElseiF wMsg = WM_DESTROY
PostQuitMessage 0
Else
Function = DefWindowProc hWnd,wMsg,wParam,lParam
End iF
End Function
inst = GetModuleHandle 0
wdx.cbSize = sizeof(WNDCLASSEX)
wdx.style = CS_DBLCLKS
wdx.lpfnWndProc = &WndProc
wdx.cbClsExtra =0
wdx.cbWndExtra =0
wdx.hInstance = inst
wdx.hIcon=LoadIcon 0,IDI_APPLICATION
wdcx.hIconSm=LoadIcon 0,IDI_APPLICATION
wdx.hCursor=LoadCursor 0,IDC_ARROW
wdx.hbrBackground = 1
wdx.lpszMenuName = caption
wdx.lpszClassName ="Winx"
RegisterClassEx (@wdx)
scr = GetSystemMetrics SM_CXSCREEN
wx = (scr - 640) /2
Scr = GetSystemMetrics SM_CYSCREEN
wy = (scr - 480) /2
sys_hwnd = CreateWindowEx 0, wdx.lpszClassName, caption, style, wx, wy, ww, wh, 0, 0, inst, 0
ShowWindow sys_hwnd, SW_SHOW
sys_hdc = GetDC(sys_hwnd)
While GetMessage &wm,0,0,0
iF wm.message = Wm_Quit
ReleaseDC sys_hwnd,sys_hdc
DestroyWindow sys_hwnd
ExitProcess 0
End iF
TranslateMessage &wm
DispatchMessage &wm
Wend
Function SetWindow (byval caption as string ,byval Wx as int,byval Wy as int, byval Ww as int, byval Wh as int, byval wparent as int, byval style as int) as int
inst = GetModuleHandle 0
'wcx.cbSize = sizeof(WNDCLASSEX)
wcx.style = CS_DBLCLKS
wcx.lpfnWndProc = &WndProc
wcx.cbClsExtra =0
wcx.cbWndExtra =0
wcx.hInstance = inst
wcx.hIcon=LoadIcon 0,IDI_APPLICATION
'wcx.hIconSm=LoadIcon 0,IDI_APPLICATION
wcx.hCursor=LoadCursor 0,IDC_ARROW
wcx.hbrBackground = 1
wcx.lpszMenuName = strptr caption
wcx.lpszClassName = strptr "Winx"
RegisterClass &wcx
Ok Kent...
I see ...Ubuntu...ha, i never liked this distro.. ::).
I use SliTaz and Slax. ;D
It works perfectlyOf course ....when is created by native api-s and Vine work ok with native api functions.
Of course ....when is created by native api-s and Vine work ok with native api functions.
If all gooes well i have in plan to create my own fork of SliTaz,
i have one friend here in Croatia who is interested .
This is just proof that Linus is selfish and ignorant freak who don't know how to built GUI subsystem inside kernel.
Hmmm...what's left...yeah...Listview..ok
Using awinh is a piece of cacke to create RichEdit based text editor...
$ Filename "simple.exe" ' Oxygen Basic
Include "RTL32.inc"
Include "awinh.inc"
#lookahead
'GLOBALS for drawing to DC /// also caN BE INSIDE INCLUDE FILE //
INT hdc, hdcMem, hbmMem, oldBmp, oldBrush, oldPen, oldFont, fColor,bColor
INT textX,textY,hBrush
INT ww,hh
INT win,x=0,y=0,w=400,h=300,wstyle = WS_MINMAXSIZE,
win=SetWindow("Simple GUI App...",x,y,w,h,0,wstyle)
InitDrawing(win)
TextOn(win,100,100, "Hello World from BCX!")
Wait() 'message loop
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
Select hwnd
Case win
Select wmsg
CASE WM_PAINT
BitBlt(hDC, 0, 0, ww, hh, hdcMem, 0, 0, SRCCOPY)
Case WM_CLOSE
CloseWindow(win)
EndProgram
End Select
End Select
Return Default
End Function
'====================================================
'== NEXT BLOCK OF CODE YOU CAN PUT IN INCLUDE FILE ==
'====================================================
SUB InitDrawing(byval wnd as INT)
'INT ww,hh
''get current size of window
GetSize(wnd,0,0,ww,hh)
'get window DC
hdc=GetDC(wnd)
hdcMem = CreateCompatibleDC(0)
hbmMem = CreateCompatibleBitmap(hdc, ww, hh)
oldBmp = SelectObject( hdcMem, hbmMem )
oldBrush = SelectObject(hdcMem, CreateSolidBrush( RGB(231,223,231)) )
oldPen = SelectObject(hdcMem, CreatePen(PS_SOLID,1,RGB(231,223,231)))
'fill rectangle memDC with brush color
FillRect ( hdcMem,rc, oldBrush)
SetTextColor( hDC,RGB(0,0,0))
SetBkColor( hDC, RGB(231,223,231))
'blit to memDC
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wnd, hdc)
End SUB
'=================================================
SUB TextColor (wID as INT,byval frontColor as sys)
hdc = GetDC(wID)
sys bColor
fColor=frontColor
bColor = RGB(231,223,231)
SetTextColor( hDC, frontColor)
SetBkColor( hDC, bColor)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'=================================================
Sub TextOn( int wnd,sys x, y, string txt)
'INT ww,hh
hdc=GetDC(wnd)
GetSize(wnd,0,0,ww,hh)
TextOut sys_hdc,x,y,txt,Len(txt)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC(wnd,Hdc)
End Sub
'=================================================
SUB LineXY (wID as INT,Lx as INT,Ly as INT,Lx1 as INT,Ly1 as INT)
hdc = GetDC(wID)
GetSize(wID,0,0,ww,hh)
SelectObject(hdc, CreatePen(PS_SOLID,1,fColor))
MoveToEx hdc,Lx,Ly,Byval 0
LineTo hdc,Lx1,Ly1
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'=================================================
SUB Pset (wID as int , px as int ,py as int)
hdc = GetDC(wID)
'GetSize(wID,0,0,ww,hh)
SetPixel ( hdc, px, py, fColor)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'//////////////////////////////////////////////
SUB CleanUp
DeleteDC(hdcMem)
DeleteObject(SelectObject(hdcMem, oldBrush))
DeleteObject(SelectObject(hdcMem, oldPen))
DeleteObject(SelectObject(hdcMem, oldBmp))
End SUB
$ Filename "simple2.exe" ' Oxygen Basic
Include "RTL32.inc"
Include "awinh.inc"
Include "minih.inc"
#lookahead
INT win,x=0,y=0,w=400,h=300,wstyle = WS_MINMAXSIZE,
win=SetWindow("Simple GUI App...",x,y,w,h,0,wstyle)
InitDrawing(win)
TextOn(win,100,100, "Hello World from Oxygen!")
Wait() 'message loop
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
Select hwnd
Case win
Select wmsg
CASE WM_PAINT
BitBlt(hDC, 0, 0, ww, hh, hdcMem, 0, 0, SRCCOPY)
Case WM_CLOSE
CloseWindow(win)
EndProgram
End Select
End Select
Return Default
End Function
$ Filename "simple2.exe" ' Oxygen Basic
Include "RTL32.inc"
Include "awinh.inc"
Include "minih.inc"
#lookahead
INT win,x=0,y=0,w=400,h=300,wstyle = WS_MINMAXSIZE,
win=SetWindow("Simple GUI App...",x,y,w,h,0,wstyle)
InitDrawing(win)
TextColor (win,RGB(0,120,220))
TextOn(win,100,100, "Hello World from OXYGEN!")
Wait() 'message loop
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
Select hwnd
Case win
Select wmsg
CASE WM_PAINT
BitBlt(hDC, 0, 0, ww, hh, hdcMem, 0, 0, SRCCOPY)
Case WM_CLOSE
CloseWindow(win)
EndProgram
End Select
End Select
Return Default
End Function