Click here to Skip to main content
14,269,255 members
   

Delphi

 
GeneralRe: chang form Pin
fatemehsoleimani6-Oct-14 3:40
memberfatemehsoleimani6-Oct-14 3:40 
AnswerRe: chang form Pin
smags1314-Mar-14 19:52
membersmags1314-Mar-14 19:52 
GeneralRe: chang form Pin
fatemehsoleimani6-Oct-14 3:40
memberfatemehsoleimani6-Oct-14 3:40 
Question.Net Com Class Callback to Delphi Pin
P1kfr1k9-Oct-13 1:35
memberP1kfr1k9-Oct-13 1:35 
AnswerRe: .Net Com Class Callback to Delphi Pin
smags1311-Oct-13 7:55
membersmags1311-Oct-13 7:55 
QuestionXE4 FMX.TCanvas.DrawLine Pin
Black68cougar28-Aug-13 18:12
memberBlack68cougar28-Aug-13 18:12 
QuestionLoad Class in TypeLibrary Dynamically Pin
Django_Untaken16-Aug-13 0:39
memberDjango_Untaken16-Aug-13 0:39 
QuestionGet CPU Usage Using PDH API Pin
Django_Untaken18-Jul-13 18:38
memberDjango_Untaken18-Jul-13 18:38 
Hello. I am trying to get cpu usage in delphi, using Performace Data Helper API. At the moment I know just two methods of getting it. One using Registry Interface and second PDH Interface and latter is easier than former. I am trying to use following code but it produces PDH_INVALID_ARGUMENT meaning either argument is missing or is invalid.
hStatus := PdhOpenQuery(Nil, 0, hQuery);
if hStatus <> ERROR_SUCCESS then // hStatus = PDH_INVALID_ARGUMENT 
begin
  GetErrorMsg(hStatus, sErrorMsg); // sErrorMsg = 'argument is invalid or missing'
  Exit;
end;

SO WHAT COULD BE WRONG? Thanks for any pointer.

May be irrelevant, but to give an idea that pdh variables are intialized with what values.
implementaion
var

    PdhOpenQuery : function( pReserved: Pointer;
dwUserData: DWORD; phQuery: PDH_HQUERY  ): PDH_STATUS; stdcall;
// similarly the rest of the pdh functions here

DllHandle : THandle;
hStatus : PDH_STATUS;

procedure TClass.Create()
begin

DllHandle := LoadLibrary('pdh.dll');
if DllHandle <> 0 then
begin
  PdhOpenQuery := GetProcAddress( DllHandle, 'PdhOpenQuery' );
  // similarly the rest of the pdh functions here
end;

AnswerRe: Get CPU Usage Using PDH API Pin
smags1326-Jul-13 20:59
membersmags1326-Jul-13 20:59 
AnswerRe: Get CPU Usage Using PDH API Pin
Jose A Pascoa29-Jul-13 7:01
memberJose A Pascoa29-Jul-13 7:01 
QuestionModify TypeLibrary (Default Location and Contents) Pin
AmbiguousName15-Jul-13 19:19
memberAmbiguousName15-Jul-13 19:19 
AnswerRe: Modify TypeLibrary (Default Location and Contents) Pin
Richard MacCutchan15-Jul-13 22:06
protectorRichard MacCutchan15-Jul-13 22:06 
QuestionConvert delphi 2007 project to latest delphi XE4? Pin
nel7son8-Jul-13 23:34
membernel7son8-Jul-13 23:34 
QuestionRe: Convert delphi 2007 project to latest delphi XE4? Pin
smags139-Jul-13 12:04
membersmags139-Jul-13 12:04 
Question[SOLVED] Not Updating TObjectDictionary Value Correctly Pin
AmbiguousName8-Jul-13 0:42
memberAmbiguousName8-Jul-13 0:42 
AnswerRe: Not Updating TObjectDictionary Value Correctly Pin
smags138-Jul-13 9:22
membersmags138-Jul-13 9:22 
Question[SOLVED] Assigning Properties and Events At Runtime Pin
AmbiguousName28-Jun-13 1:25
memberAmbiguousName28-Jun-13 1:25 
AnswerRe: Assigning Properties and Events At Runtime Pin
smags1328-Jun-13 9:22
membersmags1328-Jun-13 9:22 
QuestionMessage Closed Pin
20-Jun-13 23:25
membermark32220-Jun-13 23:25 
AnswerRe: What is Delphi Pin
Richard MacCutchan21-Jun-13 2:16
protectorRichard MacCutchan21-Jun-13 2:16 
AnswerRe: What is Delphi Pin
Jose A Pascoa29-Jul-13 6:58
memberJose A Pascoa29-Jul-13 6:58 
Question[SOLVED] Access a const from a class Pin
AmbiguousName12-Jun-13 21:30
memberAmbiguousName12-Jun-13 21:30 
AnswerRe: Access a const from a class Pin
Corinna John14-Jun-13 3:01
memberCorinna John14-Jun-13 3:01 
AnswerRe: Access a const from a class Pin
smags1318-Jun-13 8:10
membersmags1318-Jun-13 8:10 
GeneralRe: Access a const from a class Pin
AmbiguousName19-Jun-13 18:47
memberAmbiguousName19-Jun-13 18:47 

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.