473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Regarding Refresh the desktop in windows.

Hi,

When I close the File.exe the menubar remains on the desktop unless and untill i refresh the desktop in windows(XP,server2003).

How should I refresh the windows desktop in VB6.0 using Windows API and which API is useful?

please help me as soon as possible.

Thanks,
Pankaj
Oct 22 '07 #1
4 3064
debasisdas
8,127 Expert 4TB
When I close the File.exe the menubar remains on the desktop unless and untill i refresh the desktop in windows(XP,server2003).
How can the menu remain on the desktop after colsing the exe.

What are you doing in the exe ?
Oct 22 '07 #2
Killer42
8,435 Expert 8TB
Could you try an alternative approach? For instance, hiding the form with the menu bar first, and doing a DoEvents to let Windows update the display, before actually ending the program.
Oct 22 '07 #3
Hi,

The MenuBar in my application is loading from third party. It having "refresh" function I have tried but not worth.

So I decided to go for Win API, by refreshing the desktop itself using WinAPI.

I have tried with "User32.dll" API with following peice of code.
Expand|Select|Wrap|Line Numbers
  1. Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
  2. Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  3. Private Declare Function EnableWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal fEnable As Long) As Long
  4.  
  5. Public Const SW_HIDE = 0
  6. Public Const SW_SHOW = 5
  7.  
  8. Dim hWnd As Long
  9.  
  10.  hWnd = FindWindow("Progman", "Program Manager")
  11.       ShowWindow hWnd, SW_SHOW
  12.       EnableWindow hWnd, Visible
  13.  
----> Still it's not working properly.
Please do help me.

Thanks,
Pankaj
Oct 23 '07 #4
Killer42
8,435 Expert 8TB
Have you tried the much simpler method, of just covering up the whole desktop with a form, then removing it? In other words, maximize a form, DoEvents (to let Windows update the display) then simply close your application. If the whole desktop is hidden behind something else, that will force Windows to redraw it. Or in Windows terms, that will "invalidate" the whole desktop.

By the way, I don't know whether that API code will work or not. But it looks to me as though it's out of date. Program Manager hasn't been used since about Windsows 3.1, I think.
Oct 23 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: kiplring | last post by:
I wrote a program which draw a dancer at cornor of desktop. ( I Accessed through hDC) But It has a problem. I remains all trait at the desktop until I invoke any Redraw( Refresh) action - click,...
7
by: Richard | last post by:
If the grid is dragged off the screen and back on the data is visible. Tried a dg.refresh() and Inactivate(). Can I do this by overriding custom base class OnPaint that my form inherits from? I...
1
by: muttu2244 | last post by:
Hi Everybody Here i have a query for you, that is How can I refresh the windows desktop using the python script? Thanks in advance for having given a thought on my query. Regards
2
by: Robert Mileski | last post by:
I've made some program in Visual Basic 2005 that works with changing files and folders. After I've finished it, the main problem is to refresh the Windows OS. I mean the same thing as when we press...
6
by: Mikus Sleiners | last post by:
Is there any way to enable exception throws in VS 2005, that occur during binding operations? I am upset that i can't see exceptions that are thrown during binding operations. It's very hard to...
0
by: Bill Nguyen | last post by:
We have the need to refresh all active windows on a desktop PC every 5 minutes or so. We have an application that displays some data in 4 windows (manually loaded 4 times and arranged to fit the...
1
by: Tee | last post by:
Hi, How do i refresh windows destop in c#? currently with my c# app, it deletes an existing desktop icon and recreates a new one base on the new informations the user provided. All seems to...
3
by: Manfred Meier | last post by:
Hello In my code I create a folder on the desktop or any other folder location. Unless I press F5 while the Desktop or the Explorer containing the created folder has the focus this new folder...
2
by: =?Utf-8?B?VVNBT3o=?= | last post by:
I am using Windows Vista Ultimate (x86). I accidently deleted my Desktop Recycle Bin. I restored it (Control Panel/Personalise/Change Desktop Icons). I clicked on the Recycle Bin (Full) icon...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.