|
-
Oct 2nd, 2009, 11:01 PM
#1
Thread Starter
New Member
The problem with COORD Structure in Visual Basic 6.0
I found that most of the console api functions can not be used in Visual Basic 6.0, and I try to find out the problem. Then I found all of the api functions with COORD structure can not be used in VB6, including GDI api functions with COORD. Maybe the Declaretion in API Viewer 2004 get wrong?
Public Type COORD
X As Integer
Y As Integer
End Type
and the Declaretion in VC
typedef struct _COORD {
SHORT X;
SHORT Y;
}COORD, *PCOORD;
Are there any problem? The Structure and API functions are useful for us.
-
Oct 2nd, 2009, 11:58 PM
#2
Re: The problem with COORD Structure in Visual Basic 6.0
COORD is the same as POINTAPI but uses Integer instead of Long.
I've used COORD several times without problems... what problem are you having?
-
Oct 3rd, 2009, 12:01 AM
#3
Re: The problem with COORD Structure in Visual Basic 6.0
Welcome to the forums.
Structure looks fine to me, consider it may be your code.
Here is an example of that structure
-
Oct 3rd, 2009, 12:36 AM
#4
Thread Starter
New Member
Re: The problem with COORD Structure in Visual Basic 6.0
I don't think there are any problems with my code. The code can be run in VC++ 6.0, but can't in VB6.
These Declaretions are from API Viewer 2004, they're used in my code:
Code:
Public Declare Function SetConsoleScreenBufferSize Lib "kernel32.dll" (ByVal hConsoleOutput As Long, ByRef dwSize As COORD) As Long
Public Declare Function GetStdHandle Lib "kernel32.dll" (ByVal nStdHandle As Long) As Long
Public Type COORD
x As Integer
y As Integer
End Type
and the main code
Code:
hOut = GetStdHandle(-11)
Dim crd As COORD
crd.x = 100
crd.y = 100
MsgBox SetConsoleScreenBufferSize(hOut, crd)
it always returns 0, i have no idea.
(BTW, thx for your replies)
-
Oct 3rd, 2009, 12:39 AM
#5
Thread Starter
New Member
Re: The problem with COORD Structure in Visual Basic 6.0
Oh, i think i got the answer.
i think i should get the Handle of Screen Buffer instead of Handle of Output, is that right?
-
Oct 3rd, 2009, 12:48 AM
#6
Thread Starter
New Member
Re: The problem with COORD Structure in Visual Basic 6.0
But ... How can i get the Handle of Screen Buffer ?
-
Oct 3rd, 2009, 12:52 AM
#7
Thread Starter
New Member
Re: The problem with COORD Structure in Visual Basic 6.0
I read my C++ code again, the first argument should be Handle of Output. Did my code in #4 get wrong ?
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
|