|
pavan_sw wrote: ut When any files are opened in the meomry stick it is not able to disabling memory stick.
This is the intended behaiviour: The user is asked to close all files on the stick.
When your program has opened the files by itself, it can also close all files from the stick and try dismounting again.
If you have not opened the files, but another process has, maybe you can quit the processes holding the files open?
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Thanks, Then how to identify which process(s) using files on memory stick.
|
|
|
|
|
I am trying to hook windows messages whenever there is a z-order change. I have been able to do that successfully when the window to be hooked is the active window. It get WM_ACTIVATEAPP and WM_WINDOWPOSCHANGING. But no message is received when the window hooked is out of focus.
Please help how can this event be trapped.
drai
|
|
|
|
|
Hi all,
I would like to know api or classes for Closing manually opened files in a specific drive in windows
Any suggestions on above are greatly appreciated...
Thanks
-pavan
|
|
|
|
|
how are these files opened ?
in general, the application that is opening a file is intended to close it then !
|
|
|
|
|
These files are opened by manually(with keyboard or mouse). I want to close them programatically
|
|
|
|
|
pavan_sw wrote: These files are opened by manually(with keyboard or mouse). I want to close them programatically
this doesn't mean anything. there forcedly and application that holded the opening. if you double click on a text file, the application that opens the file is notepad (or maybe another if you changed the association).
i think you're facing a wrong problem.
|
|
|
|
|
pavan_sw wrote: Closing manually opened files
What do you mean by "manually"?
Every function that opens a file has a matching function for closing it.
A successful call to CreateFile() will be followed by a call to CloseHandle() .
Others are:
fopen() - fclose()
CFile::Open() - CFile::Close()
You cannot force a file handle to be closed from outside a process that has opened a file. The process that opened the file is also responsible for closing it.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
manually means files opened with key board or mouse.. I want close them programatically
|
|
|
|
|
I suspect this "how to close opened files"-thread is connected with the thread above about memory stick.
I get the impression that you want to monitor files that are opened on the memory stick and force them to close when something else happens?
Q1: Is the assumption above correct?
Q2: Why do you want to do it?
Q3: When do you want to do it?
As toxcct said, it seems like you're facing the problem the wrong way.
What you should do is figure out what applications have opened the files on the memory stick, if possible, and send those application a WM_CLOSE message.
To be able to guide you better, you should describe your problem in more detail.
What problem are you trying to solve, described from a user perspective.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
Thanks roger,
yes, This is related to memory stick Thread.
Complete problem is as follows...
I am writing an win32 service application which gives access to memory stick in maintenance mode. In normal mode user can't access memory stick. The problem is when switching from maintenance to normal mode with memory stick connected to the system and if any files of memory stick is opened then iam not able disable the memory stick in normal mode. Because extenal process are using files on memory stick. So iam thinking to close all process which are using files on memory stick before disabling. Is my approch is correct??, If correct then how to identify processes which are currently using files on memory stick... Kindly do any help in this
Thanks
--pavan
|
|
|
|
|
If you're in control over the service that grants access to the files on the memory stick, can't you simply register the process handle in the service?
For info about how to close an application or process: see here[^].
The article also contains a code example which is great to have as reference.
The tricky part is to know what processes that are accessing the memory stick when you want to disable it.
Perhaps you can find anything useful in the CP section about processes here[^].
Hope this helps
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
If you opened the files then use flcolse() or CloseFile() depending on the method you used to open it. If the file belongs to another process, you cannot close it without first getting the open handle to the file, which is near impossible to do.
|
|
|
|
|
Hi everyone,
i like to override a ContextMenu as far as the first item of the menu is directly selected.
Background : My application should be controled with mouse, with mouse & keyboard and ONLY keyboard.
So, a right-click on a specific element opens a context-menu and the ENTER-Key for example opens the same context-Menu.
But it's annoying for the user to hit each time a key down to highlight the first item and a second
hit of the ENTER-Key to select this item.
Before i begin to review all the mechanism behind a ContextMenu and manipulate it,
is there somebody who has already changed this "effect" ?
I know that's not "Windows-Standard" but it helps the user to navigate faster
Thanks
|
|
|
|
|
Use CMenu::SetDefaultItem
Or
::SetMenuDefaultItem( ... );
|
|
|
|
|
Thanks for your fast answer, but it provokes not the effect that i desire.
With CMenu::SetDefaultItem the specific Item is bold, but not selected.
If the context menu is opened and the mouse-pointer isn't over an item, it seems like this :
http://www.olapxsoftware.com/doc/OlapXApp.en/ContextMenu.gif
but i wish to select the first item directly ( so that the first element is directly marked in blue )
|
|
|
|
|
baerten wrote: but i wish to select the first item directly ( so that the first element is directly marked in blue )
HiliteMenuItem
|
|
|
|
|
how can i make help file for my project visual c++ 6.0 (CDialog base application)?
Bravoone
|
|
|
|
|
Hi,
If you want .hlp type help file you can use 'Help workshop' in Visual Studio Tools.
1. U have to create a .rtf file( say using Microsoft word ) in which the help text contains.
2. Create a new project in Help work shop
3. Add the RTF file in the Help project
4. Compile
Krishnakumar
|
|
|
|
|
Here yea go,
Creating and Using HTML Help in MFC applications[^]
Use HTML Help, not the old WinHelp, Winhelp is no longer supported in Vista.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Iam getting Application error in vc++,
The error is
The instruction at "0x00004e47" referenced memory at "0x00004e47".The memory could not be "read".
What i have to do to clear this error?
Thanks in advance.
Siddharth
|
|
|
|
|
siddharthsan wrote: What i have to do to clear this error?
Use your debugger to locate the problem. You are trying to access memory where you shouldn't, so you certainly did something wrong.
(To start your debugger, press F5, to set breakpoints in your code press F9). If you never used your debugger before, then it is time to start using it, you cannot imagine the time it will save you.
|
|
|
|
|
|
Somewhere in u'r code, u r using Dangling Pointer.
Come online at:-
jubinc@skype
|
|
|
|
|
Don Box wrote: Somewhere in u'r code, u r using
type full words please, not in SMS
|
|
|
|