|
Don't they call this 'self-sercice'?
|
|
|
|
|
I'm THAT good.
|
|
|
|
|
Hi,
I am using visual studio 2008, C++ MFC for window xp. I have a program that will create some files in my directory (like in C:/) which i created earlier and it will read/write data into the files. As the date is quite big, it take quite a while to write/read. So i would like to know is there anyway to prevent other from accessing to my files (go into C:/ and open it) when my program is running (writing or reading the files)? I am using fopen for file open and fscanf to read. Thanks alot.
|
|
|
|
|
Use the OpenFile API ([^]) with uStyle as OF_SHARE_EXCLUSIVE.
Opens a file with exclusive mode, and denies both read/write access to other processes. If a file has been opened in any other mode for read/write access, even by the current process, the function fails.
Величие не Бога может быть недооценена.
|
|
|
|
|
Thanks. I will try it out now. Thanks alot
|
|
|
|
|
Hi ARJ 09,
I would liek to know how to use OFSTRUCT? Thanks
Can give me a example?
the one i am using now is like this
FILE f3;
Cstring a = "C:/abc12";
f3 = fopen(a, "w");
fscanf(f3, "%d%d\n", &b, &c);
Please help me out. Thanks
|
|
|
|
|
In OpenFile, OFSTRUCT is a output parameter, that returns the opened file attributes.
LPCSTR lpFileName = "c:\sample.txt";
OFSTRUCT ReOpenBuff ;
HFILE hFileHandle;
hFileHandle = OpenFile(lpFileName,&ReOpenBuff,OF_SHARE_EXCLUSIVE );
Величие не Бога может быть недооценена.
|
|
|
|
|
|
Hi ARJ09,
is there a way to put/asign the OpenFile to another file name. Like
FILE* f;
f = OpenFile(.......);
Cos i need the f for fscanf
fscanf(f, "....", &a,&b);
|
|
|
|
|
Nicholas Amh wrote: is there a way to put/asign the OpenFile to another file name.
Yes, just use a different name. You should read up on the use of variable names in C++.
|
|
|
|
|
OpenFile returns HFILE, so using FILE* is not good.
and aviod fscanf.
Even OpenFile is not good in 32 bit application, the better approach is CreateFile([^]) which returns HANDLE.
Величие не Бога может быть недооценена.
|
|
|
|
|
Do anyone know the code for displaying the selected items and its child items of a treecntrl into a listcntrl?
|
|
|
|
|
Well Tree and List View control have methods (if you're using MFC ) or messages you can exploit (You're a developer, right?)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am a fresher in MFC. That is why asking such questions.
|
|
|
|
|
Have a look at documentation, see, for instance, "using CTreeCtrl " [^] and "using CListCtrl " [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
hi all, I want to develop a program which can not be seen by task manager or other process monitor tools.
Generally, there are three ways to do this:
1) write this program as system service
2) thread injection to inject my program into other process
3) hook the task manager messages
Is there any other methods?
|
|
|
|
|
Yes, they are all well documented in the "VirHack - The Definitive Guide to Virus Programming" book.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
, thx.
|
|
|
|
|
hi,how can i find this book.
i googled and find nothing.
|
|
|
|
|
Ever heard about something called "Irony" ?
|
|
|
|
|
Cedric Moonen wrote: Ever heard about something called "Irony" ?
Sory sir, can't findz "Irony" book too, plz plz u gimme linkz (urgentz)...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Sory sir, can't findz "Irony" book too, plz plz u gimme linkz (urgentz)...
Its coz you spelled it wrong: should be 'Ivory'.
|
|
|
|
|
You shouldn't be doing it.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Anyway, just for fun.
In fact, a windows service is enough to finish my job.
|
|
|
|
|
It won't "finish" the job. Task manager will show a service under the "Services" tab.
“Follow your bliss.” – Joseph Campbell
|
|
|
|