Not fictitious ... (smile)

zhaozj2021-02-16  51

Not fictitious ... (smile)

Author: Chris Sells

Translator: glory

A friend I accidentally discovered the following code in Microsoft Source Code:

// Function: Runcommandex

// synopsis: Runs the Given Command in The Current Session, More Robust

// Than Runcommand

// arguments: None

// Returns: S_OK IF SUCCESS

// history: October 3, 2000 - Created [Name withheld to protect the guilty]

HRESULT RUNCOMMANDEX (LPCWSTR SZCMDLINE)

{

DWORD DWTRY = 0;

HRESULT HRESULT = S_OK;

// Try Run Command 3 Times At Most

While (DWTRY <4)

{

HRESULT = Runcommand (Szcmdline);

IF (HRESULT! = E_FAIL)

{

// We succeeded

Break;

}

DWTRY ;

}

IF (dWTRY == 4)

{

Atltrace (l "Could Start The Command Even We Tried 4 Times / N");

// Translation: Perhaps the spirit of chris is

// ATLTRACE (L "Couldn't Start The Command Even WE TRIED 4 TIMES / N");

Assert (false);

}

Return HRESULT;

}

This is not a strong, but it is good ...

转载请注明原文地址:https://www.9cbs.com/read-27821.html

New Post(0)