Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. cursor problem

cursor problem

Scheduled Pinned Locked Moved Managed C++/CLI
helpc++question
11 Posts 3 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N neterfari

    Hello , I have a problem, I use LoadCursor () , but at runtime it shows me two error messages. Here is the code: term.h

    void LoadCursor(double latitude,double longitude);

    term.cpp

    void Term::LoadCursor(double longitude,double latitude)
    {
    CursorLongitudeCurrent=longitude;
    CursorLatitudeCurrent=latitude;
    }

    nem.h

    double ReadLatitudeValue(void);
    string ReadLongitude(void);
    

    FormD.h

    private: System::Void TMR_RS232Read_Tick(System::Object^ sender, System::EventArgs^ e) {
    ptr_Term> LoadCursor(ptr_nem->ReadLatitudeValue(),ptr_nem->ReadLongitudeValue());
    }

    AND errors: first: error LNK2019: unresolved external symbol "public: void __thiscall term::LoadCursorW(double,double)" (?LoadCursorW@term@@$$FQAEXNN@Z) referenced in the function "private: void __clrcall FormD.cpp::Form_D::TMR_RS232Read_Tick(class System::Object ^,class System::EventArgs ^)" (?TMR_RS232Read_Tick@FormD@FormD.cpp@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) Second: error LNK2028: unresolved token (0A0004AF) "public: void __thiscall term::LoadCursorW(double,double)" (?LoadCursorW@term@@$$FQAEXNN@Z) referenced in the function "private: void __clrcall FormD.cpp::FormD::TMR_RS232Read_Tick(class System::Object ^,class System::EventArgs ^)" (?TMR_RS232Read_Tick@FormD@FormD.cpp@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) if you have an idea Thank you

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    Your function is defined as LoadCursor, but somewhere in your code you are trying to call LoadCursorW. This is probably due to the fact that LoadCursor is defined in Winuser.h as described in http://msdn.microsoft.com/en-us/library/windows/desktop/ms648391(v=vs.85).aspx[^]. Try changing your function name to something else, or use a namespace to avoid conflicts.

    N 1 Reply Last reply
    0
    • L Lost User

      Your function is defined as LoadCursor, but somewhere in your code you are trying to call LoadCursorW. This is probably due to the fact that LoadCursor is defined in Winuser.h as described in http://msdn.microsoft.com/en-us/library/windows/desktop/ms648391(v=vs.85).aspx[^]. Try changing your function name to something else, or use a namespace to avoid conflicts.

      N Offline
      N Offline
      neterfari
      wrote on last edited by
      #3

      thank you very much Richard :thumbsup:

      N 1 Reply Last reply
      0
      • N neterfari

        thank you very much Richard :thumbsup:

        N Offline
        N Offline
        neterfari
        wrote on last edited by
        #4

        I changed the name of the function and I have no error but my cursor does not appear you have an idea please

        J L 2 Replies Last reply
        0
        • N neterfari

          I changed the name of the function and I have no error but my cursor does not appear you have an idea please

          J Offline
          J Offline
          John Schroedl
          wrote on last edited by
          #5

          LoadCursor just loads the resource, it doesn't change the system cursor to that shape. We'd need to see your code where you try to use the cursor. For example, do you use it: * In response to a WM_SETCURSOR message? * In a direct call to SetCursor()? * Passed to RegisterClass? John

          1 Reply Last reply
          0
          • N neterfari

            I changed the name of the function and I have no error but my cursor does not appear you have an idea please

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            Since your code does not do anything (as far as we can see) it's difficult to answer that question. What is this function supposed to do?

            N 1 Reply Last reply
            0
            • L Lost User

              Since your code does not do anything (as far as we can see) it's difficult to answer that question. What is this function supposed to do?

              N Offline
              N Offline
              neterfari
              wrote on last edited by
              #7

              Hello thank you for your help.I have 4 function. Term.h

              bool stateCursor; // Clignote du curseur
              void CreateCursor(PaintEA e);

              Term.cpp

              void Term::CreateCursor(PaintEA e){

              SolidBrush^ blackBrush = gcnew SolidBrush( Color::Black );
              SolidBrush^ redBrush = gcnew SolidBrush( Color::Red );

              if(CurPointCurrent!=CurPointPrevious) {

              	int deltaX=CurPointCurrent.X-CurPointPrevious.X;
              	int deltaY=CurPointCurrent.Y-CurPointPrevious.Y;
              	float distance= sqrt(pow((float)deltaX,2)+pow((float)deltaY,2));
              	float vectorX=deltaX/distance\*polygoneLength;
              	float vectorY=deltaY/distance\*polygoneLength;
              	// Creation des points de polygone 
              	Point point1 = Point(CurPointCurrent.X+vectorX,CurPointCurrent.Y+vectorY);
              	Point point2 = Point(CurPointCurrent.X+vectorX\*-0.866-vectorY\*0.5,CurPointCurrent.Y+vectorX\*0.5+vectorY\*-0.866);
              	Point point3 = CurPointCurrent;
              	Point point4 = Point(CurPointCurrent.X+vectorX\*-0.866-vectorY\*-0.5,CurPointCurrent.Y+vectorX\*-0.5+vectorY\*-0.866);
              
              	// Dessine (clignoter noir <-> rouge)
              	array^ curvePoints = {point1,point2,point3,point4};
              	if(stateCursor==false) {
              			e->Graphics->FillPolygon( blackBrush , curvePoints );
              			stateCursor=true;
              	}
              	else {
              			e->Graphics->FillPolygon( redBrush, curvePoints );
              			stateCursor=false;
              		}
              

              }
              else{
              if(stateCursor==false) {
              e->Graphics->FillEllipse( blackBrush , CurPointCurrent.X-circleRadius,CurPointCurrent.Y-circleRadius,circleRadius*2,circleRadius*2);
              stateCursor=true;
              }
              else {
              e->Graphics->FillEllipse( redBrush , CurPointCurrent.X-circleRadius,CurPointCurrent.Y-circleRadius,circleRadius*2,circleRadius*2 );
              stateCursor=false;
              }
              }
              }

              FormD.h

              private: System::Void picB_MainMap_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {

              if(!first\_time) {
              	ptr\_Term->CreateCursor(e);
              }
              

              }

              private: System::Void picB_SubZone_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {

              if(!first_time) {

              ptr\_Term->CreateCursor(e);
              

              }
              }

              Thanks

              L 1 Reply Last reply
              0
              • N neterfari

                Hello thank you for your help.I have 4 function. Term.h

                bool stateCursor; // Clignote du curseur
                void CreateCursor(PaintEA e);

                Term.cpp

                void Term::CreateCursor(PaintEA e){

                SolidBrush^ blackBrush = gcnew SolidBrush( Color::Black );
                SolidBrush^ redBrush = gcnew SolidBrush( Color::Red );

                if(CurPointCurrent!=CurPointPrevious) {

                	int deltaX=CurPointCurrent.X-CurPointPrevious.X;
                	int deltaY=CurPointCurrent.Y-CurPointPrevious.Y;
                	float distance= sqrt(pow((float)deltaX,2)+pow((float)deltaY,2));
                	float vectorX=deltaX/distance\*polygoneLength;
                	float vectorY=deltaY/distance\*polygoneLength;
                	// Creation des points de polygone 
                	Point point1 = Point(CurPointCurrent.X+vectorX,CurPointCurrent.Y+vectorY);
                	Point point2 = Point(CurPointCurrent.X+vectorX\*-0.866-vectorY\*0.5,CurPointCurrent.Y+vectorX\*0.5+vectorY\*-0.866);
                	Point point3 = CurPointCurrent;
                	Point point4 = Point(CurPointCurrent.X+vectorX\*-0.866-vectorY\*-0.5,CurPointCurrent.Y+vectorX\*-0.5+vectorY\*-0.866);
                
                	// Dessine (clignoter noir <-> rouge)
                	array^ curvePoints = {point1,point2,point3,point4};
                	if(stateCursor==false) {
                			e->Graphics->FillPolygon( blackBrush , curvePoints );
                			stateCursor=true;
                	}
                	else {
                			e->Graphics->FillPolygon( redBrush, curvePoints );
                			stateCursor=false;
                		}
                

                }
                else{
                if(stateCursor==false) {
                e->Graphics->FillEllipse( blackBrush , CurPointCurrent.X-circleRadius,CurPointCurrent.Y-circleRadius,circleRadius*2,circleRadius*2);
                stateCursor=true;
                }
                else {
                e->Graphics->FillEllipse( redBrush , CurPointCurrent.X-circleRadius,CurPointCurrent.Y-circleRadius,circleRadius*2,circleRadius*2 );
                stateCursor=false;
                }
                }
                }

                FormD.h

                private: System::Void picB_MainMap_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {

                if(!first\_time) {
                	ptr\_Term->CreateCursor(e);
                }
                

                }

                private: System::Void picB_SubZone_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {

                if(!first_time) {

                ptr\_Term->CreateCursor(e);
                

                }
                }

                Thanks

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #8

                Sorry, I don't understand what you are trying to illustrate.

                N 1 Reply Last reply
                0
                • L Lost User

                  Sorry, I don't understand what you are trying to illustrate.

                  N Offline
                  N Offline
                  neterfari
                  wrote on last edited by
                  #9

                  sorry my english is very bad. I tried to create a cursor. I have a function that nominated CreateCursor in Term.h and Term.cpp and I call this function in FormD.h but not display the cursor

                  L 1 Reply Last reply
                  0
                  • N neterfari

                    sorry my english is very bad. I tried to create a cursor. I have a function that nominated CreateCursor in Term.h and Term.cpp and I call this function in FormD.h but not display the cursor

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #10

                    I am still not clear what you are trying to do, but you may need to read http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor(v=vs.110).aspx[^].

                    N 1 Reply Last reply
                    0
                    • L Lost User

                      I am still not clear what you are trying to do, but you may need to read http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor(v=vs.110).aspx[^].

                      N Offline
                      N Offline
                      neterfari
                      wrote on last edited by
                      #11

                      thank you very much for your help Richard.:rose:I found the error, and my program works. error is not in the code that I've written here :)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups