Hi!
I'm quite a newbie at this but how would you make a program that when you open it will change the mouse pointer and then open a new program and close itself?
I'll be happy for all the answers I receive.
Hi!
I'm quite a newbie at this but how would you make a program that when you open it will change the mouse pointer and then open a new program and close itself?
I'll be happy for all the answers I receive.
FAQ > How dow I Run a program from within a program
Do you want to change the mouse cursor for the current user? Or have it change just while it's over your application window?
gg
When the mouse pointer is over the new application.
You're gonna have a hard time changing the mouse cursor for another application.
A Windows application can conrol the look of a cursor while the cursor is over its window by responding to the WM_SETCURSOR message.
What exactly are you trying to apply this to? Perhaps there are better alternatives.
gg
I have a game I made with Rpg maker XP, and I need to change the cursor in the main file of the game. Alternatively can I just change the cursor for the current user, if you can show me how to do it.
You can try playing around with SetCursor(), but there may be official support for this within RPG Maker XP.
gg
Found an online forum for RPG Maker - they might be able to help.
http://stifu.free.fr/Board/forum.php?id=3
gg
Thanks! But Rpg maker forums dosen't help because it normally isn't supported, it's a script you can use in Rpg maker that let you use the mouse. By the way, you can use Ruby in Rpg maker if you wanted to know...
Use SetSystemCursor, eg:Originally Posted by Matte
Code:/* change system cursor, launch another program then restore original cursor when other program closed. */ /*some compilers (ms) may need OEMRESOURCE defined to use cursor identifiers*/ #define OEMRESOURCE #include <windows.h> /* Nov 2004: problem with MinGW(3101) implementation of CopyCursor an alternative is to just use CopyImage. This is not a issue with MinGW 3.4 candidate*/ #if !defined CopyCursor #define CopyCursor(c) ((HCURSOR)CopyIcon((HICON)(c))) #endif int main() { HCURSOR hOldCur,hNewCur; STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&si,sizeof(si)); si.cb=sizeof(si); ZeroMemory(&pi,sizeof(pi)); /*Start other program, for example, the windows calculator*/ if(!CreateProcess(0,"calc.exe",0,0,0,0,0,0,&si,&pi)) { MessageBox(0,"error","Failed to launch process",MB_OK); return 0; } /*need to copy the cursors because SetSystemCursor destroys them*/ hOldCur=CopyCursor(((HCURSOR)LoadImage(0,IDC_ARROW,IMAGE_CURSOR,0,0, LR_SHARED))); hNewCur=CopyCursor(((HCURSOR)LoadImage(0,IDC_CROSS,IMAGE_CURSOR,0,0, LR_SHARED))); SetSystemCursor(hNewCur,OCR_NORMAL); /*wait for child process to quit*/ WaitForSingleObject(pi.hProcess,INFINITE); /*clean up process garbage*/ CloseHandle(pi.hProcess); CloseHandle(pi.hThread); /*and restore original cursor*/ SetSystemCursor(hOldCur,OCR_NORMAL); }
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Thanks!
But where can you change the pointer file?