I need to change the cursor in a static member function but I receive a compiler error

error C2671 : static member functions do not have 'this' pointers

this->Cursor = System::Windows::Forms::Cursors::Default;

How do I modify the code so it will work in a static member function?

Thanks.

you cannot access class objects/methods from class static methods. There are at least two ways to overcome this:
1. pass a pointer or reference of an instance of the object to the static method, then access the objects through this pointer/reference.

2. make the object(s) static.

Since I am changing the cursor on the form itself, the form's object is not visible to make it static.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.