예제 #1
0
/*
 * WinMain - entry point for the application
 */
int PASCAL WinMain( HINSTANCE currinst, HINSTANCE previnst, LPSTR cmdline, int cmdshow )
{
    MSG         msg;

    cmdline = cmdline;
    Instance = currinst;
    SetInstance( Instance );

    if( !InitGblStrings() ) {
        MessageBox( NULL, "Unable to find string resources", AppName, MB_OK );
        return( 0 );
    }
    if( previnst == NULL ) {
        if( !firstInstInit() ) {
            return( 0 );
        }
    }
    if( !everyInstInit( cmdshow ) ) {
        return( 0 );
    }

    while( GetMessage( &msg, NULL, 0, 0 ) ) {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }
    DdeUninitialize( DDEInstId );
    JDialogFini();
#ifndef NOUSE3D
    CvrCtl3dUnregister( Instance );
    CvrCtl3DFini( Instance );
#endif
    return( 1 );

} /* WinMain */
예제 #2
0
/*
 * spyInit - initialization
 */
static BOOL spyInit( HANDLE currinst, HANDLE previnst, int cmdshow )
{
    WNDCLASS    wc;
    HANDLE      memhdl;
    WORD        i;

    i=i;
    memhdl = memhdl;    /* shut up the compiler for non-NT version */
    JDialogInit();
    Instance = currinst;
    ResInstance = currinst;
    if( !InitGblStrings() ) {
        return( FALSE );
    }
    SpyMenu = LoadMenu( ResInstance, "SPYMENU" );
#ifdef __WATCOMC__
    _STACKLOW = 0;
#endif
    MemStart();

    HandleMessageInst = MakeProcInstance( (FARPROC) HandleMessage, Instance );
    HintWndInit( Instance, NULL, 0 );


    /*
     * set up window class
     */
    if( !previnst ) {
        wc.style = 0L;
        wc.lpfnWndProc = SpyWindowProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = sizeof( LONG_PTR );
        wc.hInstance = Instance;
        wc.hIcon = LoadIcon( ResInstance, "APPLICON" );
        wc.hCursor = LoadCursor( (HANDLE)NULL, IDC_ARROW);
#ifdef __NT__
        wc.hbrBackground = NULL;
#else
        wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
#endif
        wc.lpszMenuName = NULL;
        wc.lpszClassName = SPY_CLASS_NAME;
        if( !RegisterClass( &wc ) ) {
            return( FALSE );
        }

#ifdef USE_SNAP_WINDOW
        if( !RegisterSnapClass( Instance ) ) {
            return( FALSE );
        }
#endif
    }

#ifndef NOUSE3D
    CvrCtl3DInit( Instance );
    CvrCtl3dRegister( Instance );
    CvrCtl3dAutoSubclass( Instance );
#endif

    /*
     * now make the main window
     */
    LoadSpyConfig( NULL );
    SpyMainWindow = CreateWindow(
        SPY_CLASS_NAME,         /* Window class name */
        SpyName,                /* Window caption */
        WS_OVERLAPPEDWINDOW,    /* Window style */
        SpyMainWndInfo.xpos,    /* Initial x position */
        SpyMainWndInfo.ypos,    /* Initial y position */
        SpyMainWndInfo.xsize,   /* Initial x size */
        SpyMainWndInfo.ysize,   /* Initial y size */
        (HWND)NULL,             /* Parent window handle */
        (HMENU)SpyMenu,         /* Window menu handle */
        Instance,               /* Program instance handle */
        NULL );                 /* Create parameters */

    if( SpyMainWindow == NULL ) {
        return( FALSE );
    }
    MyTask = GetWindowTask( SpyMainWindow );

    ShowWindow( SpyMainWindow, cmdshow );
    UpdateWindow( SpyMainWindow );

    InitMessages();
    return( TRUE );

} /* spyInit */