How to replace cursor pointer with SetSystemCursor from “BUSY” or “APP

I am trying to change “WORKING IN BACKGROUND” and “BUSY” mouse cursor

Page 1 of 1

6 Replies - 7726 Views - Last Post: 28 June 2012 - 01:41 PM Rate Topic: -----

#1 benalmadena  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 9
  • Joined: 20-July 08

How to replace cursor pointer with SetSystemCursor from “BUSY” or “APP

Post icon  Posted 20 July 2008 - 02:24 AM

I am trying to change “WORKING IN BACKGROUND” and “BUSY” mouse cursor pointer to “NORMAL SELECT” cursor pointer
Because my main application often loads and terminates several extra VB6 applications and it is pretty annoying to see how cursor icon jerks and switches many times from normal arrow to BUSY hourglass or “Working in background” hourglass with arrow

I try to use this code it seems like it does not working …
hNormal = CopyIcon(GetCursor())
makelog Me.Name & ";;Err.LastDllError=" & Err.LastDllError & ";hArrow=" & hArrow & ";hNormalor = " & hNormal & ";retval=" & retval
retval = SetSystemCursor(hNormal, IDC_APPSTARTING)

So here is the question: How to replace in current scheme (whether it is default scheme, or 3d bronze scheme or dinosaur scheme, or etc.) cursor mode “BUSY” or “WORKING IN BACKGROUND” to “NORMAL SELECT” cursor icon, and them how to restore back to normal when my main application ended or terminated
:blink:

Is This A Good Question/Topic? 0
  • +

Replies To: How to replace cursor pointer with SetSystemCursor from “BUSY” or “APP

#2 Ken Halter  Icon User is offline

  • New D.I.C Head

Reputation: 14
  • View blog
  • Posts: 35
  • Joined: 18-November 07

Re: How to replace cursor pointer with SetSystemCursor from “BUSY” or “APP

Posted 23 July 2008 - 10:37 AM

Well... there are at least 2 things wrong with doing what you ask (imo)

The first would be.... attempting to fight with the functionality of the OS. Many people worked for years to make sure that simple hourglass functionality worked. To try and remove that functionality will be a constant uphill battle... in the end, the OS will win, every time.

The second mistake would be... trying to find code to change a users preferences. Quite a few users spend hours setting up their computers the way they like and if some app keeps messing with the settings, they'll delete that app in a heartbeat... if your app crashes and leaves their cursor settings "messed up", after scratching their heads and wondering "how can I get my hourglass back?!!!!", they'll send you a nastygram.

Same goes for people that attempt to change monitor resolutions and color depths. Sure it's possible, but if I find an app that does it on my PC, the delete key is the next step. No app on earth is "crash proof".

If anything, specifically state in some manual or help file that you'll be changing their settings.... like the newer 3D action games do...

Personally, I don't find a cursor that's acting "as designed" to be annoying... but, if you insist, you can most likely find quite a few ways to do what you want on PlanetSourceCode.com

I forgot to mention...

"I am trying to change “WORKING IN BACKGROUND” and “BUSY” mouse cursor pointer to “NORMAL SELECT” cursor pointer"

Right there's a huge problem. Even if you do find the code you're after, there's no way the mouse will act in a "normal" manner if the OS is truly busy.
Was This Post Helpful? 2

#3 benalmadena  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 9
  • Joined: 20-July 08

Re: How to replace cursor pointer with SetSystemCursor from “BUSY” or “APP

Posted 23 July 2008 - 12:22 PM

View PostKen Halter, on 23 Jul, 2008 - 10:37 AM, said:

Well... there are at least 2 things wrong with doing what you ask (imo)

The first would be.... attempting to fight with the functionality of the OS. Many people worked for years to make sure that simple hourglass functionality worked. To try and remove that functionality will be a constant uphill battle... in the end, the OS will win, every time.

The second mistake would be... trying to find code to change a users preferences. Quite a few users spend hours setting up their computers the way they like and if some app keeps messing with the settings, they'll delete that app in a heartbeat... if your app crashes and leaves their cursor settings "messed up", after scratching their heads and wondering "how can I get my hourglass back?!!!!", they'll send you a nastygram.

Same goes for people that attempt to change monitor resolutions and color depths. Sure it's possible, but if I find an app that does it on my PC, the delete key is the next step. No app on earth is "crash proof".

If anything, specifically state in some manual or help file that you'll be changing their settings.... like the newer 3D action games do...

Personally, I don't find a cursor that's acting "as designed" to be annoying... but, if you insist, you can most likely find quite a few ways to do what you want on PlanetSourceCode.com

I forgot to mention...

"I am trying to change “WORKING IN BACKGROUND” and “BUSY” mouse cursor pointer to “NORMAL SELECT” cursor pointer"

Right there's a huge problem. Even if you do find the code you're after, there's no way the mouse will act in a "normal" manner if the OS is truly busy.


quite irrelevant post
Was This Post Helpful? -1
  • +
  • -

#4 Ken Halter  Icon User is offline

  • New D.I.C Head

Reputation: 14
  • View blog
  • Posts: 35
  • Joined: 18-November 07

Re: How to replace cursor pointer with SetSystemCursor from “BUSY” or “APP

Posted 23 July 2008 - 06:11 PM

"quite irrelevant post"

Well, I'm not going to be sucked into a flame fest or anything, but there are far too many "programmers" who think *their* app is the most important app on the end users PC... so, like I said, there are ways to do what you want... in fact, all it takes is a little investigation on your part to find where the cursors are stored and you can rename them at will... but, I seriously doubt that if you didn't take the time to do that simple task, your app can't possibly be "the end to world hunger" or anything... so have fun changing a users settings and have fun explaining why your app is far more important than anything they currently have on their PC.

btw, if you feel I insulted you in any way, complain to the people who run the forum. If I'm booted, I'll survive. That much I guarantee.... I've recv'd the MVP award from Microsoft for the last 7 years in a row helping people with their VB and programming questions, so a forum here and a forum there really doesn't make much of a difference in my life... it's not like I'm being paid, or anything.... not being paid is a benefit though, since that means I don't need to kiss anyone's ass or stroke their egos when I try to help.... which is all I'm trying to do... in the long run, fighting the built in functionality of the OS is a "no win" situation and changing the users preferences is a very selfish thing to do.

Excel, Word, Access, VB itself or any other "professional" app *does not* mess with a users preferences. The users paid a lot of money and *literally OWN" the PC you're messing with. They're the ones who decide what their cursors look like... Why should it be up to you what their screen looks like when the OS is busy? How in the world can you know how many apps they'll be running while yours is doing its work?

But... have fun, complain if you want, since I've been programming in different flavors of Basic and Assembler language since 1981, I can give you the code to do just about anything to a PC, including format their drive without them knowing until it's too late... but I won't.

Good luck and my reply was a "quite irrelevant post" to a quite irrelevant question... take that how ever you'd like.
Was This Post Helpful? 2

#5 floydus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 30-June 08

Re: How to replace cursor pointer with SetSystemCursor from “BUSY” or “APP

Posted 28 June 2012 - 11:23 AM

There are no irrelevant questions, only irrelevant answers. And believe me, there are tons of unnecessary post on the web, I just saw one ! :censored:

If someone is asking you salt on the table, can you just pass the salt without starting to dwell about Hypertension, Abnormal Heart Development or Kidney Disorders... Just pass the ..... salt !!! It is so annoying having to read all that crap when all you're interested in is finding a solution to a problem.

I came here because I am having an issue reverting the cursor back after a change.
The only thing I saw is a total irrelevant answer.

Below is my code, I'm able to get the 'transparent' cursor showing easily, but reverting it back has no effect at all, I need to reboot everytime....

I also tried GetCursor() at the beginning of the whole process, before any change, but the cursor that came out was the 'Wait' cursor. :innocent:
Setting it back using GetCursor reference worked out but this is not what I wanted, I only want to set it to IDC_ARROW.


if (isVisible) 
            {
                IntPtr oldCursor = mySavedCursor.Handle;
                bool ret_val = SetSystemCursor(oldCursor, System.Convert.ToUInt32(OCR_SYSTEM_CURSORS.OCR_NORMAL));
                //DestroyCursor(oldCursor);
            }
            else 
            {
                hcurTransparent = LoadCursorFromFile(System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName) + @"\transparent.cur");
                SetSystemCursor(hcurTransparent, System.Convert.ToUInt32(OCR_SYSTEM_CURSORS.OCR_NORMAL));
                //DestroyCursor(hcurTransparent);
}


I also tried loading the System.Windows.Forms.Cursors.Arrow using it's handle, no luck.

Only you did that or know how to achieve that, please take a few seconds to post back the solution, I don't need speeches on anything else, thanks.
Also, any steps, rules and advises on how to use SetSystemCursor, LoadCursor, DestroyCursor and CopyCursor would be much appreciated.

Thanks.
Was This Post Helpful? -2
  • +
  • -

#6 floydus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 30-June 08

Re: How to replace cursor pointer with SetSystemCursor from “BUSY” or “APP

Posted 28 June 2012 - 12:46 PM

All right I found a solution somewhere.

The trick is to call SystemParametersInfo and it works perfectly.
Two days I've been googling for that, hopefully that would help others !
const uint SPI_SETCURSORS = 0x0057;
SystemParametersInfo(SPI_SETCURSORS, 0, 0, 0);



If you know of other ways to do it, I still want to know.
Thanks.
Was This Post Helpful? 2
  • +
  • -

#7 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: How to replace cursor pointer with SetSystemCursor from “BUSY” or “APP

Posted 28 June 2012 - 01:41 PM

floydus, please don't be ill-mannered towards people that are trying to give advice, just because you don't like the advice or don't feel it's pertinent. If you feel that your time is being wasted when people put a good deal of effort into their answers, you can always look somewhere else. Nevertheless, thank you for posting your solution.

Your salt analogy is just fine, unless someone has put sugar in the salt shaker. In that case, your analogy suggests that you will be annoyed if they go to the trouble of telling you so.

This post has been edited by BobRodes: 28 June 2012 - 01:43 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1