' frebasic
'#include "crt.bi"
'#include "windows.bi"
' oxygen basic
'
uses corewin
uses console
' Declare external functions
declare function GetStdHandle( byval nStdHandle as ulong ) as long
declare function ReadConsoleA( byval hConsoleInput as long, byval lpBuffer as integer, byval nNumberOfCharsToRead as long, byref lpNumberOfCharsRead as long, byval lpReserved as integer ptr ) as long
' Define constants
% STD_INPUT_HANDLE = -10
% STD_OUTPUT_HANDLE = -11
% STD_ERROR_HANDLE = -12
% BUFSIZE = 128
' Define input function
function InputBox( prompt as string ) as string
dim as long bytes_read
dim as any ptr input_handle
dim as integer ptr buffer ' integer 'any
dim as string input_text
' Get handle to console input
input_handle = GetStdHandle( STD_INPUT_HANDLE )
' Allocate memory for input buffer
'buffer = allocate( BUFSIZE )
buffer = sysallocStringLen( BUFSIZE )
' Print prompt
print prompt
' Read input from console
' problem zone ---------------------------------------------- //
ReadConsoleA( input_handle, buffer, BUFSIZE, bytes_read, 0 )
' problem zone ---------------------------------------------- //
' Convert buffer to string
input_text = Str(buffer) '*buffer
' Free memory
free( buffer )
' Return input text
return input_text
end function
' Main program
dim as string names
' Get user input
names = InputBox( "Enter your name: " )
' Print input
print "Hello, " + names + "!"
wait
'sleep
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
zstring tit[] ="The great world of OxygenBasic..."
zstring msg[] ="Happy Easter"
'32bit asm
'=========
push 0 '1
addr eax,tit
push eax
addr eax,msg
push eax
push 0
call MessageBox
$filename "t.exe"
uses rtl64
'msgbox 64 bit
'
Declare Function MessageBox Lib "user32.dll" alias "MessageBoxA" (ByVal hwnd As sys, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
zstring tit[] ="The great world of OxygenBasic..."
zstring msg[] ="Happy Easter"
sub rsp,32
mov r9d, 0
lea r8, tit
lea rdx, msg
mov rcx, 0
call MessageBox
add rsp,32
Page created in 0.149 seconds with 10 queries.