473,378 Members | 1,355 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,378 software developers and data experts.

Refresh the Windows OS from within Visual Basic

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 F5. Than everything
refreshes and if we have made changes, they are immediately shown.

Could someone help me with this matter? A possible solution or maybe an idea
how to do that?

Suppose that you see in front of you the Windows XP Desktop and you press F5
or from the menu with mouse right click you choose Refresh. That refreshes
the screen. Or in Explorer the same happens. THAT is what I want to do. Not
reboot the computer. And, refresh is not equal to Rebooting the machine. I
don't know how you came up with this.

And about the program, for example: The program moves a file from one place,
changes its name, and then again moves the file to the same location. If you
open explorer in that folder, and you execute the above explained program,
the explorer won't show you the changed name. You must press F5 to refresh
the Explorer, in order to see that the file has been changed.

Suppose this case:

1. Open Explorer, or my computer and in C:\ open a folder named Temp

2. Create a file there named "text.txt"

3. Leave the explorer open

4. Now make a program in VB, that renames this file into for example:
"example.txt"

5. Now compile and run the program. (The filename is changed without a
problem)

6. Now go to the Explorer window, and you will still see there the file
under the name "text.txt" and not "explorer.txt".

7. Press now F5, and there it is! You see that the file is changed!

That is what I want to refresh! When I make a change on the hard disk, I
want all the active programs working with the disk (like explorer) to notice
the change, and refresh themselfs.

I suppose I should do this now through Win API. But I don't know which API
command actually does the trick.

Was my explanation better ?

ps.. And still another thing why I'm moving a file instead of renaming it.
Try this: make a program in VB that renames a file called "text.txt" into
"Text.txt" with the difference of the second file has a big letter T. Visual
basic will report Error, there is already a file named with the same name.
Operation failed! Than YOU MUST move the file, and put it back with a new
name.
Thank you,

Robert Mileski.

Mar 12 '06 #1
2 3808
CMM
SHChangeNotify API
http://msdn.microsoft.com/library/de...angenotify.asp

--
-C. Moya
www.cmoya.com
"Robert Mileski" <r_*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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 F5. Than everything
refreshes and if we have made changes, they are immediately shown.

Could someone help me with this matter? A possible solution or maybe an
idea
how to do that?

Suppose that you see in front of you the Windows XP Desktop and you press
F5
or from the menu with mouse right click you choose Refresh. That refreshes
the screen. Or in Explorer the same happens. THAT is what I want to do.
Not
reboot the computer. And, refresh is not equal to Rebooting the machine. I
don't know how you came up with this.

And about the program, for example: The program moves a file from one
place,
changes its name, and then again moves the file to the same location. If
you
open explorer in that folder, and you execute the above explained program,
the explorer won't show you the changed name. You must press F5 to refresh
the Explorer, in order to see that the file has been changed.

Suppose this case:

1. Open Explorer, or my computer and in C:\ open a folder named Temp

2. Create a file there named "text.txt"

3. Leave the explorer open

4. Now make a program in VB, that renames this file into for example:
"example.txt"

5. Now compile and run the program. (The filename is changed without a
problem)

6. Now go to the Explorer window, and you will still see there the file
under the name "text.txt" and not "explorer.txt".

7. Press now F5, and there it is! You see that the file is changed!

That is what I want to refresh! When I make a change on the hard disk, I
want all the active programs working with the disk (like explorer) to
notice
the change, and refresh themselfs.

I suppose I should do this now through Win API. But I don't know which API
command actually does the trick.

Was my explanation better ?

ps.. And still another thing why I'm moving a file instead of renaming it.
Try this: make a program in VB that renames a file called "text.txt" into
"Text.txt" with the difference of the second file has a big letter T.
Visual
basic will report Error, there is already a file named with the same name.
Operation failed! Than YOU MUST move the file, and put it back with a new
name.
Thank you,

Robert Mileski.

Mar 14 '06 #2
Robert Mileski wrote:
ps.. And still another thing why I'm moving a file instead of
renaming it. Try this: make a program in VB that renames a file
called "text.txt" into "Text.txt" with the difference of the second
file has a big letter T. Visual basic will report Error, there is
already a file named with the same name. Operation failed! Than YOU
MUST move the file, and put it back with a new name.


Why not change the name to something else and then name it to what you want?
That way there's no chance that it will end up moving the file between
disks, which would be very time-consuming compared to just renaming it
twice.

There is a function to get a unique filename, but I don't know what it is.

Andrew
Mar 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wolfgang Kaml | last post by:
Hello All, I have been researching newsgroups and knowledgebase all morning and not found a solution that would solve the problem I have. I am having an ASP or ASPX web page that implement a...
5
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
18
by: Brandon Bray [MSFT] | last post by:
Shortly, the Visual C++ Tools Refresh will be available on the MSDN Visual C++ devcenter. You will need to have installed the Visual Studio 2005 Beta first. <http://msdn.microsoft.com/visualc> I...
0
by: Nigel | last post by:
I successfully create a .NET Component (Visual Basic .NET) that would print, unfortunately when used within a web browser it appears that .NET security doesn't allow you to run code that interacts...
5
by: Bryan Young | last post by:
I am trying to smoothly refresh a page on an interval. I am using setInterval to set this up. When the interval expires, I do a document.form.submit(). When this line of code runs, Internet...
3
by: Antoine | last post by:
What is considered best when doing an application that allows you to browse data eg by month? I've currently got an app working so it does a complete refresh when you change the month you are...
13
by: Lee Newson | last post by:
Hi, I have just written my first application using VB.NET. The app works fine when i am running it within .NET for debugging purposes, however when i try to run the app from the .exe file that...
3
by: Brad Isaacs | last post by:
ASP.NET 2.0 / SQL Server 2000 db / Visual Basic Code behind On my .aspx page I have added an SQL Datasource that contains the SQL query to retrieve the list for my Drop Down List Box. Using...
9
by: Scott Stark | last post by:
Hello, I'm *just* delving into Windows forms-based programming without the benefit of any books, etc. I have a background in light ASP.NET work, so forgive me if this is a really basic question...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.