Execute a program, all process creation time is the same data, is it FileTime2DateTime function problem, failed to convert ftCreation into TDateTime, which master can help to solve it, grateful
Void __fastcall TForm1: : btn1Click (TObject * Sender)
{
Char cBuf [256].
TListItem * pItem;
AnsiString ExeFile;
//process the time parameter
FILETIME ftCreation,
FtExit,
FtKernel,
FtUser;
PROCESSENTRY32 pe32={sizeof (pe32)};
//get snapshot process
HANDLE hSnapShot=CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
If (hSnapShot==NULL)
return;
ListView1 - & gt; The Clear ();
Bool bFlag=Process32First (hSnapShot, & amp; Pe32);
While (bFlag)
{
PItem=ListView1 - & gt; The Items - & gt; The Add ();
ExeFile=AnsiString (pe32. SzExeFile);
PItem - & gt; Caption=String (ListView1 - & gt; The Items - & gt; The Count);
If (ExeFile Pos (" \ \ ")!=0)
ExeFile=ExtractFileName (pe32. SzExeFile);
PItem - & gt; SubItems - & gt; Add (ExeFile);
//get the process information, need to open the new process for hProcess
HANDLE hProcess=OpenProcess (PROCESS_QUERY_INFORMATION | | PROCESS_VM_READ, false, pe32. Th32ProcessID);
If (hProcess==NULL)
{
BFlag=Process32Next (hSnapShot, & amp; Pe32);
continue;
}
GetProcessTimes (hProcess, & amp; FtCreation, & amp; FtExit, & amp; FtKernel, & amp; FtUser);
TDateTime dtCreated;
DtCreated=FileTime2DateTime (ftCreation);
PItem - & gt; SubItems - & gt; The Add (String (pe32 dwSize));
PItem - & gt; SubItems - & gt; The Add (String (pe32 cntUsage));
PItem - & gt; SubItems - & gt; The Add (String (pe32 th32ProcessID));
PItem - & gt; SubItems - & gt; The Add (String (pe32 th32DefaultHeapID));
PItem - & gt; SubItems - & gt; The Add (String (pe32 th32ModuleID));
PItem - & gt; SubItems - & gt; The Add (String (pe32 cntThreads));
PItem - & gt; SubItems - & gt; The Add (String (pe32 th32ParentProcessID));
PItem - & gt; SubItems - & gt; The Add (String (pe32 dwFlags));
//get process creation time string
PItem - & gt; SubItems - & gt; Add (dtCreated. FormatString (" mm - dd yyyy - hh: mm: ss "));
BFlag=Process32Next (hSnapShot, & amp; Pe32);
}
The CloseHandle (hSnapShot);
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
TDateTime __fastcall FileTime2DateTime (FILETIME FILETIME)
{
FILETIME LFT fell;
SYSTEMTIME stSysTime;
FileTimeToLocalFileTime (& amp; FileTime, & amp; LFT fell);
FileTimeToSystemTime (& amp; LFT fell, & amp; StSysTime);
Return SystemTimeToDateTime (stSysTime);
}
CodePudding user response:
Written in c + + Builder nearly 10 years, a lot of procedures, c + + Builder is going to be eliminated, BBS experts, project are now in use what development tools do?CodePudding user response:
Basic used this function, do not understand, also don't have to searchTell me something about the problem unrelated LZ behind
According to customers' requirement with what tools will use what
If the customer didn't have the tools require or can fool, so what I loved to use what tools tools,
CodePudding user response:
C + + Builder and Delphi really are in danger of elimination, so few people now with this development, many people are using JAVACodePudding user response:
So it is not to say, the customer is on behalf of the market, as a squad of rice of a customer, we'll use what he needs is, if the customer does not require the use what tools, that we love to use what on what, if customer requests to use MFC to use MFC, using QT with QT, if we can persuade the customer suddenly () he let you choose what kind of tools, it is our love, with what tools use what toolsTool to eliminate not eliminated what love