|
-
Dec 20th, 2002, 07:22 AM
#1
Thread Starter
Junior Member
Pixel Plotting with a Pointer - Problem [RESOLVED]
Hi,
After reading this thread: http://www.vbforums.com/showthread.p...hreadid=209455 I found a link to the following site, which describes how to use a pointer as the fastest way to plot single pixels: http://rookscape.com/vbgaming/tutAY.php , but I'm having some problems with it.
At the beginning it declares the variable 'sa' as a 'SAFEARRAY2D' to store the image's data in, but when the data has been assigned and the CopyMemory function is used, with the variable 'sa' as the source of the data, I get the following warning:
Compile Error:
Type mismatch: array or user-defined type expected
If anyone could take a look at the code in the link and see why it might be doing this I would be very greatful,
Thanks,
ISDP
Last edited by ISDP; Dec 22nd, 2002 at 05:47 AM.
"Mmm, so I hear they have the internet on computers these days..."
-
Dec 20th, 2002, 09:39 AM
#2
Frenzied Member
i've had the same problem with that code...
-
Dec 20th, 2002, 11:03 PM
#3
Addicted Member
I think he forgot some steps. Try the example here instead - http://www.allapi.net/apilist/GetObject.shtml
-
Dec 21st, 2002, 09:35 AM
#4
Ex-Super Mod'rater
You need to declare two versions of the API:
VB Code:
Private Declare Function VarPtrArray Lib "msvbvm50.dll" Alias "VarPtr" (Ptr() As Any) As Long
Private Declare Function VarPtr Lib "msvbvm50.dll" (Ptr As Any) As Long
He only put one of the in, its the same API except one takes a Array and the other doesn't. Use:
VB Code:
CopyMemory ByVal VarPtrArray(pic), VarPtr(sa), 4
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Dec 21st, 2002, 04:26 PM
#5
Thread Starter
Junior Member
Ok, thanks for all the help, it's been very useful! I'll get back to you all if I have any more problems,
ISDP
"Mmm, so I hear they have the internet on computers these days..."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|