How to change the mouse cursor to something else in c++? [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
How can I change the mouse cursor to something else in c++, Windows? I mean, change the pointer to another system default, for example, the hand icon.
I don't know what code I can provide you, since I don't really have anything for the mouse. The only thing I have for the mouse, that isn't in use, is to hide it. If this helps tell you what I use or anything like that, here:
SDL_ShowCursor (SDL_DISABLE);
My c++ version isn't the newest, so that is something to note.
And hiding the mouse pointer and having a picture follow it isn't something I can do since it uses way too many resources and is slow.

Use SDL_SetCursor If you want a system cursor, you can pass the return value of SDL_CreateSystemCursor to that function. See the documentation:
https://wiki.libsdl.org/SDL_SetCursor
https://wiki.libsdl.org/SDL_CreateSystemCursor
https://web.archive.org/web/20210211163214/https://wiki.libsdl.org/SDL_CreateSystemCursor
The documentation is currently somewhat lacking. The last link refers to the archived documentation, which contains the list of possible values for SDL_CreateSystemCursor
Example:
SDL_Cursor* cursor;
cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
SDL_SetCursor(cursor);

Related

How to make a form in c++ from scratch without winforms? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to make desktop application with cpp and make a completely new form and I don't want to use winforms or any external addons just cpp.
When presenting output to screen you almost always have to call some kind of system call at some point. So the next closest thing to winforms is probably the winapi, but you could try some kind of graphical library for example sdl2 or sfml which encapsulates these calls with their own api. But you wouldn't have all these nice native windows buttons and tabviews and scrollbars and textboxes and ... only some basic shapes, images and pixel buffers

Creating and Saving objects in C++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm trying to create a game using C++ / SDL / OpenGL and Box2D and I was wondering if I can create objects and save them to use later.
To be more precise, I want to create a map this way :
When I click somewhere in the window, it creates an object of my choice (a wall, a ground, etc..) and it will save it into a file that I can use to display the map.
It would save me much time as I will not have to set the x and y positions, length, rendering and all this shit manually and open debugger each time, then re-adjusting, etc..
So, can I do this and if so, how can I do it ?
This question is insanely vague.
Long answer: YES, you can turn your game into a map editor, there is no "built-in" way to do that. You will have to write all editor/serialization logic yourself. You should use a game engine like Unity or Unreal if you want to achieve this kind of features/Behaviour out of the box.
Short anwser: WHY BOTHER doing so, knowing awesome map editors like "Tiled" exists exactly for this purpose, and lots of binding to read maps exists in numerous languages on github.

Detecting if a coordinate on the screen is an interact-able. [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
This is regarding the C/C++ language ->
Is there some kind of Windows API that checks if a given position on the screen is clickable? For example, the windows icon on the bottom left, the red X on the top right of a program, or maybe the "enter" button in a web browser's search engine.
This sounds a bit complex, but maybe through IPC there's a way to do something like this? Thanks!
EDIT: By clickable, i mean anything you can associate with / interact with.
Almost anything on screen is clickable (except things that hit-test as HTERROR, HTNOWHERE and HTTRANSPARENT).
The sane approach is to use UI Automation/MSAA. Call WindowFromPoint, ChildWindowFromPoint or RealChildWindowFromPoint to get a HWND and then call AccessibleObjectFromWindow to get a IAccessible interface and call accDoDefaultAction.
A less sane option is to use WM_NCHITTEST to figure out what the mouse is over and send some fake WM_NCLBUTTON* messages.

Window - Lock Program Background [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to lock a program in background by adding a service to background. The user needs to input password to use the program.
sc create newservice binpath = "C:\Users\User\Test.exe"
The problem is, I am not sure that How can I write the program.
First, what programming language can I use? Cmd, C++ or others?
Second, how can I write this exe?
I have heard this from my friend, but I am not sure how to write this.
Any help will be appreciated.
First note, background process not must be service.
Second note, if you wish wrote service, take in account Vista and above session isolation. Also service may run in another account.
Third note. How do you 'trap' browser? Code injection? Finding by process name/ window name? .... Many counterattacks exists, so this is not trivial thing.
Forth note, What if stop service or close/kill your process?
Fifth note, how do you wish store passwords? If as plain text, every skilled person obstruct your app. If encrypted, more code you must wrote...
Sixth note, nobody on SO.com wrote code for wish without you.

Get coordinates of two mouses separately in C++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm having two mouses on my PC, and now I want to get their positions at the same time. Can I do this through programming?
Thanks!
In Windows you cant, because you can only get the Position of the Cursor which is controlled by every mice.
On Linux, it's definitely possible to control one cursor with two devices. For instance I have a touchscreen and a mouse, the most recent one to be used moves the cursor.
This Question talks about a package which allows 2 cursors on Ubuntu.