Beispiel #1
0
/**********************************************************
* WinMain *
*---------*
*   Description:
*       Main entry point for the application
***********************************************************/
int WINAPI WinMain(
        HINSTANCE hInst,
        HINSTANCE hPrevInst,
        LPSTR lpCmdLine,
        int nCmdShow
       )
{
    // Initialize COM.
    if (FAILED(::CoInitialize( NULL )))
    {
        return 0;
    }

    // Create an instance of our main call-handling class
    COperator *pOperator = new COperator( hInst );
    if ( !pOperator )
    {
        return 0;
    }

    // Does initialization of SAPI and TAPI objects
    HRESULT hr = pOperator->Initialize();
    if ( FAILED( hr ) )
    {
        return 0;
    }

    // everything is initialized, so
    // start the main dialog box
    ::DialogBoxParam( hInst,
              MAKEINTRESOURCE(IDD_MAINDLG),
              NULL,
              MainDialogProc,
              (LPARAM) pOperator
             );

    // This does the cleanup of SAPI and TAPI objects
    delete pOperator;

    ::CoUninitialize();

    return 1;
}