followed by my idea here a first attempt to make shorter the win api with button. only the winmain() function with "width" and "height" values are a problem as I cannot change values by functions. second: the window procedere I haven't changed yet.
@peter: It's not the problem for me to understand win api or oxygen, but I thougth about other programmers and newbies using oxygen basic. For my personal opinion it's better to have a better overview about my code structures and therefore I liked (for example) the short ddt modus of powerbasic for dialogs and callbacks. I know the powerful win api and sdk modus of powerbasic too and for oxygenbasic but it was just an idea to make a simple building of an dialog with button (only as example).
use at own risk. all include file you find in rar file.
$ filename "t.exe"
'#include "../../inc/RTL32.inc"
'#include "../../inc/RTL64.inc"
'#include "../../inc/MinWin.inc"
#include "MinWin.inc"
#include "button.inc"
#include "mywinz.inc"
#lookahead ' for procedures
s=error()
'
if s then
print s
end
end if
'=========
'MAIN CODE
'=========
dim as sys = inst,hwnd
dim cmdline as asciiz ptr
dim as rect crect 'for WndProc and TimerProc
'======================================
'// -------------------------// my idea
inst=GetModuleHandle 0
oxymain(inst, 0,cmdline,SW_NORMAL)
mywinz(hwnd,320,240,"hello oxywin")
'// -------------------------// my idea
'======================================
'----------- // no idea yet how to make that one shorter // ---
'--------------------------------------------------------------
function WndProc ( hWnd, wMsg, wParam, lparam ) as sys callback
'==============================================================
static as sys hdc
static as String txt
static as PaintStruct Paintst
'==========
select wMsg
'==========
case WM_COMMAND
mbox "hello button"
'--------------
case WM_CREATE
'=============
'--------------------------------------------- // my idea
call btn("button","test",20,20,120,40,hwnd)
'--------------------------------------------- // my idea
GetClientRect hWnd,&cRect
'--------------
case WM_DESTROY
'===============
PostQuitMessage 0
'------------
case WM_PAINT
'============
'TEXT
'http://msdn.microsoft.com/en-us/library/dd144821(v=VS.85).aspx
'DRAWING AND PAINTING
'http://msdn.microsoft.com/en-us/library/dd162760(v=VS.85).aspx
GetClientRect hWnd,&cRect
hDC=BeginPaint hWnd,&Paintst
'style
'0x20 DT_SINGLELINE
'0x04 DT_VCENTER
'0x01 DT_CENTER
'0x25
SetBkColor hdc,yellow
SetTextColor hdc,red
DrawText hDC,"Hello OxygenWorld!",-1,&cRect,0x25
EndPaint hWnd,&Paintst
'--------------
case WM_KEYDOWN
'==============
'============
Select wParam
'============
Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0 'ESCAPE
End Select
'--------
case else
'========
function=DefWindowProc hWnd,wMsg,wParam,lParam
end select
end function ' WndProc
I like the iup design too, but it's working with external dll. My idea was to use only the oxygen own power basis :-)
best regards, frank
X