Q. A little bit of a catastrophe has occurred. I've now had the report of a second iteration of the outbreak of a Trojan virus called backdoor.raid :-((( as a result of downloading and installing a Rapid-Q program I've written.
A1.A2. Unpack your programm before distribution.
Q.
How to minimize
an application to the task bar
A. These commands minimize an
application to the task bar:
$INCLUDE "RAPIDQ.INC"
CONST GWL_HWNDPARENT = (-8)
DECLARE FUNCTION
SetWindowLongAPI LIB "user32"
ALIAS _
"SetWindowLongA" (ByVal hWnd
AS LONG,
ByVal nIndex AS
LONG, _
ByVal dwNewLong AS
LONG) AS
LONG
Dim Form AS
QFORM
WITH Form
SetWindowLongAPI(.Handle, GWL_HWNDPARENT, 0)
SetWindowLongAPI(Application.Handle, GWL_HWNDPARENT, .Handle)
.WindowState = wsMinimized
.ShowModal
END WITH
But if you search
for a tray application then you
can find
a very simple one in the files section of this group:
http://groups.yahoo.com/group/rapidq/files/Scheduler.bas
This application also shows how to manage a
tray popup
menu. The application terminates automaticly if
your
windows session ends.
Regards
Martin
Q.
How to put your application icon into the system tray
area.
A.
' How to put your application icon into the
system tray area.
' Double click your icon to "re-display" the
application.
' Written in Rapid-Q by William Yu
$TYPECHECK ON
TYPE TNOTIFYICONDATA
cbSize AS
DWORD
hWnd AS
LONG
uID AS
LONG
uFlags AS
LONG
uCallbackMessage AS
LONG
hIcon AS
LONG
szTip AS
STRING*64
END TYPE
DECLARE SUB
Shell_NotifyIcon LIB "SHELL32"
ALIAS "Shell_NotifyIconA"
_
(dwMessage AS
LONG, NIDATA AS
TNOTIFYICONDATA)
CONST FALSE = 0
CONST TRUE = 1
CONST NIM_ADD = 0
CONST NIM_MODIFY = 1
CONST NIM_DELETE = 2
CONST NIM_MESSAGE = 1
CONST NIM_ICON = 2
CONST NIM_TIP = 4
CONST WM_USER = &H400
CONST WM_TRAYICON = WM_USER + 400
CONST WM_COMMAND = &H111
CONST WM_SYSCOMMAND = &H112
CONST WM_LBUTTONDOWN = &H201
CONST WM_LBUTTONDBLCLK = &H203
CONST WM_RBUTTONDOWN = &H204
CONST WM_RBUTTONDBLCLK = &H206
CONST SC_MINIMIZE = 61472
CONST SC_CLOSE = 61536
DIM Form AS
QForm
DIM Button AS
QButton
DIM NI AS
TNotifyIconData
DIM AlreadyTrayed
AS INTEGER
AlreadyTrayed = FALSE
SUB FormClose
IF AlreadyTrayed
THEN
Shell_NotifyIcon(NIM_DELETE, NI)
'-- Remove our tray icon
END IF
Application.Terminate
END SUB
SUB ButtonClick
IF NOT
AlreadyTrayed THEN
NI.cbSize = SIZEOF(NI)
NI.hWnd = Form.Handle
NI.uID = Application.hInstance
NI.uFlags = NIM_ICON OR
NIM_MESSAGE OR NIM_TIP
NI.hIcon = Application.Icon
NI.uCallBackMessage = WM_TRAYICON
NI.szTip = "Rapid-Q Tray Example"+CHR$(0)
Shell_NotifyIcon(NIM_ADD, NI)
AlreadyTrayed = TRUE
END IF
Form.Visible = FALSE
END SUB
SUB FormWndProc (Handle
AS INTEGER,
uMsg AS DWORD,
wParam AS LONG,
lParam AS LONG)
IF uMsg = WM_SYSCOMMAND
THEN
IF wParam = SC_MINIMIZE
THEN
'-- Minimize to
system tray
ButtonClick
END
IF
ELSEIF uMsg = WM_TRAYICON
THEN
IF (lParam
AND &HFFFF) = WM_LBUTTONDBLCLK
THEN
'-- Respond on double click
Form.Caption = "I'm
back!"
Form.Visible = TRUE
'-- Bring back our form
Form.WindowState = 0
END
IF
END IF
END SUB
Button.Parent = Form
Button.Caption = "Tray me"
Button.OnClick = ButtonClick
Form.Caption = "Tray Example"
Form.Center
Form.OnClose = FormClose
Form.WndProc = FormWndProc
Form.ShowModal
Q. I need to get the desktop folder on Win98/2000
A.
CONST CSIDL_DESKTOP = &H0
CONST MAX_PATH = 260
CONST NULL = CHR$(0)
DECLARE FUNCTION SHGetSpecialFolderLocationAPI LIB "shell32" _
ALIAS "SHGetSpecialFolderLocation" (ByVal hwndOwner AS LONG, _
ByVal nFolder AS LONG, ByVal pidl AS LONG) AS LONG
DECLARE FUNCTION SHGetPathFromIDListAPI LIB "shell32" ALIAS _
"SHGetPathFromIDListA" (ByVal pidl AS LONG, _
ByVal pszPath AS LONG) AS LONG
TYPE ITEMIDLIST
mkid AS LONG
END TYPE
FUNCTION GetSpecialFolder (csidl AS LONG) AS STRING
DIM idl AS ITEMIDLIST
DIM str AS STRING
result = ""
IF SHGetSpecialFolderLocationAPI(Application.Handle, csidl, idl) = 0 THEN
str = SPACE$(MAX_PATH)
IF SHGetPathFromIDListAPI(idl.mkid, VARPTR(str)) <> 0 THEN
result = LEFT$(str, INSTR(str, NULL) - 1) + "\"
END IF
END IF
END FUNCTION
Showmessage(GetSpecialFolder(CSIDL_DESKTOP))
Regards
Martin
Q. I
would like to know how to put a bitmap in the ClipBoard
A.
Hopefully this will work for you. $INCLUDE "RAPIDQ.INC" Const LR_LOADFROMFILE = &H10 Const IMAGE_BITMAP = 0 Const IMAGE_ICON = 1 Const IMAGE_CURSOR = 2 Const IMAGE_ENHMETAFILE = 3 Const CF_BITMAP = 2 Const WM_PASTE As Long = &H302 Declare Function SetFocus Lib "user32.dll" Alias "SetFocus" (ByVal hwnd As Long) As Long Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal dwImageType As Long, ByVal dwDesiredWidth As Long, ByVal dwDesiredHeight As Long, ByVal dwFlags As Long) As Long Declare Function CloseClipboard Lib "user32" Alias "CloseClipboard" () As Long Declare Function OpenClipboard Lib "user32" Alias "OpenClipboard" (ByVal hwnd As Long) As Long Declare Function EmptyClipboard Lib "user32" Alias "EmptyClipboard" () As Long Declare Function SetClipboardData Lib "user32" Alias "SetClipboardData" (ByVal wFormat As Long, ByVal hMem As Long) As Long Declare Function IsClipboardFormatAvailable Lib "user32" Alias "IsClipboardFormatAvailable" (ByVal wFormat As Long) As Long Declare Function GetClipboardData Lib "user32" Alias "GetClipboardData" (ByVal wFormat As Long) As Long DIM OD AS QOPENDIALOG DECLARE SUB GetPicture Dim hDC As Long, hBitmap As Long OD.Filter = "Bitmap Files (*.bmp)|*.bmp" IF OD.Execute Then hBitmap = LoadImage(Canvas1.Handle, OD.Filename, IMAGE_BITMAP, 320, 200, LR_LOADFROMFILE) IF hBitmap = 0 Then ShowMessage "There was an error while loading the bitmap" EXIT SUB END IF OpenClipboard Canvas1.Handle EmptyClipboard SetClipboardData CF_BITMAP, hBitmap IF IsClipboardFormatAvailable(CF_BITMAP) = 0 Then ShowMessage "There was an error while pasting the bitmap to the clipboard!" END IF 'Close the clipboard CloseClipboard END IF END SUB Q. I was wondering if anyone knows how to find the window/application handle
A. '----------- Danny Jackson
'Here are 2 examples of using FindWindow(): Example 1: DECLARE FUNCTION FindWindowAPI LIB "user32" ALIAS "FindWindowA" _ (ByVal lpClassName AS LONG, ByVal lpWindowName AS STRING) AS LONG DECLARE SUB GetHandle CREATE Form AS QFORM Caption = "Test" CREATE Button AS QBUTTON Caption = "Get Handle" OnClick = GetHandle END CREATE END CREATE SUB GetHandle DIM str AS STRING str = STR$(Form.Handle) + "=" + STR$(FindWindowAPI(0, "Test")) ShowMessage(str) END SUB Form.ShowModal Example 2: DECLARE FUNCTION FindWindowAPI LIB "user32" ALIAS "FindWindowA" _ (ByVal lpClassName AS LONG, ByVal lpWindowName AS STRING) AS LONG pid = Shell("calc.exe") DIM n AS SINGLE n = TIMER WHILE ABS(TIMER - n) < 2 DoEvents WEND ShowMessage(STR$(FindWindowAPI(0, "Calculator"))) ' The second param must be the window title of calc.exe ' Note: The window title is often language dependent! 'Regards 'Martin
A2
1) One solution is use FindWindow like this previnst.bas example: http://citymap.dnsart.com/_scripts/file.php?f=1490&r=2330 or http://citymap.getmyip.com/_scripts/file.php?f=1490&r=2330 or http://g.slyip.com/_scripts/file.php?f=1490&r=2330
Q. Is there some way in
rapidqQ that I could conect to the internet?
A.
Socket examples:
http://citymap.dnsart.com/_scripts/file.php?f=1050&r=2330
or
http://citymap.getmyip.com/_scripts/file.php?f=1050&r=2330
Guidance
Q How to setFocus for rapidq QEdit???
A
' ------------ DECLARE SUB EnterJump(key AS BYTE) DECLARE FUNCTION GetFocus Lib "user32" Alias "GetFocus"() AS LONG DECLARE FUNCTION Setfocus Lib "user32" Alias "SetFocus"(hwnd As Long) AS LONG CREATE Form AS QFORM Caption = "Jump Enter" Width = 170 Height = 170 Center CREATE Edit1 AS QEDIT Text = "Edit1" Left = 20 Top = 20 OnKeyPress = EnterJump END CREATE CREATE Edit2 AS QEDIT Text = "Edit2" Left = 20 Top = 60 OnKeyPress = EnterJump END CREATE CREATE Edit3 AS QEDIT Text = "Edit3" Left = 20 Top = 100 OnKeyPress = EnterJump END CREATE END CREATE SUB EnterJump(key AS BYTE) IF key <> 13 THEN EXIT SUB Handle = GetFocus() SELECT CASE Handle CASE Edit1.Handle SetFocus(Edit2.Handle) CASE Edit2.Handle SetFocus(Edit3.Handle) CASE Edit3.Handle SetFocus(Edit1.Handle) END SELECT END SUB Form.ShowModal 'Jacques Philippe
Q Here are two RapidQ applications exchanging data
A
=================program #1======================== ' name this ap_a.rqb and compile ' Bill K 12-2002 $APPTYPE GUI $TYPECHECK ON $OPTIMIZE ON CONST CRLF=CHR$(13) & CHR$(10) CONST WM_COPYDATA = &H4A TYPE COPYDATASTRUCT dwData AS LONG cbData AS LONG lpData AS LONG END TYPE DIM DataStruct AS COPYDATASTRUCT DEFSTR strSend, strRecv ' DECLARE SUB SendData DECLARE SUB FormWndProc (Hwnd&, uMsg&, wParam&, lParam&) DECLARE FUNCTION FindWindow LIB "user32" ALIAS _ "FindWindowA" (ByVal lpClassName AS String, _ ByVal lpWindowName AS String) AS LONG ' CREATE FORM AS QFORM ' title the other application will search for: CAPTION="Application A" left=100 top=100 CREATE sendbtn AS QBUTTON WIDTH=75 TOP=form.clientheight-33 LEFT=(form.clientwidth-sendbtn.width)/4-15 CAPTION="SEND" ONCLICK=senddata END CREATE CREATE sendlbl AS QLABEL caption="Send:" top=3 left=10 END CREATE 'sendlbl CREATE recvlbl AS QLABEL caption="Receive:" top=3 left=form.clientwidth/2+15 END CREATE 'recvlbl CREATE redit1 AS QRICHEDIT hideselection=0 scrollbars=3 top=18 left=5 width=form.clientwidth/2-10 height=form.clientheight-60 END CREATE ' redit CREATE Redit2 AS QRICHEDIT hideselection=0 scrollbars=3 top=18 left=redit1.LEFT + redit1.width +10 width=form.clientwidth/2-10 height=form.clientheight-60 END CREATE ' Redit2 END CREATE ' FORM ' SUB SendData DEFLNG wndhnd wndhnd=Findwindow("TForm","Application B") IF wndhnd=0 THEN SHOWMESSAGE "Could not find Application B" EXIT SUB END IF strSend=redit1.text DataStruct.lpData = VARPTR(strSend) DataStruct.cbData = LEN(strSend) SENDMESSAGE wndhnd, WM_COPYDATA, 0, DataStruct END SUB ' SUB FormWndProc (Hwnd&, uMsg&, wParam&, lParam&) IF uMsg& = WM_COPYDATA THEN DIM MStream AS QMEMORYSTREAM MStream.MemCopyFrom(lParam&, 12) MStream.Position = 0 MStream.ReadUDT(DataStruct) MStream.Close strRecv = VARPTR$(DataStruct.lpData) Redit2.addstrings strRecv END IF END SUB ' REDIT1.ADDSTRINGS "This is sample data text" + _ crlf + "from Application A" Form.WndProc = FormWndProc' best if this is ' just before showmodal Form.showmodal '========end of ap_a.rqb =================program #2======================== ' name this ap_b.rqb and compile ' Bill K 12-2002 $APPTYPE GUI $TYPECHECK ON $OPTIMIZE ON CONST CRLF=CHR$(13) & CHR$(10) CONST WM_COPYDATA = &H4A TYPE COPYDATASTRUCT dwData AS LONG cbData AS LONG lpData AS LONG END TYPE DIM DataStruct AS COPYDATASTRUCT DEFSTR strSend, strRecv ' DECLARE SUB SendData DECLARE SUB FormWndProc (Hwnd&, uMsg&, wParam&, lParam&) DECLARE FUNCTION FindWindow LIB "user32" ALIAS _ "FindWindowA" (ByVal lpClassName AS String, _ ByVal lpWindowName AS String) AS LONG ' CREATE FORM AS QFORM ' title the other application will search for: CAPTION="Application B" left=500 top=100 CREATE sendbtn AS QBUTTON WIDTH=75 TOP=form.clientheight-33 LEFT=(form.clientwidth-sendbtn.width)/4-15 CAPTION="SEND" ONCLICK=senddata END CREATE CREATE sendlbl AS QLABEL caption="Send:" top=3 left=10 END CREATE 'sendlbl CREATE recvlbl AS QLABEL caption="Receive:" top=3 left=form.clientwidth/2+15 END CREATE 'recvlbl CREATE redit1 AS QRICHEDIT hideselection=0 scrollbars=3 top=18 left=5 width=form.clientwidth/2-10 height=form.clientheight-60 END CREATE ' redit CREATE Redit2 AS QRICHEDIT hideselection=0 scrollbars=3 top=18 left=redit1.LEFT + redit1.width +10 width=form.clientwidth/2-10 height=form.clientheight-60 END CREATE ' Redit2 END CREATE ' FORM ' SUB SendData DEFLNG wndhnd wndhnd=Findwindow("TForm","Application A") IF wndhnd=0 THEN SHOWMESSAGE "Could not find Application A" EXIT SUB END IF strSend=redit1.text DataStruct.lpData = VARPTR(strSend) DataStruct.cbData = LEN(strSend) SENDMESSAGE wndhnd, WM_COPYDATA, 0, DataStruct END SUB ' SUB FormWndProc (Hwnd&, uMsg&, wParam&, lParam&) IF uMsg& = WM_COPYDATA THEN DIM MStream AS QMEMORYSTREAM MStream.MemCopyFrom(lParam&, 12) MStream.Position = 0 MStream.ReadUDT(DataStruct) MStream.Close strRecv = VARPTR$(DataStruct.lpData) Redit2.addstrings strRecv END IF END SUB ' REDIT1.ADDSTRINGS "This is sample data text" + _ crlf + "from Application B" Form.WndProc = FormWndProc' best if this is ' just before showmodal form.showmodal '=== end ap_b.rqb
Q. HOWTO Include ASM routines in RapidQ
A. --------------------------------------------------------------------------- Jacques Philippe April 2002 HOWTO Include ASM routines in RapidQ using NASM and API CallWindowProc --------------------------------------------------------------------------- First of all, a special thank to Pavel Minayev -aka evilone666- who opened this road with Vector.Asm and Crc32.Asm. See Crc32.Zip and Rqasm.Zip in RapidQ YahooGroups files section INTRODUCTION ------------ - All the examples are ready for a NASM installation in c:\Nasm, otherwise, you'll have to modify some directories. - All the executable files are "TINY", to run them, you must copy your RAPIDQCC.DLL and RAPIDQ32.DLL in your Windows directory (c:\Windows\) - NASM, the 32 bits ASM compiler, is free. It's syntaxe is slightly different from other Assemblers ; this can be confusing. - Related Sites (I am new to NASM, so there may be better sites) ?official site? http://nasm.octium.net/ download http://www.web-sites.co.uk/nasm/where.html GUI http://www.phoenix.gb.net/x86/ - Pavel's method loads a proc.bin as a resource at compile time and at run time moves that resource to a QMemoryStream then uses the property QMemoryStream.Pointer to point the procedure in API CallWindowProc. - it's possible to directly load the proc.bin in a String or an Array and use the VarPtr(String) or VarPtr(Array(0)) to point the procedure in API CallWindowProc. The softwares BinToInc and BinToInc_Plus in /Bin_To_Inc/ do that (the name BinTonInc was choosen for Binary to RapidQ Include file). So, a single and simple file Included in the RapidQ code will give access to ASM procedures. NASM_SHELL_0, NASM_SHELL_1, NASM_SHELL_2 in dir \NASM_Shell\ ---------------------------------------- Are NASM Shells to write Assembler routines called by Api CallWindowProc in RapidQ - use NASM_SHELL_2 - see NASM_SHELL_0 and NASM_SHELL_1 for a very basic tutorial COMPILETOBIN.BAT in Directory \NASM_Compile\ ---------------- Compiles a NASM source to a BIN file - the line "set fich=GetByteAt" must be adapted to the filename of the NASM source you want to compile - the path to Nasmw.exe, the NASM compiler, must be adapted to your directories - CompileToBin.Bat must be in the directory of the NASM source code file you want to compile - the compiled .BIN file will be created in the same directory as CompileToBin.Bat BINTOINC.EXE in direcrtory \Bin_To_Inc\ ------------ Creates a RapidQ code file containing the BIN file in an Array. The name of the .BIN file is used to create a function and a pointer to that array. Just run BinToInc.Exe, then use menu File/Open to select a .Bin file. As Soon as a .Bin file is selected, a RapidQ code is generated on the screen ; save that code in an .Inc file using menu File/Save. The Option menu allows you to Include the "CallAsmProc API" declaration to the RapidQ code or not ; it's usefull if you include many asm .Inc files in you software... Demo : Run BinToInc.Exe in \Bin_To_Inc\, then File/Open \Bin_To_Inc\Demo\ReverseString.Bin, once selected, the screen fills with A RapidQ Code. Save It as \Bin_To_Inc\Demo\ReverseString.Inc Now, you should be able to RQ Compile \Bin_To_Inc\Demo\ReverseStringDemo_2.Bas Here is the kind of file created by BinToInc.Exe with an ASM .Bin file ' Begin of File ReverseString.Inc cut and pasted ' DECLARE FUNCTION CallAsmProc LIB "user32" ALIAS "CallWindowProcA" _ (Proc AS LONG, A1 AS LONG, A2 AS LONG, A3 AS LONG, _ A4 AS LONG) AS LONG ' ' ============================================================ ' ----- START ASM ReverseString ----- DefByte ReverseStringArray (0 To 60) = _ { _ &HC8, &H00, &H00, &H00, &H51, &H56, &H57, &H8B, &H7D, &H0C, _ &H8B, &H75, &H08, &HB8, &H00, &H00, &H00, &H00, &HB9, &H00, _ &H01, &H00, &H00, &HFC, &HA4, &H40, &H80, &H3E, &H00, &H0F, _ &H84, &H02, &H00, &H00, &H00, &HE0, &HF2, &H8B, &H75, &H0C, _ &H01, &HC6, &H4E, &H8B, &H7D, &H08, &H89, &HC1, &HFC, &HA4, _ &H4E, &H4E, &HE0, &HFA, &H5F, &H5E, &H59, &HC9, &HC2, &H10, _ &H00 _ } ' ----- END ASM ReverseString ----- ' ' ----- POINTER to use In CallAsmProc ----- ' A Bit Faster than Calling ReverseString DefInt ptrReverseString ptrReverseString = VarPtr (ReverseStringArray(0)) ' ' ----- RQ CALL ReverseString ----- Function ReverseString (Arg1 As Long, Arg2 As Long, Arg3 As Long, _ Arg4 As Long) as Long Result = CallAsmProc (ptrReverseString, Arg1, Arg2, Arg3, Arg4) End Function ' ' ============================================================ ' End of File ReverseString.Inc cut and pasted RapidQ source BinToInc.Bas is available in \Bin_To_Inc\RQ_Source ; these sources require QRedEx.Inc and QIni_JP.Inc to compile. BINTOINC_PLUS.BAS ----------------- Does the same as BINTOINC.BAS, but with all the .BIN files present in the selected directory. Try in \Bin_To_Inc\Demo_Plus\ RQASMTOINC.BAS RqAsm editor 'Compiling' directly Bin To an RQ .Inc file -------------- RqAsm Adds the Nasm Header and Footer, creates the arguments macro to call them by their names in the Nasm code. _ RqAsm knows four words if most left on a line and followed by a space function end function sub end sub - the first word following 'function' or 'sub' is the name of the function used in the creation of the RQ code. That 'name' will be used to - create the 'name.Asm' file - compile the 'name.Bin' file - name the RQ 'nameArray' - create the RQ 'ptrName' to nameArray(0) - create the RQ function or sub 'name' - the words following the function or sub name are the arguments names they will be used to define NASM macros, allowing easier access to 'pushed' arguments, - separator between names and arguments is a single space = " " - all lines out of function/end function or sub/end sub are ignored - all other lines will simply be copied in the name.Asm file, such as asm code lines, commented lines, ... Here is An RqAsm Example : --- RqASm Code Start -------------- ; FUNCTION GET BYTE AT ; -------------------- ; address is a pointer ; function GetByteAt address push edx mov eax, address mov edx, 0 mov dl, [eax] mov eax, edx pop edx end function --- RqAsm Code End ---------------- RqAsmToInc will create a NASM code GetByteAt.Asm file : --- NASM Code Start --------------- ; PROC NAME : GETBYTEAT ; ; NASM CODE Generated by rqAsmToBin on 04-14-2002 at 14:07:54 ; bits 32 ; %define address [ebp+08] ; segment .text start: enter 0, 0 ; ; End Of RqAsm Automated Header ; User's Code Begins Here ; push edx mov eax, address mov edx, 0 mov dl, [eax] mov eax, edx pop edx ; ; End of User's Code ; Automated RqAsm Footer leave ret 16 ; ; End of NASM Code --- NASM Code End ------------------- RqAsmToInc will compile it in GetByteAt.Bin file And Finnally RqAsmToInc will create a GetByteAt.Inc file ' ' ============================================================ ' ----- START ASM GetByteAt ----- DefByte GetByteAtArray (0 To 21) = _ { _ &HC8, &H00, &H00, &H00, &H52, &H8B, &H45, &H08, &HBA, &H00, _ &H00, &H00, &H00, &H8A, &H10, &H89, &HD0, &H5A, &HC9, &HC2, _ &H10, &H00 _ } ' ----- END ASM GetByteAt ----- ' ' ----- POINTER to use In CallAsmProc ----- ' A Bit Faster than Calling GetByteAt DefInt ptrGetByteAt ptrGetByteAt = VarPtr (GetByteAtArray(0)) ' ' ----- RQ CALL GetByteAt ----- Function GetByteAt (Arg1 As Long) As Long Result = CallAsmProc (ptrGetByteAt, Arg1, 0, 0, 0) End Function ' ' ============================================================ ' that can be included in your RApidQ code. And simply called in RQ by GetByteAt(address) ...more - Sub, Function and End Sub and End Function are delimiter. Same reserved word as in RapidQ - functionName, subName, arg_1, arg_2, arg_3, arg_4 must br any 'valid' NASM names - the function/sub elements are separated by one single space - arg_1, arg_2, arg_3, arg_4 are always Longs. Long can be a pointer to anything : string, array, structure, CodePtr, ... - functions returns always a Long (register eax is the returned value). - Sub and Function cannot be nested - Nearly all NASM procedure in the world can be 'ported' to RQ. There even is a GUI 'set' written NASM available named 'gaz'. Files and Directories --------------------- - The RqAsm file is saved in the RqAsm directory (choosen by user) All the intermediary files, .ASM files and .BIN files, are stored in that directory too. - The final .INC file is saved in the INC directory (choosen by the user) IE, in the RapidQ current project directory - These two directories are choosen by the user on "Open RqAsm" or "New RqAsm" - The last directories and filename used are saved in an INI file on RqAsmToInc Exit and reloaded on start. RAPIDQ_TEST RQ ASM SPEED TESTS in directory \RapidQ_Test\ ----------- - ConAsmTest.Exe source : ConAsmTest.Bas - GuiAsmTest.Exe source : GuiAsmTest.Bas These will show you that CallWindowProc put a terrible time burden on your fast ASM procedures... RqAsmToInc in an usefull but unfinished thing... it could - include the RQ Call Function - have a better file saving system - ... April 14th, 2002 Jacques
Q.Could someone send me a working example of how to create a custom event? A. ============= Pavel Minayev 27 Mar 2001 ======= ' A short example demonstrating custom events ' QCircle is a simple control that looks a circle, and it ' provides OnHitCircle event, which is called each time the ' user clicks inside of the circle. It also passes one argument ' which is the distance from the center of the circle to ' the point clicked. $INCLUDE "rapidq.inc" ' This declaration is used as a template for event handlers ' for OnHitCircle event DECLARE SUB HitCircleEvent(d AS SINGLE) TYPE QCircle EXTENDS QCanvas ' Declare an event based on previously declared handler template OnHitCircle AS EVENT(HitCircleEvent) EVENT OnPaint WITH QCircle .Circle(0, 0, .Width, .Height, clWindowText, clBtnFace) END WITH END EVENT EVENT OnMouseDown(Button AS LONG, x AS LONG, y AS LONG, Shift AS LONG) WITH QCircle d = SQR((x - .Width / 2) ^ 2 + (y - .Height / 2) ^ 2) ' If cursor was inside of the circle, fire the event IF d <= .Width / 2 THEN CALLFUNC(.OnHitCircle, d) END WITH END EVENT CONSTRUCTOR Width = 100 Height = 100 END CONSTRUCTOR END TYPE ' Test code SUB Circle1_HitCircle(d AS SINGLE) SHOWMESSAGE "Distance from center: " + STR$(d) END SUB CREATE Form AS QForm Width = 300 Height = 300 CREATE Circle1 AS QCircle OnHitCircle = Circle1_HitCircle END CREATE Center ShowModal END CREATE ==================================== Q. I'm trying to set a richedit up to delete a line by pressing Ctrl+Y
A. Try something like this... (Achilles B. Mina) DECLARE SUB keybd_event Lib "user32.dll" Alias "keybd_event"_ (bVk As Byte,bScan As Byte,dwFlags As Long,dwExtraInfo As Long) DECLARE FUNCTION Setfocus Lib "user32" _ Alias "SetFocus"(hwnd As Long) As Long DECLARE SUB DelLine CREATE Form AS QFORM Center CREATE Rich AS QRICHEDIT Align = 1 AddString "RichEdit1" END CREATE CREATE Button AS QBUTTON Caption = "Delete" Left = 115 Top = 118 OnClick = DelLine END CREATE END CREATE SUB DelLine Rich.Line(Rich.WhereY) = "" keybd_event(8,0,0,0) SetFocus(Rich.Handle) END SUB Form.ShowModal