Rockwell Automation Publication 1789-UM002K-EN-P - January 2015
131
Develop External Routines
Chapter 7
Sounds.cpp
// Sounds.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "RA_ExternalRoutines.h"
#include <Mmsystem.h>
#include <process.h>
HANDLE
hTerminate = NULL;
// DllMain needs to create a global event which all threads need to check for.
// This event will be used to tell the threads that the DLL is being unloaded
// and that it is time to terminate.
//
// Not creating and using this event can lead to access violations in the threads which
// will cause the SoftLogix controller to terminate and display a red X across the module.
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
hTerminate = CreateEvent (NULL, TRUE, FALSE, NULL);
return (TRUE);
case DLL_PROCESS_DETACH:
SetEvent (hTerminate);
Sleep (50); // give threads the chance to act on termination notice.
return (TRUE);
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
return (TRUE);
}
return (FALSE);
}
typedef enum rungStates {
FIRST_SCAN,
RUNG_TRUE,
RUNG_FALSE,
INVALID_STATE
} RUNGSTATES;
RUNGSTATES rungState = INVALID_STATE;
HANDLE hControllerState;
void PlaySound(char * Snd)
{
HGLOBAL hResLoad;
// handle to loaded resource
HRSRC hRes;
// handle/ptr. to res. info. in hDLL
LPTSTR lpResLock;
// pointer to resource data
BOOL bRes = TRUE;
Содержание SoftLogix 5800
Страница 1: ...SoftLogix 5800 System Catalog Numbers 1789 L10 1789 L30 1789 L60 User Manual...
Страница 4: ...4 Rockwell Automation Publication 1789 UM002K EN P January 2015 Summary of Changes Notes...
Страница 104: ...104 Rockwell Automation Publication 1789 UM002K EN P January 2015 Chapter 5 Configure and Use Simulated I O Notes...
Страница 110: ...110 Rockwell Automation Publication 1789 UM002K EN P January 2015 Chapter 6 Execute External Routines 9 Click OK...
Страница 148: ...148 Rockwell Automation Publication 1789 UM002K EN P January 2015 Chapter 7 Develop External Routines Notes...
Страница 256: ...256 Rockwell Automation Publication 1789 UM002K EN P January 2015 Appendix E System Performance Tuning Guidelines Notes...
Страница 262: ...262 Rockwell Automation Publication 1789 UM002K EN P January 2015 Appendix G SoftLogix 5800 Revision History Notes...
Страница 270: ...270 Rockwell Automation Publication 1789 UM002K EN P January 2015 Index...
Страница 271: ......