' multiplication of two values
'
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
' 1) '- multiply go asm ------------------- //
'
byte val1
byte val2
int result ''resd 1
val1=4
val2=6 '
mov eax,val1
mov eax,val2 ''multiply eax by ebx "
mul val1 'ebx
mov result,eax
'print "the result of val1*val2 is " + str(result) '24
zstring tit[] = " PowerBASIC"
string msg[] = " hello my powerbasic friends " + str(result)
push 2 ' 0
addr eax,tit
push eax
addr eax,msg
push eax
addr eax,result
push 0
call MessageBox
mov eax, msg
' multiplication of two values
'
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[] = " PowerBASIC"
zstring msg[] = " hello my powerbasic friends"
byte val1
byte val2
int result ''resd 1
val1=4
val2=6 '
' 1) '- multiply go asm ------------------- //
'
mov eax,val1
mov eax,val2 ''multiply eax by ebx "
mul val1 'ebx
mov result,eax
'- multiply go asm ------------------- //
'
' 2) how I can add the result of "mov result,eax" to the Call MessageBox ?
'------------ messagebox go ---------- //
'32bit asm
push 2 ' 0 '2
addr eax,tit
push eax
addr eax,msg
push eax
push 0
call MessageBox ' here should be the result of multiply mov result,eax
'------------ messagebox go ---------- //
print "the result of val1*val2 is " + str(result) '24
string cancellaPdf ="cmd.exe /c del "+pdf
if FileExists(pdf)=1 then exechide(cancellaPdf,1)
String riga=prodir + " -out pdf -ratio -resize 1200 -overwrite -c 5 -q "+qualita+" -o " +qu+pdf+qu+ " " +qu+f+qu
[font=Verdana, Arial, Helvetica, sans-serif]int valu=exechide(riga,1) [/font]
' Set the Watchdog to 20 Seconds
%SetWatchdog 20
' After using the Watchdog, switch it off
%ClrWatchdog
'-----------------------------------------------------------
' Dictate
'-----------------------------------------------------------
:But_Dictate
%SetWatchdog 20
GSB.HiColor
GSB.Dictate
GSB.LoButton
%ClrWatchdog
RET.
'-----------------------------------------------------------
' Dictate
'-----------------------------------------------------------
:But_Dictate
%SetWatchdog 2
GSB.HiColor
GSB.Dictate
GSB.LoButton
%ClrWatchdog
RET.
'**********************************************
' PRR./PRE./PRV. - Watchdog
' This script demonstrates a simple watchdog timer
' using the $$TIM variable to monitor the main script.
'
' Usage:
' - Set $$TIM to a non-zero value to start the watchdog.
' - The watchdog monitors the elapsed time.
' - If $$TIM is zero, the watchdog is off.
' - If the elapsed time exceeds $$TIM, an action is taken.
'**********************************************
:Watchdog_Start
MOD.New|Watchdog
' Variables Initialization
VAR.$$MWH=#cbw#
' Default State is off
VAR.$$TIM=0
'-----------------------------------------------------------
' Parallel Robot Routine
PRR.0
MOD.Enter|Watchdog
' Print robot information
'PRT.I am (Parallel-)Robot-Nr. #pri#.
'PRT.I am Son #pri# of $$MWH.
:Loop
PRT.Watchloop A
' Wait for timer value to be set
WFV.$$TIM|3
JIZ.$$TIM|off
' Record the start datetime
$$STA=#dtime#
' Main watchdog loop
:WatchdogLoop
PRT.Watchloop B: $$TIM
' Pause for a short period
PAU.1
' Calculate the elapsed time
CAL.$$CUT=(#dtime#-$$STA)
PRT.Test: $$CUT>$$TIM
' Check if the elapsed time exceeds the timer value
IVV.$$CUT>$$TIM
' Print the elapsed time and the timer value
PRT.Watchdog-Timeout: $$CUT>$$TIM
' Get and execute the command
GDF.hp|$$MWH|$$PID
CPR.$$PID
EIF.
' Check if the timer is reset to zero (watchdog off)
JIZ.$$TIM|off
' Repeat the watchdog loop
JMP.WatchdogLoop
' Off condition handling
:off
' Pause for 1 second
PAU.1
' Jump back to the beginning of the loop
JMP.Loop
END.
' Set return value for the main program
PRE.$$WDG|0
MOD.Copy to Last|$$WDG
'-----------------------------------------------------------
MOD.Return
RET.
: %SetWatchdog 1
MOD.Enter|Watchdog
VIN.$$TIM=§§§01
PRV.$$WDG|$$TIM
MOD.Return
END%
: %ClrWatchdog
MOD.Enter|Watchdog
VIN.$$TIM=0
PRV.$$WDG|$$TIM
MOD.Return
END%
#COMPILE EXE
#DIM ALL
#INCLUDE "WIN32API.INC"
TYPE SHELLEXECUTEINFO
cbSize AS DWORD
fMask AS DWORD
hwnd AS DWORD
lpVerb AS ASCIIZ PTR
lpFile AS ASCIIZ PTR
lpParameters AS ASCIIZ PTR
lpDirectory AS ASCIIZ PTR
nShow AS LONG
hInstApp AS DWORD
lpIDList AS ANY PTR
lpClass AS ASCIIZ PTR
hkeyClass AS DWORD
dwHotKey AS DWORD
hIcon AS DWORD
hProcess AS DWORD
END TYPE
%SEE_MASK_NOCLOSEPROCESS = &H00000040
%SEE_MASK_NO_CONSOLE = &H08000000
%SW_HIDE = 0
FUNCTION ShellExecNoConsole (BYVAL Command AS STRING, BYVAL Params AS STRING) AS LONG
DIM sei AS SHELLEXECUTEINFO
DIM result AS LONG
sei.cbSize = SIZEOF(sei)
sei.fMask = %SEE_MASK_NOCLOSEPROCESS OR %SEE_MASK_NO_CONSOLE
sei.hwnd = %NULL
sei.lpVerb = VARPTR(STRPTR("open"))
sei.lpFile = VARPTR(STRPTR(Command))
sei.lpParameters = VARPTR(STRPTR(Params))
sei.lpDirectory = %NULL
sei.nShow = %SW_HIDE
result = ShellExecuteEx(sei)
IF result THEN
' Wait for the process to complete, if needed
WaitForSingleObject(sei.hProcess, %INFINITE)
CloseHandle(sei.hProcess)
END IF
FUNCTION = result
END FUNCTION
FUNCTION PBMAIN () AS LONG
DIM command AS STRING
DIM params AS STRING
command = "notepad.exe" ' Example command
params = "" ' Example parameters, if any
IF ShellExecNoConsole(command, params) THEN
MSGBOX "Process started successfully without a visible window.", %MB_OK, "Info"
ELSE
MSGBOX "Failed to start the process.", %MB_OK, "Error"
END IF
END FUNCTION
Page created in 0.110 seconds with 10 queries.