Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi WinSAT (https://www.delphipraxis.net/141242-winsat.html)

Razor 5. Okt 2009 17:16


WinSAT
 
Hello!

I am asking becouse there isnt no examples in delphi if there were i wouldnt even ask..


I am using win 7 so i decided to add WinSAT ability to my program so i found this example on MSDN.But its really confusing i c/c++
or c# dont really now.Could someone explain it to me what it does.

i installed winsat library via type import in delphi 2009.So i thought it was easy to do i decided to give it a try....

Delphi-Quellcode:
CInitiateWinSAT1.Create(SELF);
CInitiateWinSAT1.DefaultInterface.InitiateFormalAssessment({what goes in here delphi says a constant wich constant!},nil
)

Zitat:

C++
Code:
HRESULT InitiateFormalAssessment(
  [in, optional] IWinSATInitiateEvents *pCallbacks,
  [in, optional] HWND callerHwnd
);
Parameters
pCallbacks [in, optional]
An IWinSATInitiateEvents interface that you implement to receive notification when the assessment finishes or makes progress. Can be NULL if you do not want to receive notifications.

callerHwnd [in, optional]
The window handle of your client. The handle is used to center the WinSAT dialog boxes. If NULL, the dialog boxes are centered on the desktop.

[quote]

Razor 5. Okt 2009 18:30

Re: WinSAT
 
Liste der Anhänge anzeigen (Anzahl: 1)
Some progress i also included the pass file for other to see if it works.WIN7/VISTA is a must to test this.
This hopfully will start the winsat routine.


Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  i:IWinSATInitiateEvents;
  k:_RemotableHandle;
  l:hresult;
  s:string;
begin
  CInitiateWinSAT1.Create(SELF);

  CInitiateWinSAT1.DefaultInterface.InitiateFormalAssessment( i,k) ;
  i.WinSATComplete(l,pchar(s));
end;
Good news Leute this works as it turns off Aero and writes XML to the system. :bounce1:

[edit=mkinzler]Delphi-Tag eingefügt Mfg, mkinzler[/edit]

mkinzler 5. Okt 2009 19:06

Re: WinSAT
 
Why turning off Aero?

Razor 5. Okt 2009 19:07

Re: WinSAT
 
Well you know when you start WinSAT or Perfomance Index crap it turns it off to analyze your system if its compatible:P
It stops at that line wich is comented why is that widestring > pchar or what?
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
i:IWinSATInitiateEvents;
k:_RemotableHandle;
v:integer;
s:widestring;
begin


CInitiateWinSAT1.Create(SELF);
CInitiateWinSAT1.DefaultInterface.InitiateFormalAssessment( i,k) ;
    i.WinSATComplete(v,pchar(s));  //<here it stops and why? WINSAT_STATUS_COMPLETED_SUCCESS 0x40033
 
    if v=$40033 then
    showmessage('no');

end;

mkinzler 5. Okt 2009 19:13

Re: WinSAT
 
Use String instead of WideString

Razor 5. Okt 2009 19:16

Re: WinSAT
 
Yes but it still holds.It only stops at the line when i try to check for status did it pass or fail.

http://img.techpowerup.org/091005/Capture020901.jpg

mkinzler 5. Okt 2009 19:22

Re: WinSAT
 
Delphi-Quellcode:
CInitiateWinSAT1 := CoCInitiateWinSAT.Create;

Razor 5. Okt 2009 19:25

Re: WinSAT
 
Gives the same result as mine.But it works it functions.But the checking procedure fails.If i want to check for the STATUS.

Razor 5. Okt 2009 20:17

Re: WinSAT
 
Sorry for double post but i think i found the couse.I need only this and then i got it :)
Its bascily a function for tracing the progress and after the progress ends.

Delphi-Quellcode:
// *********************************************************************//
// Interface: IWinSATInitiateEvents
// Flags:    (0)
// GUID:     {262A1918-BA0D-41D5-92C2-FAB4633EE74F}
// *********************************************************************//
  IWinSATInitiateEvents = interface(IUnknown)
    ['{262A1918-BA0D-41D5-92C2-FAB4633EE74F}']
    function WinSATComplete(hresult: HResult; strDescription: PWideChar): HResult; stdcall;
    function WinSATUpdate(uCurrentTick: SYSUINT; uTickTotal: SYSUINT; strCurrentState: PWideChar): HResult; stdcall;
  end;
Delphi-Quellcode:
var
i:IWinSATInitiateEvents;
k:_RemotableHandle;
q:CoCInitiateWinSAT ;
v:integer;
s:string;
implementation

{$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject);
begin
CInitiateWinSAT1.Create(self);
CInitiateWinSAT1.DefaultInterface.InitiateFormalAssessment( i,k) ;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
itotal,icurrent:integer;
sa:string;

begin

i.WinSATUpdate(icurrent,itotal,pchar(sa)) ; //CODE HALTS HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if itotal>0 then
progressbar1.Position:=100*icurrent div itotal;

end;
end;

mkinzler 5. Okt 2009 20:25

Re: WinSAT
 
@Razor: Remember, you can edit a post for 24 hours!


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:14 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz