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.
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?
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
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)
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?
Re: The problem with COORD Structure in Visual Basic 6.0
But ... How can i get the Handle of Screen Buffer ?
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 ?