Solved

Windows Message for F5

Posted on 1998-03-10
16
590 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
  • +3
16 Comments
 
LVL 8

Expert Comment

by:mrmick
ID: 1458813
The WM_KeyDown message indicating that the F5 Key was pressed.

0
 
LVL 8

Expert Comment

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

Expert Comment

by:mrmick
ID: 1458815
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:SGC
ID: 1458816
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
ID: 1458817
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
ID: 1458818
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
ID: 1458819
Good answer chris_a, I would expect that to satisfy SGC's newly described problem.
0
 
LVL 2

Author Comment

by:SGC
ID: 1458820
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
 
LVL 2

Author Comment

by:SGC
ID: 1458821
By the way, thanks Chris_a
0
 
LVL 2

Accepted Solution

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

0
 
LVL 8

Expert Comment

by:mrmick
ID: 1458823
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
ID: 1458824
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
ID: 1458825
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
ID: 1458826
LMSuporte, do you mean using the SystemParametersInfo API call?
0
 
LVL 2

Author Comment

by:SGC
ID: 1458827
Thanks guys.

.
0
 

Expert Comment

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

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

729 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