Subversion Repositories factorylink.pvb_util

Rev

Blame | Last modification | View Log | Download

/**************************************************************
 *
 * Object  : pvb_util.dll
 *
 * File    : mouse.c
 *
 * Purpose : Mouse handling for FactoyyLink, usage of functions
 *           with PVB.
 *
 **************************************************************/

#include <stdlib.h>
#include <stdio.h>
#include <windows.h>


HINSTANCE    hinstDLL = NULL;


/**************************************************************
 *
 * Function:  short WINAPI pvb_WinCreate( char *cmd)
 *
 * Purpose:   Start program
 *
 * Parameter: cmd - Command line
 *
 * Return   : 0  - Success
 *            -1 - Failure
 **************************************************************/
short WINAPI pvb_WinCreate( char *cmd)
{

 STARTUPINFO           Start;
 PROCESS_INFORMATION   Proc;


  Start.lpReserved = NULL;
  Start.lpDesktop = NULL;
  Start.lpTitle = NULL;
  Start.dwX = 0; 
  Start.dwY = 0; 
  Start.dwXSize = 0; 
  Start.dwYSize = 0; 
  Start.dwXCountChars = 0;
  Start.dwYCountChars = 0; 
  Start.dwFillAttribute = 0; 
  Start.dwFlags = STARTF_FORCEOFFFEEDBACK; 
  Start.wShowWindow = 0; 
  Start.cbReserved2 = 0; 
  Start.lpReserved2 = NULL; 
  Start.hStdInput = NULL; 
  Start.hStdOutput = NULL;
  Start.hStdError = NULL;

  Start.cb = sizeof( STARTUPINFO);

  return CreateProcess( NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL,
                        &Start, &Proc);

} /* pvb_WinCreate */


/**************************************************************
 *
 * Function:  void WINAPI pvb_Sleep( long msec)
 *
 * Purpose:   Sleep for milliseconds
 *
 * Parameter: msec - Milli seconds to sleep
 *
 * Return   : 0  - Success
 *            -1 - Failure
 **************************************************************/
void WINAPI pvb_Sleep( long msec)
{


  Sleep( msec);
  return;
}



/*-----------------------------------------------------------------------------
 * FUNCTION:   BOOL WINAPI DllMain
 *
 * PURPOSE:    Callback dialog function for starting and ending evaluation 
 *             period.
 *
 * PARAMETERS: 
 *
 * RETURNS:    
 -----------------------------------------------------------------------------*/
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD fdwReason, LPVOID lpReserved)
{


    /* Perform actions based on the reason for calling */
    switch( fdwReason )  
    { 

      case DLL_PROCESS_ATTACH:
        /* 
         * Initialize once for each new process.
         * Return FALSE to fail DLL load.
         */
        hinstDLL = hinst;
        break;

      case DLL_THREAD_ATTACH:
        /* Do thread-specific initialization. */
        break;

      case DLL_THREAD_DETACH:
        /* Do thread-specific cleanup. */
        break;

      case DLL_PROCESS_DETACH:
        /* Perform any necessary cleanup. */
        break;
    }

    /* Successful DLL_PROCESS_ATTACH */
    return TRUE;
} /* DllEntryPoint */