Here is what PluriBASIC generates for 32bits:
'Generated with PluriBASIC 6.0.123201.0
$ filename "C:\Users\Diamante\Documents\PluriBASIC\projects\ListViewExample.exe"
uses rtl32
MACRO _10ONERR(l, e)
Err.err = e
IF (Err.err>0) THEN
Err.ers = Err.erp
Err.erl = l
IF Err.Oe1 THEN
JMP Err.Oe1
ELSEIF Err.Oe2 THEN
CALL Err.Oe2
END IF
else
Err.ers = ""
Err.erl = 0
END IF
END MACRO
MACRO ERRCLEAR
Err.err = 0
Err.erl = 0
Err.ers = ""
END MACRO
CLASS _10SYSERR
public sys Oe1 = 0
public sys Oe2 = 0
public int err = 0
public int erl = 0
public string erp = ""
public string ers = ""
END CLASS
DECLARE function _10InitCommonControlsEx lib "Comctl32.dll" alias "InitCommonControlsEx"
TYPE _10INITCOMMONCONTROLSEX
DWORD dwSize
DWORD dwICC
END TYPE
_10INITCOMMONCONTROLSEX _10ICCE
_10ICCE.dwSize = sizeof(_10INITCOMMONCONTROLSEX)
_10ICCE.dwICC = 0xffff
_10InitCommonControlsEx(&_10ICCE)
TYPE _10RECT
long left
long top
long right
long bottom
END TYPE
DECLARE FUNCTION _10GetParent LIB "USER32.DLL" ALIAS "GetParent" (BYVAL hWnd AS SYS) AS SYS
DECLARE FUNCTION _10GetDC LIB "USER32.DLL" ALIAS "GetDC" (BYVAL hWnd AS SYS) AS SYS
DECLARE function _10GetStockObject lib "GDI32.DLL" alias "GetStockObject"
DECLARE function _10GetSystemMetrics lib "USER32.DLL" ALIAS "GetSystemMetrics"
DECLARE function _10GetDeviceCaps lib "GDI32.DLL" alias "GetDeviceCaps" (byval hdc as sys, byval nIndex as int) as int
DECLARE function _10ReleaseDC lib "USER32.DLL" alias "ReleaseDC" (byval hWnd as sys, byval hDC as sys) as INT
Declare Function _10CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (byval dwExStyle AS INT,byval lpClassName AS STRING,byval lpWindowName AS STRING,byval dwStyle AS INT,byval x AS INT,byval y AS INT,byval nWidth AS INT,byval nHeight AS INT,byval hWndParent AS INT,byval hMenu AS INT,byval hInstance AS INT,byval lpParam AS INT) as INT
Declare Function _10CreateSolidBrush Lib "gdi32.dll" Alias "CreateSolidBrush"(ByVal crColor As INT) As INT
Declare Function _10GetSysColor Lib "user32.dll" Alias "GetSysColor" (ByVal nIndex As INT) As INT
Declare Function _10LoadIcon Lib "user32.dll" Alias "LoadIconA" (ByVal hInstance As INT, ByVal lpIconName As Any) As INT
Declare Function _10LoadCursor Lib "user32.dll" Alias "LoadCursorA" (ByVal hInstance As INT, ByVal lpCursorName As Any) As INT
Declare Function _10GetModuleHandle Lib "kernel32.dll" Alias "GetModuleHandleA" (int lpModuleName) as SYS
Declare Function _10CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" (byval hProc as sys, ByVal hWnd As INT, ByVal wMsg As INT, ByVal wParam As INT, ByVal lParam As INT) As INT
Declare Function _10DefWindowProc Lib "user32.dll" Alias "DefWindowProcA" (ByVal hWnd As INT, ByVal wMsg As INT, ByVal wParam As INT, ByVal lParam As INT) As INT
Declare Function _10DefWindowProcCallBack Lib "user32.dll" Alias "DefWindowProcA" (ByVal hWnd As INT, ByVal wMsg As INT, ByVal wParam As INT, ByVal lParam As INT) As INT
Declare Function _10GetSysColor Lib "user32.dll" Alias "GetSysColor" (ByVal nIndex As INT) As INT
Declare Function _10GetDialogBaseUnits LIB "User32.dll" ALIAS "GetDialogBaseUnits" () AS INT
Declare Function _10MulDiv LIB "KERNEL32.DLL" ALIAS "MulDiv" (BYVAL nNumber AS INT, BYVAL nNumerator AS INT, BYVAL nDenominator AS INT) AS INT
Declare Function _10MapDialogRect LIB "user32.DLL" ALIAS "MapDialogRect" (ByVal hWnd As SYS, Byref RC AS _10RECT) AS SYS
Declare Function _10GetDesktopWindow LIB "user32.DLL" ALIAS "GetDesktopWindow" () AS SYS
Declare Function _10GetLastError LIB "Kernel32.DLL" ALIAS "GetLastError" () AS SYS
Declare Function _10FormatMessage LIB "Kernel32.dll" ALIAS "FormatMessageA" (BYVAL dwFlags AS DWORD, BYVAL lpSource AS DWORD, BYVAL dwMessageId AS DWORD, BYVAL dwLanguageId AS DWORD, lpBuffer AS ASCIIZ, BYVAL nSize AS DWORD, BYVAL Arguments AS DWORD) AS DWORD
DECLARE FUNCTION _10CreateDialogIParam LIB "user32.dll" ALIAS "CreateDialogIndirectParamA" (sys hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit) as sys
DECLARE SUB _10PostQuitMessage LIB "User32.dll" ALIAS "PostQuitMessage"
DECLARE SUB _10DestroyWindow LIB "User32.dll" ALIAS "DestroyWindow"
DECLARE FUNCTION _10GetDlgItem LIB "User32.dll" ALIAS "GetDlgItem" (BYVAL hDlg AS SYS, BYVAL nIDDlgItem AS sys) AS SYS
DECLARE FUNCTION _10SetProp Lib "user32.dll" Alias "SetPropA" (ByVal hWnd As SYS, BYVAL lpString As DWORD, BYVAL hAddr AS DWORD) AS SYS
DECLARE FUNCTION _10GetProp Lib "user32.dll" Alias "GetPropA" (ByVal hWnd As SYS, BYVAL lpString As DWORD) AS SYS
DECLARE FUNCTION _10RemoveProp Lib "user32.dll" Alias "RemovePropA" (ByVal hWnd As SYS, BYVAL lpString As DWORD) AS SYS
'DECLARE FUNCTION _10GetProcessHeap Lib "kernel32.dll" Alias "GetProcessHeap" () As SYS
'DECLARE FUNCTION _10HeapAlloc Lib "kernel32.dll" Alias "HeapAlloc" (ByVal hProc As DWORD, ByVal mMode As dword, byval mSize as DWORD) AS SYS
'DECLARE FUNCTION _10HeapFree Lib "kernel32.dll" Alias "HeapFree" (ByVal hProc As DWORD, ByVal mMode As dword, byval hObj as DWORD) AS SYS
TYPE _10DLGTEMPLATE
dword style
dword eStyle
word cdit
short x
short y
short cx
short cy
END TYPE
_10RECT _10RC
sys _10LPPI = 0
SYS _10HPPA = 0
_10DLGTEMPLATE _10LPDT
_10LPDT.style = 2155872320
_10LPDT.eStyle = 1
_10LPDT.cdit = 0
_10LPDT.x = 1
_10LPDT.y = 1
_10LPDT.cx = 2
_10LPDT.cy = 2
' Create a dummy dialog to retrieve dialog units.
sys _10TODL = _10CreateDialogIParam(_10GetModuleHandle(0), @_10LPDT, _10HPPA, @_10DEFAULT_CALLBACK_PROC, _10LPPI)
_10RC.right = 1
_10RC.bottom = 1
_10MapDialogRect(_10TODL, _10RC) ' returns 0
TYPE _10WNDCLASSEX ' 32 bit headers for use with DIALOG NEW
cbSize as int
Style as int
lpfnwndproc as sys
cbClsextra as int
cbWndExtra as int
hInstance as int
hIcon as int
hCursor as int
hbrBackground as int
lpszMenuName as int
lpszClassName as int
hIconSm AS int
END TYPE
Declare Function _10RegisterClassEx Lib "user32.dll" Alias "RegisterClassExA" (byref lpwcx as _10WNDCLASSEX) as INT
_10WNDCLASSEX _10WClass
_10WClass.cbSize = SizeOf(_10WNDCLASSEX)
_10WClass.style = 40
_10WClass.lpfnWndProc = &_10DefWindowProcCallBack
_10WClass.hInstance = _10GetModuleHandle(0)
_10WClass.hIcon = _10LoadIcon(0, ByVal 32512) 'loads an icon for use by the program
_10WClass.hCursor = _10LoadCursor(0, ByVal 32512) 'loads a mouse cursor for use by the program
_10WClass.hbrBackground = _10CreateSolidBrush(_10GetSysColor(15))
_10WClass.lpszMenuName = STRPTR("")
_10WClass.lpszClassName = STRPTR("DDTDialog")
_10WClass.hIConSm = _10LoadIcon(0, ByVal 32512) 'loads an icon for use by the program
Call _10RegisterClassEx(_10WClass) 'registers a window class for the program window
'print _10RC.right " - " _10RC.bottom
Declare Function PluriBASICMessageBox Lib "user32.dll" Alias "MessageBoxA"
TYPE _10MSG
hwnd as int
message as int
wParam as int
lParam as int
time as dword
'part of pointapi.
X as INT
Y as INT
END TYPE
Declare Function _10ShowWindow Lib "user32.dll" Alias "ShowWindow" (ByVal hWnd As INT, ByVal nCmdShow As INT) As INT
Declare Function _10TranslateMessage Lib "user32.dll" Alias "TranslateMessage" (byref lpMsg as _10MSG) as INT
Declare Function _10DispatchMessage Lib "user32.dll" Alias "DispatchMessageA" (byref lpMsg as _10MSG) as INT
Declare Function _10GetMessage Lib "user32.dll" Alias "GetMessageA" (lpMsg As _10MSG, ByVal hWnd As INT, ByVal wMsgFilterMin As INT, ByVal wMsgFilterMax As INT) As INT
DECLARE FUNCTION _10IsWindow LIB "USER32.DLL" ALIAS "IsWindow" (BYVAL hWnd AS DWORD) AS int
DECLARE FUNCTION _10SetWindowLong LIB "USER32.DLL" ALIAS "SetWindowLongA" (BYVAL hWnd AS DWORD, BYVAL nIndex AS INT, BYVAL lNewLong AS QUAD) AS INT
DECLARE FUNCTION _10SendMessage LIB "USER32.DLL" ALIAS "SendMessageA" (BYVAL hWnd AS DWORD, BYVAL dwMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS INT) AS INT
DECLARE FUNCTION _10SetWindowLong LIB "USER32.DLL" ALIAS "SetWindowLongA" (BYVAL hWnd AS DWORD, BYVAL nIndex AS INT, BYVAL lNewLong AS INT) AS INT
DECLARE FUNCTION _10GetWindowLong LIB "USER32.DLL" ALIAS "GetWindowLongA" (BYVAL hWnd AS DWORD, BYVAL nIndex AS INT) AS INT
TYPE _10HPROP
long elem
long dmode
sys oldProc
sys curProc
'long user1
'long user2
END TYPE
Function _10DEFAULT_CALLBACK_PROC(sys hwnd, wMsg, wParam, lParam) as sys callback
_10HPROP *hdata
_10HPROP *hdat2
sys retval = 0
sys hWnd2 = 0
CHAR dtt[10] = "DATA" + chr(0)
@hData = _10GetProp(hwnd, byval @dtt)
If @hData Then
if hData.curProc then
Select case wMsg
case 273, 78
sys hControl = _10GetDlgItem(hwnd, loword(wParam))
@hdat2 = _10GetProp(hControl, byval @dtt)
if @hDat2 then
if hDat2.curProc then
retval = _10CallWindowProc(hDat2.curProc, hWnd, wMsg, wParam, lParam)
goto DoneWithNotifications
end if
end if
end select
retval = _10CallWindowProc(hData.curProc, hWnd, wMsg, wParam, lParam)
DoneWithNotifications:
end if
end if
if retval=0 then ' Yes, destroying the object.
if @hData then
if hData.elem = 2 then
IF hData.curProc=0 then
hWnd2 = _10GetParent(hWnd)
@hdat2 = _10GetProp(hWnd2, byval @dtt)
if @hdat2 then
if hdat2.curProc then
retval = _10CallWindowProc(hDat2.curProc, hWnd, wMsg, wParam, lParam)
end if
END IF
END IF
if retval=0 then
retval = _10CallWindowProc(hData.oldProc, hWnd, wMsg, wParam, lParam)
end if
else
retval = _10DefWindowProc(hwnd,wMsg,wParam,lParam)
end if
if wMsg=2 then ' WM_DESTROY
If hData.oldProc then
_10SetWindowLong(hWnd, -4, hData.oldProc)
end if
freememory(@hData)
_10RemoveProp(hWnd, byval @dtt)
end if
else
retval = _10DefWindowProc(hwnd, wMsg, wParam, lParam)
end if
end if
return retval
End Function
' STARTS PLURIBASIC_PREPARE.BIN
' This code is executed before anything else, if you want to do something after defining other things, see PLURIBASIC_INIT
' END OF PLURIBASIC_PREPARE.BIN
' STARTS PLURIBASIC_INIT.BIN
' This code is executed before anything else, if you want to do something before nything else, see PLURIBASIC_PREPARE
' END OF PLURIBASIC_INIT.BIN
' STARTS MSGBOX.BIN
FUNCTION MSGBOX(string sText, sys mOptions = 0, string sCaption = "PluriBASIC") AS LONG
FUNCTION = PluriBASICMessageBox(0, sText, sCaption, mOptions)
END FUNCTION
' END OF MSGBOX.BIN
' STARTS DIALOGSHOW.BIN
Function DialogShow(BYVAL dMode AS LONG, BYVAL hDlg AS SYS, BYVAL hCallback AS DWORD, BYREF Result AS DWORD) AS LONG
Dim wm as _10MSG
dword rr = 0
_10HPROP *hdata
CHAR dtt[10] = "DATA" + chr(0)
@hData = _10GetProp(hDlg, byval @dtt)
If @hData Then
hData.curProc = hCallback
end if
If @hData Then
hData.oldProc = _10GetWindowLong(hDlg, -4)
end if
_10SetWindowLong(hDlg, -4, @_10DEFAULT_CALLBACK_PROC)
_10SendMessage(hDlg, 272, 0, 0)
_10ShowWindow(hDlg, 5)
_10ShowWindow(hDlg, 5) ' first one never works.
Result = 0
if dMode = 1 then
while _10GetMessage(wm,0,0,0)
rr = _10TranslateMessage(wm)
_10DispatchMessage(wm)
IF _10IsWindow(hDlg) = 0 THEN
Result = rr
EXIT DO
end if
Wend
end if
end function
' END OF DIALOGSHOW.BIN
' STARTS DIALOGNEW.BIN
' STARTS CALLBACKDATA.BIN
' END OF CALLBACKDATA.BIN
' CONTINUES (1) DIALOGNEW.BIN
FUNCTION DialogNew(BYVAL dMode AS LONG, byval hParent AS DWORD, BYVAL sCaption AS STRING, BYREF Xt AS LONG, BYREF Yt AS LONG, BYVAL W AS LONG, BYVAL H AS LONG, BYVAL dStyle AS DWORD, BYVAL exStyle AS DWORD, BYREF Result AS DWORD) AS LONG
' Im clueless, dont ask me.
single ratioX = 1.58
single ratioY = 1.82
'=========================
sys hFont = _10GetStockObject(17)
long DX = 0
long dy = 0
long dw = 0
long dH = 0
SELECT CASE dMode
case 0, 6 ' UNITS.
dw = w * RatioX
dh = h * RatioY
IF @Xt=0 THEN
dx = (_10GetSystemMetrics(0)/2) - (dw/2)
ELSE
dx = Xt * RatioX
END IF
if @Yt=0 then
dy = (_10GetSystemMetrics(1)/2) - (dh/2)
else
dy = Yt * RatioY
end if
case 5 ' PIXELS
if @Xt=0 then
DX = (_10GetSystemMetrics(0)/2) - (w/2)
ELSE
DX = Xt
end if
if @Yt=0 then
dy = (_10GetSystemMetrics(1)/2) - (h/2)
ELSE
dy = Yt
end if
dw = w
Dh = h
case 7 ' DPIAWARE
END SELECT
Result = _10CreateWindowEx(exStyle,_ 'extended styles
"DDTDialog", _ 'window class name
sCaption,_ 'window caption
dStyle,_ 'window style
DX, _ 'initial x position
dy, _ 'initial y position
dw, _ 'initial x size
DH, _ 'initial y size
hParent, _ 'parent window handle
0, _ 'window menu handle
_10GetModuleHandle(0), _ 'program instance handle
0) 'creation parameter
if Result then
_10SendMessage(Result, 48, hFont, 0)
_10HPROP *hdata
@hData = getmemory(SizeOf(_10HPROP))
If @hData Then
hData.elem = 1
hData.dMode = dMode
CHAR dtt[10] = "DATA" + chr(0)
_10SetProp(Result, byval @dtt, @hData)
end if
end if
END FUNCTION
' END OF DIALOGNEW.BIN
' STARTS CONTROLADD.BIN
FUNCTION ControlAdd(string tControl, sys hParent, long cID, string sCaption, long X, Y, W, H, sys dStyle, sys exStyle, sys hCallback) AS sys
int Result
sys hDC = _10GetDC(0)
single ratioX = (_10GetDeviceCaps(hDC, 88) / 96)
single ratioY = (_10GetDeviceCaps(hDC, 90) / 96)
_10ReleaseDC(0, hDC)
int dx = (X * RatioX) * 1.53
int dy = (Y * RatioY) * 1.7
int dW = (W * RatioX) * 1.53
int dH = (H * RatioY) * 1.7
sys defStyle = 1073741824 or 268435456
sys hFont = _10GetStockObject(17)
string tctrl = lcase(Ltrim(rtrim(tControl)))
if tCtrl = "label" then
tCtrl = "Static"
elseif tCtrl = "textbox" then
tCtrl = "Edit"
elseif tCtrl = "listview" then
tCtrl = "SysListView32"
end if
if dStyle = 0 then dStyle = defStyle
Result = _10CreateWindowEx(exStyle,_ 'extended styles
tCtrl, _ 'control class name
sCaption,_ 'control caption
dStyle,_ 'control style
DX, _ 'initial x position
DY, _ 'initial y position
DW, _ 'initial x size
DH, _ 'initial y size
hParent, _ 'parent window handle
cID, _ 'control ID
_10GetModuleHandle(0), _ 'program instance handle
0) 'creation parameter
if Result then
sys hMsg = -4
_10SendMessage(Result, 48, hFont, 0)
_10HPROP *hdata
@hData = getmemory(SizeOf(_10HPROP)) ' _10HeapAlloc(_10GetProcessHeap(), 8, SizeOf(_10HPROP))
If @hData Then
hData.elem = 2
hData.oldProc = _10GetWindowLong(Result, -4)
hData.curProc = hCallback
CHAR dtt[10] = "DATA" + chr(0)
_10SetProp(Result, byval @dtt, @hData)
end if
_10SetWindowLong(Result, hMsg, @_10DEFAULT_CALLBACK_PROC)
end if
return Result
END FUNCTION
' END OF CONTROLADD.BIN
% WM_CREATE = 1
% WM_COMMAND = 273
% WM_INITDIALOG = 272
% WS_CHILD = 1073741824
% WS_VISIBLE = 268435456
% WS_TABSTOP = 65536
% MB_ICONEXCLAMATION = 48
% IDC_BUTTON1 = 1001
% IDC_LABEL1 = 1002
% IDC_LISTVIEW = 1003
' SYSTEM DECLARES FOR ARRAYS
DECLARE FUNCTION BUTTONPROC() AS LONG
DECLARE FUNCTION MAINPROC() AS LONG
DECLARE FUNCTION PBMAIN() AS LONG
' Initializes various things in the script.
FUNCTION PluriBASIC_Initialize() AS LONG
END FUNCTION
FUNCTION BUTTONPROC(sys cbhndl, uint cbMsg, sys wParam, sys lParam) as int callback
INT _05RETVAL = 0
_10SYSERR Err
INT _SC89 = cbMsg
IF _SC89 = WM_COMMAND THEN
INT _SC90 = loword(wParam)
IF _SC90 = IDC_BUTTON1 THEN
MSGBOX ("Over here!", MB_ICONEXCLAMATION)
END IF
END IF
RETURN _05RETVAL
END FUNCTION
FUNCTION MAINPROC(sys cbhndl, uint cbMsg, sys wParam, sys lParam) as int callback
INT _05RETVAL = 0
_10SYSERR Err
INT result
INT _SC91 = cbMsg
IF _SC91 = WM_CREATE THEN
ELSEIF _SC91 = WM_INITDIALOG THEN
ELSEIF _SC91 = WM_COMMAND THEN
INT _SC92 = loword(wParam)
IF _SC92 = IDC_BUTTON1 THEN
MSGBOX ("You pushed me! I'm offended!", MB_ICONEXCLAMATION)
END IF
ELSE
END IF
RETURN _05RETVAL
END FUNCTION
FUNCTION PBMAIN() AS INT
INT _05RETVAL = 0
_10SYSERR Err
DWORD hdlg
INT result
DialogNew(0, 0, "Hello World Compiled with " & "OxygenBASIC", byval 0, byval 0, 400, 400, 13565952 OR WS_VISIBLE, 0, hdlg)
ControlAdd("button", hdlg, IDC_BUTTON1, "Don't push me", 5, 5, 80, 20, WS_CHILD OR WS_VISIBLE OR WS_TABSTOP, byval 0, @BUTTONPROC)
ControlAdd("label", hdlg, IDC_LABEL1, "Some label", 5, 35, 80, 20, WS_CHILD OR WS_VISIBLE OR WS_TABSTOP, byval 0, 0)
ControlAdd("listview", hdlg, IDC_LISTVIEW, "", 5, 50, 390, 300, WS_CHILD OR WS_VISIBLE OR WS_TABSTOP, byval 0, 0)
DialogShow(1, hdlg, @MAINPROC, result)
END FUNCTION
PBMAIN() ' invoke entry point