📄 convtempdll.cpp
字号:
// convtempdll.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "convtempdll.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CConvtempApp
BEGIN_MESSAGE_MAP(CConvtempApp, CWinApp)
//{{AFX_MSG_MAP(CConvtempApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConvtempApp construction
CConvtempApp::CConvtempApp()
{
HRESULT hr = CoInitialize(NULL);
}
CConvtempApp::~CConvtempApp()
{
CoUninitialize();
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CConvtempApp object
CConvtempApp theApp;
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#include "MOCAMain.h"
#include "OCConvTemp.h"
//--------------------------------------------------------------------------
// MOCA_CRT_OBJ
//
// This function is exported from the DLL and is called by Origin C to
// construct objects and for execution of Origin C codes.
//--------------------------------------------------------------------------
extern "C" CScriptMocaObject * MOCA_CRT_OBJ(UINT nTypeID, void* pArg, UINT nSize, DWORD dwArg)
{
switch( dwArg )
{
case MOCA_CREATE_SET_CALLBACK:
// Used during loading to set the HWND and callback pointers.
MOCAObj::SetCallback((HWND)nTypeID, (LPCALLBK)pArg );
return NULL;
case MOCA_CREATE_FROM_LPCSTR:
// Used to create and instance of this class.
// nTypeID is used to pass the name of the class.
LPCSTR pszClassName = (LPCSTR)nTypeID;
CScriptMocaObject *pSMObj = NULL;
if( 0 == lstrcmp("CConvertTemperature", pszClassName) )
pSMObj = new OCConvertTemperature((COCall *)pArg);
return pSMObj;
}
return NULL;
}
/*
static BOOL IsMsgIrrelevant(DWORD dwMsg)
{
if( dwMsg == MOCA_SET_NAG_RELATED_CALLBACKS ||
dwMsg == MOCA_CREATE_UPDATE_DEBUGMODE ||
dwMsg == MOCA_SET_CREATION_ERROR_CALLBK ||
dwMsg == MOCA_SET_GET_LTVECTOR_CALLBK)
return TRUE;
return FALSE;
}
if(IsMsgIrrelevant(dwArg))
return NULL; // No need to handle them here, now
// dwArg is used to indecate if we want to do somethin special instea
if(dwArg == MOCA_CREATE_SET_CALLBACK) //Important -- thsi flag is the first flag used at dll loading
//to set the HWND nd call back pointers to valid pointers
{
MOCAObj::SetCallback((HWND)nTypeID, (LPCALLBK)pArg );
return NULL;
}
// Currently we only need to handle the MOCA_CREATE_FROM_LPCSTR message.
if( dwArg != MOCA_CREATE_FROM_LPCSTR )
return NULL;
// For MOCA_CREATE_FROM_LPCSTR message the nTypeID argument is used
// for passing the class name.
LPCSTR strTypeName = (LPCSTR)nTypeID;
CScriptMocaObject *pSMObj = NULL;
if( 0 == lstrcmp("CConvertTemperature", strTypeName) )
pSMObj = new OCConvertTemperature((COCall *)pArg);
return pSMObj;
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -