
A Few Questions: ClipCursor(), SetPalette, possibly pointers, looking for Great Graphics Program
Quote:
> I would like to confine the cursor into a rectangle. I've found that the
> API function "ClipCursor", in the user library, is specifically designed to
> do this. However, I can't use this function in my Visual Basic program
> because it requires pointers, something that I know about from my C
> Programming, but cannot use because (as far as I know) VB doesn't use
> them.
VB does use pointers, it just hides them from the programmer. If I
declare a function like:
Declare Sub ClipCursor Lib "User" (lpRect As Any)
and then call the function like this:
Dim R as RECT
R.Left = 0
R.Top = 0
R.Right = 100
R.Bottom = 100
ClipCursor R
VB actually passes R's address (a pointer to R) to the ClipCursor
routine. VB's strings are handled differently. I can also call
ClipCursor like this:
Dim R as String * 8
R$ = Chr$(0) & Chr$(0) & Chr$(0) & Chr$(0) & Chr$(100) & Chr$(0) &
Chr$(100) & Chr$(0)
ClicpCursor ByVal R$
When passing strings, VB normally passes the string handle. Since we
want to pass a pointer to the string data, we must include the BYVAL
keyword. This is counterintuitive, but this is the way to pass a
pointer to a string in VB.
Note also that I can pass the rectangle data to ClipCursor in either of
these ways because I declared the parameter to ClipCursor as "Any."
This tells VB not to perform type checking and to simply pass the
included data.
HTH,
chris judge
Quote:
> I also need a Graphics program that will allow me to "tilt" an image. I
> need to "turn" it, 10 degrees, 20 degrees, maybe 5 degrees.
> Thank You for your support.