Results 1 to 7 of 7

Thread: The problem with COORD Structure in Visual Basic 6.0

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    5

    Question 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.

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    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?

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    5

    Post 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)

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    5

    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?

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    5

    Re: The problem with COORD Structure in Visual Basic 6.0

    But ... How can i get the Handle of Screen Buffer ?

  7. #7

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    5

    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
  •  



Click Here to Expand Forum to Full Width