Solved

Windows Message for F5

Posted on 1998-03-10
16
566 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBS file using code from 2nd file (txt or vbs) 4 30
MS Date Picker 64 bit 32 bit issue 12 49
How to compare ms sql hashbytes results within vb6 5 51
Problem to With line 4 36
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

937 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

5 Experts available now in Live!

Get 1:1 Help Now