"Reload file?" error in codeblocks - codeblocks

I'm using codeblocks to as my IDE for C++ and every 10mins or so I get the following
error message:
"Reload File? File c:...node.cpp is modified outside the IDE. Do you want to reload
it? (you will lose andy unsaved work)" Yes/No/All/Cancel
If I click yes by mistake sometimes I lose the last couple of minutes of work. If I
click no then everything remains ok.
So I downloaded "Process Monitor" to find out what program was accessing my cpp file
and it tells me that SVCHost may be the culprit.
As far as I'm aware SVCHost is responsible for all sorts of things. Does anyone have any idea what I can do to stop receiving this error message?
N.B. This error message didn't appear for the first month or so that I used codeblocks,
but I have no idea what I've done that might have caused the problem.
[Screenshot][http://i44.tinypic.com/sgk3sx.jpg]

I came across the same problem and I resolved it by removing a tick in front of "check for externally modified files" in
Settings -> Environment -> General settings

You're right in that svchost is a generic process name that is used by a multitude of different services. I think the reason was to prevent a lot of processes for every tiny little service that might want to do something - a group of them will share a single svchost process.
Process Explorer from Sysinternals can be used to figure out what services are being performed by a specific svchost process by finding the process ID (1296 in your JPEG file) and double-clicking on the entry.
Then, in the properties dialog that appears, choose the services tab and it will show you the particular services using that process.
If you don't want to (or can't) install Process Explorer, you can use the command-line:
tasklist /svc /fi "imagename eg svchost.exe"
to get a list of all the services in each process.

Related

Action cannot be completed because another process is using the file

Not sure whether I have the message above exactly correct but I run into this often. I try to use Windows to delete a directory or a file and it tells me I can't because the file is in use by another program. It doesn't say what process is using it.
Sometimes it is clear what is using it, but other times it is not. I open the Task manager and go through all the processes but nothing stands out.
Is there a way to determine what has a file open, and a solution (other than rebooting)?
I suppose most of the time it may be Eclipse related but certainly not all of the time.
I use Process Explorer
Ever wondered which program has a particular file or directory open?
Now you can find out. Process Explorer shows you information about
which handles and DLLs processes have opened or loaded.
You can add the column like shown below (Window Title) and it should help you find the file you are looking for, and what is using it:
If you end up choosing to use this program instead of Task Manager, there is an option for that which will open this instead of Task Manager:
If you decide to "Replace Task Manager" and ever get stuck where you cannot 'undo' what you've done (Meaning, "The original Task Manager will no longer open")... You can modify the registry listed here and delete the Debugger entry. (In this example, I have this path to a network drive).
I had this problem in Excel, where some files would be active, but not visible to me, either on my screen or in the task manager. The way I solved it was to use the command prompt to kill the task:
Open command prompt (type cmd in windows search at the bottom left of your screen)
Type "tasklist"
Find the task you want to terminate (for me it was EXCEL.EXE)
End the task by either using the image name (type "taskkill /im EXCEL.EXE", or whatever program you want to end. This will kill all tasks with that image name) or using the ID (i.e. "taskill /pid 1234, or whatever ID the program has. This will kill that specific task)

How do I monitor the status of a program running in Windows 10?

I know we look at the list of process with tasklist command.
However, what I would like to know is what happens within the process.
First part:
For example, I am running MS Word.
So I click on "File" button. It will cause the drop down box to open.
However, what happens in OS and is there anyway of monitoring this?
(Like a debugger or a log message to track the action that will show like
"MouseClicked Button File" and "Drop down opened")
Second part (If there is no solution to the first part):
As programmers we write programs in different languages like java, C/C++ and so on but all of them are compiled into .exe/.jar files.
So I should be right to say that all of this compiled are readable by the OS so we should be able to write the program to create a software that will be able to do the above all of them are read by the OS.
Third Part:
Please give me some tips to start working on this project that will show the status of a running program.

the action can't be completed because the folder or a file in it is open in another program

When deleting a folder that contains a file that is in use, it is common to see the following Windows 7 message,
"The action can't be completed because the folder or a file in it is open in another program."
I commonly have 10-20 programs open, 30-40 folders open, etc. In short, I have many executables running and many windows explorers open.
Does anyone know a simple trick to determine which program is using the file?
Does anyone know a simple trick to determine which file is blocking the delete operation?
This information would be highly useful to display in the Windows 7 'folder in use' dialog, but it is missing.
Consequently I have to close many of my open applications and folders to complete the delete operation. This is annoying because I have to re-open them after deleting them.
Have you seen this other question or this one?
I use to run ProccessExplorer and Find for the blocked folder.
Closing the application Malwarebytes allowed me to delete what I needed to via Windows Explorer.

Releasing Windows file share locks

This problem crops up every now and then at work. Our build machine can have it's files accessed via a normal windows file share. If someone browses a folder remotely on the machine, and leaves the window open overnight, then the build fails (as it has done now). The explorer window left opened points at one of the sub folders in the source tree. The build deletes the source, and does a clean checkout before building. The delete is failing.
Right now, I'd like to get the build to work. I'm logged in from home, and I'd rather not reboot the build machine. I'm unable to get hold of the person whose machine is looking and the files, and I can't remotely reboot their machine.
When a windows share has a lock, the locking process is System, so I don't think I can kill it, as with normal locks.
Does anyone know a way to release the lock on a shared folder without having to reboot the machine?
If you are admin on the server sharing the file over the network, you can use the Windows in-built feature:
Start → My Computer → Right-click → Manage gets you to the Computer
Management console
In the left nav, navigate to Systems Tools → Shared Folders
You can view Shares, Sessions & Open Files here. This allows you to find out who has opened which files from which workstations.
Right-click on an item in the list to be able to remove the file lock.
Hope this helps.
Found a solution.
Find the process using Process Explorer:
Download and extract procexp.exe
In Process Explorer use the "Find Handle or DLL..." command from the "Find" menu
Enter in the name of the directory which is having trouble deleting
A list of open files which match that name should be shown. Take some guesses and find which one is failing to be deleted. If the file is locked by a windows share, the process holding the file will be System
Note down the directory which was left open
Download and install the Unlocker (Warning: Link removed, as it contains malware)
Install Unlocker, disabling the option for Explorer extensions and other junk
Unlock the directory
Open up a cmd window, and navigate to C:\Program Files\Unlocker
From the cmd window, run Unlocker.exe "the-path-to-the-locked-folder"
A dialog will pop up confirming the lock release. Use the unlock button to unlock the file
Now the directory should be unlocked, and can now be deleted.
Try Process Hacker:
https://wj32.org/processhacker/
Process hacker is like Process Explorer on steroids.
To find the offending process, press CTRL+F or click the "Find Handles of DLLs" button and search for the file name.
Once you find the file in the find handles dialog, you can simply right click the file there and choose "close". (at least for v2.39.124)
Older versions had a "terminator" option in the context menu of the process.
Right click on the offending process --> Miscellaneous --> Terminator --> Select termination techniques. Note that some are possibly dangerous and may have unintended consequences.
I've had similar problems, and none of these suggestions I've seen above look suitable for automated overnight builds (as the original poster implied) because they all require manual effort to hunt down and kill the locks.
The only method I've tried that seems to work reliably is to remove the share itself, make the build, then add the share back. Here's one way of removing the share automatically:
D:\Projects>net share Projects /DELETE /Y
Users have open files on Projects. Continuing the operation will force the files closed.
Projects was deleted successfully.
(NOTE: Creating the share again automatically can be a pain if the privilege groups you need to give it are messy.)
The way i do it is by using both OpenFiles.exe and Handle.exe
You can run them in any order and you will have your resource fully unlocked.
OpenFiles: to disconnect File Sharing sessions
Handle.exe: to release any open handles (don't try to close handles belonging to pid4, since that's the system process)
You can automate this by using powershell, batch, or any language of your choice.
Another option is, starting from Windows Vista, to use the Windows tool built into the system:
monitor resources: perfmon.exe /res
Extracted from: Http://www.sysadmit.com/2017/06/windows-how-to-know-that-process-has-open-a-file.html

Clearing the Windows "Run" dialog history without rebooting

I am currently working on a program to immediately clear the list of previously-run-commands which appears in the Windows Start -> Run dialog. The procedure for clearing this list by removing the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU key is well documented; however, before these changes take effect, it seems to be necessary to do one of the following:
Restart the computer
Select Start -> Shut down, and then select Cancel.
Neither of these is ideal for the task I am trying to accomplish: #1 is extremely disruptive to the user, and #2 appears to require additional user interaction.
Does anyone know how to immediately (and programmatically) force a reload of this information without requiring any user interaction, while also minimizing disruption of the user's other activities? I would like for the user's Run history to be cleared out immediately after executing my program, without requiring any further action on their part (such as using the "Shut Down" -> "Cancel" trick in #2 above) or forcing a reboot.
Or, to approach the problem from a different angle: When clicking Start -> Shut Down -> Cancel, Windows Explorer reloads the RunMUI key. Is there a way to force a similar reload without having the user select Shut Down and then Cancel?
Things I have already tried:
Monitoring the explorer.exe status using procmon while selecting Shutdown and then Cancel. I see Explorer writing to the RunMRU key, but have not been able to determine what triggers this.
Numerous Google searches along the lines of "reload runmru without reboot". Most results still recommend method #1 above, although a few suggest #2.
Limited MSDN API examination. The RegFlushKey call appears promising, but I haven't ever used it before, so I don't know if it will apply to registry information cached by different processes.
Any suggestions or other information would be greatly appreciated.
Have you tried ccleaner?
http://www.ccleaner.com/
Not a full answer to your question, but I did find a third way to trigger the clearing of the run command from this article in PC Mag.
Killing explorer.exe and then restarting it will also clear the run list after the registry modification.
I have a nasty hack for you. Show the window programatically, hide it immediately (programatically) and click cancel on it (well, you guessed, programmatically).
You might try looking for the icon cache flush API, or other ones, I wouldn't be too suprised if they had side effects like the one you are looking for.
I've seen instances where it actually works, even the F5 key doesn't work? Try this, ctrl>alt>delete then go to task manager, processes tab...end explorer.exe. Then click on file new task and type explorer.exe, then check...does that work?
Windows XP
Right click on the taskbar
Properties menu option
Start Menu tab
Customize button
Programs pane
Clear List
Click on OK
This calls a Windows API function that refreshes the explorere.exe taskbar process and also clears the list (no need for registry edits).
As far as I know, it relies on the explorer.exe process that hosts the start menu/taskbar/desktop being closed and reopened. There is no "clean" way to do this that I am aware of.
If you really need to do this without user interaction, you need to close all explorer.exe processes and relaunch one.
Here's a rudimentary C# program to do that;
using System.Diagnostics;
Process[] procs = Process.GetProcessesByName("explorer");
foreach (Process proc in procs)
{
proc.Kill();
}
Process.Start("explorer.exe");
Note that this will close all "Windows Explorer" windows open, and may or may not open an additional "Windows Explorer" afterwards.
I just tested that on Windows XP 32bit, and it did indeed clear the Run command cache.
HKEY_CURRENT_USER\ Software\ Microsoft\ Windows\ CurrentVersion\ Explorer\ RunMRU\

Resources