Thema: Delphi WinSAT

Einzelnen Beitrag anzeigen

Razor
(Gast)

n/a Beiträge
 
#12

Re: WinSAT

  Alt 6. Okt 2009, 11:48
bump.

Could someobody translate this. in to delphi?

C++ Code
Delphi-Quellcode:
// Class that implements IWinSATInitiateEvents. Implement this class to
// get progress information and completion notification.
class CWinSATCallbacks : public IWinSATInitiateEvents
{
    LONG m_lRefCount;

public:

    // Constructor, Destructor
    CWinSATCallbacks() {m_lRefCount = 1;}
;
    ~CWinSATCallbacks() {};

    // IUnknown methods
    HRESULT __stdcall QueryInterface(REFIID riid, LPVOID *ppvObj);
    ULONG __stdcall AddRef();
    ULONG __stdcall Release();

    // IWinSATInitiateEvents methods
    HRESULT __stdcall WinSATComplete(HRESULT hr, LPCWSTR description);
    HRESULT __stdcall WinSATUpdate(UINT currentTick, UINT tickTotal, LPCWSTR currentState); //how to use this ?
};

Delphi Code

Delphi-Quellcode:
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;
Example in c++ code

Delphi-Quellcode:
// Is called when the assessment makes progress. Indicates the percentage of the assessment
// that is complete and the current component being assessed.
HRESULT CWinSATCallbacks::WinSATUpdate(UINT currentTick, UINT tickTotal, LPCWSTR currentState)
{
    // Typically, you would provide the tick values to a ProgressBar control.

    if (tickTotal > 0)
    {
        wprintf(L"\n*** Percent complete: %u%%\n", 100*currentTick/tickTotal);
        wprintf(L"*** Currently assessing: %s\n\n", currentState);
    }


    return S_OK;
}

So acording to the above code why does the compiler halt when i press on the button?

Delphi-Quellcode:
i:IWinSATInitiateEvents;
  k:_RemotableHandle;
  l:hresult;
  s:string;
begin
  CInitiateWinSAT1.Create(SELF);
 
  i.WinSATComplete(l,pchar(s)); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  Mit Zitat antworten Zitat