CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Dev C++ LPPOINT

  1. #1
    Join Date
    Jan 2010
    Posts
    76

    Dev C++ LPPOINT

    ok so I have this part of the code in my code:

    LPPOINT Pos;
    GetCursorPos(Pos);

    its a program my friend wants me to make.

    Well everytime I try to use Pos.y or Pos.y.value the idw it keeps coming back saying y hasn't been declared,why is that?


    This makes no sense to me *clueless*

    thanks

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Dev C++ LPPOINT

    In the Windows SDK, 'LPPOINT' is a pointer to a POINT struct. So:
    Code:
    POINT Pos;
    GetCursorPos(&Pos);
    should work.

    Viggy

  3. #3
    Join Date
    Jan 2010
    Posts
    76

    Re: Dev C++ LPPOINT

    Quote Originally Posted by MrViggy View Post
    In the Windows SDK, 'LPPOINT' is a pointer to a POINT struct. So:
    Code:
    POINT Pos;
    GetCursorPos(&Pos);
    should work.

    Viggy

    Nah that didn't work. It just said something about can't convert tag point




    #include <cstdlib>
    #include <windows.h>
    #include <iostream>
    #include <fstream>
    using namespace std;
    ofstream file("c:\\mouse.txt");
    int main(void)
    {
    LPPOINT Pos;
    GetCursorPos(&Pos);
    cout << Pos.y<<endl;
    while(Pos=0){

    }
    file<<"hello world";
    system("PAUSE");
    return (0);
    }


    Errors:

    10 C:\Master Backup\g backup\Projects\Event Tasker\main.cpp cannot convert `tagPOINT**' to `tagPOINT*' for argument `1' to `BOOL GetCursorPos(tagPOINT*)'

    11 C:\Master Backup\g backup\Projects\Event Tasker\main.cpp `y' has not been declared

    11 C:\Master Backup\g backup\Projects\Event Tasker\main.cpp request for member of non-aggregate type before '<<' token

  4. #4
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: Dev C++ LPPOINT

    You are still making the same mistake pointed out by MrViggy. Use POINT not LPPOINT.
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

  5. #5
    Join Date
    Jan 2010
    Posts
    76

    Re: Dev C++ LPPOINT

    ok I'll try point again, maybe it will work. I tried it before and it said POINT doesn't name a type

  6. #6
    Join Date
    Aug 2008
    Posts
    902

    Re: Dev C++ LPPOINT

    Quote Originally Posted by Senith View Post
    ok I'll try point again, maybe it will work. I tried it before and it said POINT doesn't name a type
    That because there is NO type "POINT" in windows.h

    Tip: if you're using Visual Studio, hold your mouse over the text LPPOINT and it will bring a box out that states that LPVOID is a typedef for a pointer to a struct named tagPOINT. LP is Hungarian notation for long pointer which means it only points to a tagPOINT.

    tagePOINT pos; // or LPPOINT pos = new tagPOINT;
    GetCursorPos(&Pos); // or GetCursorPos(Pos);
    cout << Pos.y;

  7. #7
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: Dev C++ LPPOINT

    MSDN disagrees.

    The struct is typedeffed to POINT.
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

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

Featured