if ( (HWND)msgWindow ) {
if ( msgWindow.getHWND() ) {
nsNativeAppSupportOS2::Start( PRBool *aResult ) {    NS_ENSURE_ARG( aResult );    NS_ENSURE_TRUE( mInstance == 0, NS_ERROR_NOT_INITIALIZED );    if (getenv("MOZ_NO_REMOTE"))    {        *aResult = PR_TRUE;        return NS_OK;    }    nsresult rv = NS_ERROR_FAILURE;    *aResult = PR_FALSE;    for ( int i = 1; i < __argc; i++ ) {        if ( strcmp( "-dde", __argv[i] ) == 0 ||             strcmp( "/dde", __argv[i] ) == 0 ) {            mUseDDE = PR_TRUE;        }    }    // Grab mutex first.    int retval;    UINT id = ID_DDE_APPLICATION_NAME;    retval = WinLoadString( NULLHANDLE, NULLHANDLE, id, sizeof(nameBuffer), nameBuffer );    if ( retval == 0 ) {        // No app name; just keep running.        *aResult = PR_TRUE;        return NS_OK;    }    // Build mutex name from app name.    PR_snprintf( mMutexName, sizeof mMutexName, "%s%s", nameBuffer, MOZ_STARTUP_MUTEX_NAME );    Mutex startupLock = Mutex( mMutexName );    NS_ENSURE_TRUE( startupLock.Lock( MOZ_DDE_START_TIMEOUT ), NS_ERROR_FAILURE );    /* We need to have a message queue to do the MessageWindow stuff (for both     * Create() and SendRequest()).  If we don't have one, make it now.     * If we are going to end up going away right after ::Start() returns,     * then make sure to clean up the message queue.     */    MQINFO mqinfo;    HAB hab;    HMQ hmqCurrent = WinQueryQueueInfo( HMQ_CURRENT, &mqinfo,                                         sizeof( MQINFO ) );    if( !hmqCurrent )    {        hab = WinInitialize( 0 );        hmqCurrent = WinCreateMsgQueue( hab, 0 );    }    // Search for existing message window.    MessageWindow msgWindow;    if ( (HWND)msgWindow ) {        // We are a client process.  Pass request to message window.        char *cmd = GetCommandLine();        rv = msgWindow.SendRequest( cmd );    } else {        // We will be server.        if (!gAbortServer) {            rv = msgWindow.Create();            if ( NS_SUCCEEDED( rv ) ) {                if (mUseDDE) {                    // Start up DDE server.                    this->StartDDE();                }                // Tell caller to spin message loop.                *aResult = PR_TRUE;            }        }    }    startupLock.Unlock();    if( *aResult == PR_FALSE )    {        /* This process isn't going to continue much longer.  Make sure that we         * clean up the message queue         */        if (hmqCurrent)           WinDestroyMsgQueue(hmqCurrent);        if (hab)           WinTerminate(hab);    }    return rv;}