Solved

Windows Message for F5

Posted on 1998-03-10
16
561 Views
Last Modified: 2012-05-04
What message is windows sending when the user hits F5 to update the desktop in WIN95?
0
Comment
Question by:SGC
  • 6
  • 4
  • 3
  • +3
16 Comments
 
LVL 8

Expert Comment

by:mrmick
Comment Utility
The WM_KeyDown message indicating that the F5 Key was pressed.

0
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
I think he mean what message Windows95 sends IN ORDER to update the desktop
0
 
LVL 8

Expert Comment

by:mrmick
Comment Utility
MikeP, the desktop window procedure performs the update when the WM_KEYDOWN key specifying that the F5 key was pressed is received.  There are no special "messages" by design to cause this to happen.

0
 
LVL 2

Author Comment

by:SGC
Comment Utility
I understand that much, but Windows certainly must use some sort of function or message to inform the desktop to update itself, otherwise just pressing F5 would do nothing.
The reason I asked the question is because I can't seem to get the desktop to update itself by...
1) Obtaining the desktop handle using GetDesktopWindow
2) Giving the Desktop focus with SetFocusAPI
3) Setting the Desktop as the active Window with SetActiveWindow
4) Sending the WM_KEYDOWN with KEY_F5 with SendMessage(xx,WM_KEYDOWN,KEY_F5,&H18) to the Desktop (xx being the desktop handle)

This does not work, which is why I wanted to know what the message is. I've tried everything I can think of...including simulating mouse clicks on the desktop and telling the desktop with WM_ACTIVATE and WA_ACTIVE that it is in fact the active window.

Let me know if I'm doing something wrong, or rather, what I'm doing wrong.
0
 
LVL 8

Expert Comment

by:mrmick
Comment Utility
Well, I am a bit frustrated at this point because I did provide the correct answer to your question.  Apps written in C under the Windows OS respond to different messages (known as events in VB).  I used Microsoft Spy++ to learn the message that caused the desktop to update... so I'm certain that the WM_KeyDown message with Key_F5 is the message that initiates the refresh.

I now understand that it doesn't solve you're problem and I certainly don't wish to see anyone through away points; however, I'm bothered that you didn't spell out the problem the first time.  How do I know that if I take the time to play with this and find your answer that there are other details I don't know about that would make you reject a solution to the "current" problem.

0
 
LVL 2

Expert Comment

by:chris_a
Comment Utility
I guess you want to get the desktop to redraw, look at sending an InvalidateRect (Win32 API) to NULL, to tell windows that all the windows need refreshing.
0
 
LVL 8

Expert Comment

by:mrmick
Comment Utility
Good answer chris_a, I would expect that to satisfy SGC's newly described problem.
0
 
LVL 2

Author Comment

by:SGC
Comment Utility
mrmick...you did not provide the correct answer to the question, you merely provided me with something extremely obvious in the hopes that I would give you 100 points!
Of course Windows is going to recieve a WM_KEYDOWN when the users hits F5, as they would if they hit F1 or F2, which, as I'm sure you're aware achieve very different results. My question was phrased quite logically...MikeP seemed to understand what I was talking about, as did chris_a.
I came to this board to ask a simple question and instead, you treat me as a newbie who asked how to play a sound. I do not appreciate the attitude you take with your responses, and I'm sure there are others who feel the same way. Just because you rank number one in the experts list does not mean that you know all. Get used to it.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 2

Author Comment

by:SGC
Comment Utility
By the way, thanks Chris_a
0
 
LVL 2

Accepted Solution

by:
chris_a earned 100 total points
Comment Utility
Do I get some points then (my first) !

0
 
LVL 8

Expert Comment

by:mrmick
Comment Utility
That's fine SGC but I don’t claim to be an expert at reading minds and FYI - there isn't a "special message" just for updating the desktop as you and perhaps MikeP seem to think.  I though your question was quite clear and I find it rather funny that you would accuse me of treating you like a "newbie" for not seeing that when you ask: "What message is windows sending when the user hits F5 to update the desktop in WIN95?"...  I should have guessed right off that the correct response would be: "InvalidateRect (Win32 API)".  Do you suppose the "F5" Key automatically invokes the InvalidRect Function?

I stated that I didn't expect you to through away points and I do not want these points.  The answer I posted may have seemed "extremely obvious" to you in hindsight, but if that’s the way you feel, I think you might consider how "extremely obvious" it is that the answer was the correct and only answer to the question you posed - before you changed the question that is.  My beef is that you chose how and what you were asking and after getting the answer... you changed the question.

If you wish to continue this discussion, you may email me at mick@owen.wa.com

0
 
LVL 8

Expert Comment

by:mrmick
Comment Utility
I don't know... that was a little harsh.  Sorry.  I don't have a problem with you.  I don't wish to cause you undue grief over a pet peeve of mine.

By the way, I can't return to review comments after you've accepted chris_a's answer so if you wish to communicate with me after grading chris_a's answer - it will have to be through email.



0
 

Expert Comment

by:LMSuporte
Comment Utility
well, I have some source code that changes the desktop color and/or wallpaper and then refreshs itself. If you only change the registry to do such things the desktop will not refresh itself, but with the functions from these project it will do it. If you want to, I will send you the source code , or post it here ( no points needed)

0
 
LVL 2

Expert Comment

by:chris_a
Comment Utility
LMSuporte, do you mean using the SystemParametersInfo API call?
0
 
LVL 2

Author Comment

by:SGC
Comment Utility
Thanks guys.

.
0
 

Expert Comment

by:Saimon
Comment Utility
How do you declare the InvalidRect function? I mean, in what library is it? I can't find it.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now