473,796 Members | 2,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.tx t"

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.t xt".

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 3838
CMM
SHChangeNotify API
http://msdn.microsoft.com/library/de...angenotify.asp

--
-C. Moya
www.cmoya.com
"Robert Mileski" <r_*******@hotm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.tx t"

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.t xt".

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
3810
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 counter functionality and read/insert some data in a MS Access database on that Windows 2003 server. The weird part is, as long as the web page is very short in size, I can hit the refresh button and Internet Explorer will reload the page and display...
5
73218
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
3675
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 have been talking about this a lot over the last two months. All of the features that are missing in the compiler for Beta 1 are now available in the tools refresh. These refreshes are builds out of live development branch and thus are not...
0
1838
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 with the file system (including printing) from the web browser. How do I disabled this so I can get my windows form control to work within IE? Also, do any have any printing code or know how I can implement multipage printing using the...
5
2712
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 Explorer crashed with exception code 0xc0000005 mshtml.dll at address 0x000000007d55833f. This is IE 6 SP2 on Windows XP with all the latest patches installed. The same thing happens on Windows 2003 Server. See sample code below. Any ideas? ...
3
1158
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 looking at, using a providers SDK tools. This is reasonably effective - but there is a few seconds on jumping between one month and the next (having optomised the rest of the app). However I could change it to only refresh on command, and catch...
13
3942
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 .NET creates i get the following error message: "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in VisioTimeline.exe
3
15008
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 this SQLDataSource I can retrieve my drop down list data. SELECT DISTINCT responsibleMinister FROM responsibleMinister WHERE languageID = @languageID
9
1806
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 related to Windows GUI. I've created a "Form1.vb" file in my project, added a menustrip, etc. When a user clicks on a menu item, how do I get it to show a new form in the same window?
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.