$ filename "t.exe"
'uses RTL32
uses MinWin
uses DialogFindReplace
#lookahead ' for procedures
'=========
'MAIN CODE
'=========
dim cmdline as asciiz ptr, inst as sys
&cmdline=GetCommandLine
inst=GetModuleHandle 0
'
'WINDOWS
'-------
'
WinMain inst,0,cmdline,SW_NORMAL
end
'
dim as sys hDlgFr
'--------------------------------------------------------------------
Function WinMain(sys inst, prevInst, asciiz*cmdline, sys show) as sys
'====================================================================
WndClass wc
MSG wm
sys hwnd, wwd, wht, wtx, wty, tax
wc.style = CS_HREDRAW or CS_VREDRAW
wc.lpfnWndProc = @WndProc
wc.cbClsExtra =0
wc.cbWndExtra =0
wc.hInstance =inst
wc.hIcon=LoadIcon 0, IDI_APPLICATION
wc.hCursor=LoadCursor 0,IDC_ARROW
wc.hbrBackground = GetStockObject WHITE_BRUSH
wc.lpszMenuName =null
wc.lpszClassName = strptr "Demo"
RegisterClass @wc
Wwd = 320 : Wht = 200
Tax = GetSystemMetrics SM_CXSCREEN
Wtx = (Tax - Wwd) /2
Tax = GetSystemMetrics SM_CYSCREEN
Wty = (Tax - Wht) /2
hwnd = CreateWindowEx 0,wc.lpszClassName,"OXYGEN BASIC",WS_OVERLAPPEDWINDOW,Wtx,Wty,Wwd,Wht,0,0,inst,0
ShowWindow hwnd,SW_SHOW
UpdateWindow hwnd
'
sys bRet
'
'
while bRet := GetMessage @wm, 0, 0, 0
if bRet = -1
'show an error message
exit do
elseif not IsDialogMessage hDlgFr,@wm
TranslateMessage @wm
DispatchMessage @wm
end if
wend
End Function
dim as rect crect 'for WndProc and TimerProc
'------------------------------------------------------------------
function WndProc ( sys hWnd, wMsg, wParam, lparam ) as sys callback
'==================================================================
static sys hdc
static String txt="Find and Replace Test", frs=""
static PaintStruct Paintst
static sys DlgFrMsg, flags
static char f[100],r[100]
'==========
select wMsg
'==========
'--------------
case WM_CREATE
'=============
GetClientRect hWnd,&cRect
DlgFrMsg=RegisterWindowMessage FINDMSGSTRINGA
hDlgFr=FindReplaceDialog(f,r,96,hwnd,flags)
'--------------
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,strptr txt,-1,&cRect,0x25
EndPaint hWnd,&Paintst
'--------------
case WM_KEYDOWN
'==============
'============
Select wParam
'============
Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0 'ESCAPE
Case 82 : hDlgFr=FindReplaceDialog(f,r,96,hwnd,flags) 'R
End Select
'------------
case DlgFrMsg
'============
FINDREPLACE* fr
@fr=lparam
frs=fr.lpstrFindWhat
switch bit fr.flags
'
case FR_DIALOGTERM
hDlgFr = 0
fr.lpstrFindWhat=""
fr.lpstrReplaceWith=""
fr.flags=0
frs="Press R for Find/Replace Dialog"
case FR_MATCHCASE
frs+=" MATCHCASE"
case FR_WHOLEWORD
frs+=" WHOLEWORD"
case FR_FINDNEXT
frs+=" FINDNEXT"
case FR_REPLACE
frs+=" REPLACE"
case FR_REPLACEALL
frs+=" REPLACEALL"
end select
'
txt=frs
InvalidateRect hWnd, @crect
'--------
case else
'========
function=DefWindowProc hWnd,wMsg,wParam,lParam
end select
end function ' WndProc
Page created in 0.106 seconds with 11 queries.