Ken thanks this have been a great help now the program is running faster now is there any where on the net that i can get a list of the API?? regards Soon Lee ----- Original Message ----- From: "Ken Pergola" To: Sent: Friday, June 25, 2004 11:19 PM Subject: Re: [OT]: What is the fastest way to fill a matrix in VB6 > Soon Lee wrote: > >> Any one know of any fast method of filling or zeroing a big matrix beside >> using the "FOR" method > > Hi Soon Lee, > > Have you tried one of the several Win32 API functions -- especially the > ZeroMemory "function"?: > > I would give ZeroMemory a whirl. Others in the "family" are 'CopyMemory' > and > 'FillMemory'. > Just remember you are venturing out of the protection of VB6 -- as long as > you know the ramifications, feel free to play with these Win32 API > routines. > > > Public Declare Sub ZeroMemory Lib "kernel32" Alias "RtlMoveMemory" > (Destination As Any, ByVal numBytes As Long) > > Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" > (Destination As Any, Source As Any, ByVal Length As Long) > > Public Declare Sub FillMemory Lib "kernel32.dll" Alias "RtlFillMemory" > (Destination As Any, ByVal Length As Long, ByVal Fill As Byte) > > NOTE: I would double-check the above API declarations online on MSDN just > for correctness. > > > CAVEAT EMPTOR: > Please read the following disclaimer carefully. I'm using the following > declarations in some of my VB6 code, but I have personally modified the > data > types in some areas. You might want to use the standard Win32 API > declarations. > > Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" > (Destination As Byte, _ > Source > As Byte, _ > ByVal > Length As Long) > > > Public Declare Sub FillMemory Lib "kernel32" Alias "RtlFillMemory" > (Destination As Byte, _ > ByVal > Length As Long, _ > ByVal > Fill As Byte) > > > Public Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" > (Destination As Byte, _ > ByVal > Length As Long) > > > Hope this gets you on the right track. > > Best regards, > > Ken Pergola > > P.S. I'm sure the formatting got mangled, but I'm confident you can stitch > things back together. :) > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads