Click here to Skip to main content
15,916,188 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
RantRe: Get IP Address Pin
Iain Clarke, Warrior Programmer4-Mar-09 2:57
Iain Clarke, Warrior Programmer4-Mar-09 2:57 
QuestionRe: Get IP Address Pin
CPallini4-Mar-09 3:30
mveCPallini4-Mar-09 3:30 
AnswerRe: Get IP Address Pin
Iain Clarke, Warrior Programmer4-Mar-09 5:07
Iain Clarke, Warrior Programmer4-Mar-09 5:07 
GeneralRe: Get IP Address Pin
CPallini4-Mar-09 5:50
mveCPallini4-Mar-09 5:50 
GeneralRe: Get IP Address Pin
Iain Clarke, Warrior Programmer4-Mar-09 6:03
Iain Clarke, Warrior Programmer4-Mar-09 6:03 
AnswerRe: Get IP Address Pin
Eytukan3-Mar-09 22:49
Eytukan3-Mar-09 22:49 
AnswerRe: Get IP Address Pin
CPallini3-Mar-09 22:55
mveCPallini3-Mar-09 22:55 
QuestionCPU Problem Pin
MsmVc3-Mar-09 21:27
MsmVc3-Mar-09 21:27 
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:\\"), // pointer to the file name
    FILE_LIST_DIRECTORY,                // access (read/write) mode
    FILE_SHARE_READ|FILE_SHARE_DELETE,  // share mode
    NULL,                               // security descriptor
    OPEN_EXISTING,                      // how to create
    FILE_FLAG_BACKUP_SEMANTICS,         // file attributes
    NULL                                // file with attributes to copy
  );

  FILE_NOTIFY_INFORMATION Buffer[1024];
  DWORD BytesReturned;
  while( ReadDirectoryChangesW(
                                hDir,                                  // handle to directory
                                &Buffer,                                    // read results buffer
                                sizeof(Buffer),                                // length of buffer
                                TRUE,                                 // monitoring option
                                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,             // filter conditions
                                &BytesReturned,              // bytes returned
                                NULL,                          // overlapped buffer
                                NULL// completion routine
                                ))
    {
		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();
	
	/*CFileFind hFile12;
	BOOL bFound = hFile12.FindFile( spath1 + _T("*.*") );

	CString name;

while ( bFound )   
	{
		bFound = hFile12.FindNextFile();
		if( (! hFile12.IsDots()) && ( hFile12.IsDirectory() ) )		
		{
			name = hFile12.GetFileName();
			int nLen = ad.GetLength();

		LPCSTR lpszBuf = spath1.GetBuffer(nLen);

		spath1.ReleaseBuffer();
	
		LPCSTR pF=lpszBuf;
			
		
		
		
		LPCSTR pT=path;
			
			if (fo.Copy(pF,pT));
	
		
		LPCSTR pF=lpszBuf;
			
		
		
		
		LPCSTR pT=path;
			
			if (fo.Copy(pF,pT));
			
		  }
		  else
		  {
		  }
			
      i++;
      
      }
    while (!Buffer[i].NextEntryOffset);



    }
	
	
					catch(...)
					{}
	}


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
AnswerRe: CPU Problem Pin
Code-o-mat3-Mar-09 21:44
Code-o-mat3-Mar-09 21:44 
AnswerRe: CPU Problem Pin
Stuart Dootson3-Mar-09 21:47
professionalStuart Dootson3-Mar-09 21:47 
AnswerRe: CPU Problem Pin
Hamid_RT4-Mar-09 1:00
Hamid_RT4-Mar-09 1:00 
GeneralRe: CPU Problem Pin
MsmVc4-Mar-09 1:13
MsmVc4-Mar-09 1:13 
GeneralRe: CPU Problem Pin
Hamid_RT4-Mar-09 1:44
Hamid_RT4-Mar-09 1:44 
GeneralRe: CPU Problem Pin
MsmVc5-Mar-09 23:42
MsmVc5-Mar-09 23:42 
GeneralRe: CPU Problem Pin
David Crow4-Mar-09 3:19
David Crow4-Mar-09 3:19 
Questioncontents of .lib .exe .dll .obj Pin
hrishiS3-Mar-09 21:22
hrishiS3-Mar-09 21:22 
AnswerRe: contents of .lib .exe .dll .obj Pin
«_Superman_»3-Mar-09 22:01
professional«_Superman_»3-Mar-09 22:01 
AnswerRe: contents of .lib .exe .dll .obj Pin
Iain Clarke, Warrior Programmer3-Mar-09 22:15
Iain Clarke, Warrior Programmer3-Mar-09 22:15 
AnswerRe: contents of .lib .exe .dll .obj Pin
Eytukan3-Mar-09 22:19
Eytukan3-Mar-09 22:19 
AnswerRe: contents of .lib .exe .dll .obj Pin
Hamid_RT3-Mar-09 23:01
Hamid_RT3-Mar-09 23:01 
AnswerRe: contents of .lib .exe .dll .obj Pin
toxcct3-Mar-09 23:18
toxcct3-Mar-09 23:18 
QuestionHow to get buffer from a Directx based game Pin
kallol kumar3-Mar-09 20:31
kallol kumar3-Mar-09 20:31 
AnswerRe: How to get buffer from a Directx based game Pin
Hamid_RT3-Mar-09 20:37
Hamid_RT3-Mar-09 20:37 
QuestionVC++6.0 and VS 2005 .net in same machine Pin
Anu_Bala3-Mar-09 20:03
Anu_Bala3-Mar-09 20:03 
AnswerRe: VC++6.0 and VS 2005 .net in same machine Pin
Eytukan3-Mar-09 20:05
Eytukan3-Mar-09 20:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.