|
I trust you've added yourself to the THHB? If not, do so IMMEDIATELY!
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Here[^]
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
See also here [^].
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
My Application CPU use very high.I ahve a globlem function and these function i am calling in InitDialog.
void ThreadRoute1( void* arg )
{
try{
USES_CONVERSION;
HANDLE hDir = CreateFile( CString("C:\\"),
FILE_LIST_DIRECTORY,
FILE_SHARE_READ|FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL
);
FILE_NOTIFY_INFORMATION Buffer[1024];
DWORD BytesReturned;
while( ReadDirectoryChangesW(
hDir,
&Buffer,
sizeof(Buffer),
TRUE,
FILE_NOTIFY_CHANGE_SECURITY|
FILE_NOTIFY_CHANGE_CREATION|
FILE_NOTIFY_CHANGE_LAST_ACCESS|
FILE_NOTIFY_CHANGE_LAST_WRITE|
FILE_NOTIFY_CHANGE_SIZE|
FILE_NOTIFY_CHANGE_ATTRIBUTES|
FILE_NOTIFY_CHANGE_DIR_NAME|
FILE_NOTIFY_CHANGE_FILE_NAME,
&BytesReturned,
NULL,
NULL
))
{
CTime tm = CTime::GetCurrentTime();
CString helper_txt;
switch(Buffer[0].Action)
{
case FILE_ACTION_ADDED: helper_txt = "The file was added to the directory"; break;
case FILE_ACTION_REMOVED: helper_txt = "The file was removed from the directory"; break;
case FILE_ACTION_MODIFIED: helper_txt = "The file was modified. This can be a change in the time stamp or attributes."; break;
case FILE_ACTION_RENAMED_OLD_NAME: helper_txt = "The file was renamed and this is the old name."; break;
case FILE_ACTION_RENAMED_NEW_NAME: helper_txt = "The file was renamed and this is the new name."; break;
}
int i=0;
do
{
CString(Buffer[i].FileName);
CString ad="C:\\";
CString adl= "C:\\";
ad +=CString(Buffer[i].FileName).Left(Buffer[i].FileNameLength / 2);
CString spath1 = tr;
int nLen = spath1.GetLength();
LPCSTR lpszBuf = spath1.GetBuffer(nLen);
spath1.ReleaseBuffer();
And Calling in
InitDialog()
{
_beginthread( ThreadRoute, 0, (void*)new Param(FILE_NOTIFY_CHANGE_FILE_NAME, CString("FILE_NOTIFY_CHANGE_FILE_NAME") ) );
}
Every things is working fine.How cani i remove CPU Uses problem .
Plz help me
|
|
|
|
|
Probably one of your while loops is a runaway...try breaking the execution of your program (debug) when it is eating the CPU and see what your thread is doing.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
So...you're asking to see all changes and accesses to all files on the C drive. And then you (as far as I can tell) enumerate a whole load of files somewhere on each file access. And you then wonder why you've got high CPU utilisation.
Download FileMon[^] and run it so you see all the file accesses that happen on a standard Windows system.
I think you need to go back to your requirements and think of an alternate implementation, 'cause this one ain't gonna fly, baby!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Your loops are heavy if you want to monitor changes on files/folders codeproject has good articles for it you can see them for more info.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
can you give me link of monitor changes on files/folder.
|
|
|
|
|
|
Thanks for reply.CPU Problem Solved.
It's nice article but problem is that when some we added size of 2GB folder A in directory C and at the same time we send size of 10kb file B then it is not notifying FileB.How to solve that problem?
or can i watch only File and Folder added in directory.Can i avoid to watch folder internal contains.Plz help me..
|
|
|
|
|
MsmVc wrote: can you give me link of monitor changes on files/folder.
Here is a semi-relevant example.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi to All
Could anyone please tell me what is the exact contents of these files
.lib
.dll
.exe
Thanks in advance<pre></pre>
I am a beginner
|
|
|
|
|
EXE and DLL in Windows are in the PE format.
OBJ is very similar to PE and is called the COFF format.
Here is an article on parsing LIB files.
A tool to view a LIB[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
compiled code.
compiled code.
compiled code.
OK, the answer is a bit longer than that...
.obj files are your compiled .C/.CPP files.
.lib files are library files, and are a collection of .obj files for later use.
.exe files are actual programs. The are linked from obj and premade lib files.
.dll files are similar to exe's, but cannot be run on their own. They hold collections of functions for other programs to call.
I'm not going to write an essay for you on this, as this sounds very homeworky. But there are good articles on DLLs here on this website.
Look at the thread 3 before your post: dll creating in win32[^]
As you are the 3rd person to ask nearly the same question within a few hours, are you all in the same class?
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
In addition to Superman's explantion, we've got something excellent here
Check for Object File[^]
The "Object file" you see inside a square means the .obj file you are talking about.
The "C++ Link libraries" that you see in a external square refers to something called as ".libs ".
An .exe is an executable. Unlike a dll, it can execute on it's own.It has an entry point like the "main()" you see in C++. Of course there are other types of .exes that wouldn't concern here now.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Any program that you can run is an exe file like Excel/mspaint/photoshop and... if you write a project on the Visual Sutdio(c++,C#,...) then you can compile it if it doesnt any problem you can run it on the current OP(it depends to your project).
Dll files has some functions and parameters you can shift your code on the dll files and use of them on the other enviroments like c++,C# you can reduce size of your exe file with them and also you can save sapce RAM (What is a Windows DLL File [^])
And see Dynamic-link library[^] on the see also you can see other info that you will be need like:
(Dependency Walker, functions of DLL and EXE files.,Dynamic library
Library (computing),Linker,Loader (computing),Object file,Shared library,
Static library ).
BTW dot forget ; on the end of c++ statements.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
the right question is : "why do you need to know this exactly ?"
are you planning to write a compiler ?
|
|
|
|
|
Hello
Suppose a directx based game(like nfs) is running. I want to grab the buffer which is shown in desktop(all frame). Actually the scenerio is like that: Game's Front buffer will capture by my application then modify this buffer(like my own text will add) and finally display my own buffer data as a game.
Does anybody have some ideas how to do this? If any ideas please let me know.
Regards
Kallol Kumar
|
|
|
|
|
Do you need to front buffer?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi,
First sorry,bcoz i don't know whether this forum is correct forum to ask this question.
I want to install VC++6.0 and VS.net2005 in same machine.But My admin people said it creates some dll problem in .net version.
Is there any problem in installing it in same machine??
Pls help me..
System details:
1.I have already using VC++6.0 Profesional edition in my system nad im working on it.
2. I want to install VS 2005 .Net version in my same machine.
3.Im using Microsoft XP,Professional,Version2002,SP3 operating system.
Anu
|
|
|
|
|
lol No. I have vc6.0 , VC2005, VC2008 express edition all living in harmony. I even had VS2003 previously in the list. The admins are just lazy. Kick them.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
I explained them.But they are telling for Enterprise edition its working properly..But not for professional edition.
THey attacked me by using this kind of edition & version type.
Any tutorial avaialble for this?
Anu
|
|
|
|
|
May be I should have explained better.
I have VS2005 Professional edition. The Expression edition is only for VC# & VC++. We need not even count the latter. You asked for VC6.0 & VS2005 right? There's no problem at all. What exactly do they say? I'm not sure if there are any exceptions.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Your admins are talking rubbish - I've had professional editions of VC6, VS2003, VS2005 and VS2008 on the same machine with no issues whatsoever.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You need to Visual Studio 2008 on your collection.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|