?? wb.cpp
字號:
// WB.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "WB.h"
#include "DrawFrame.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern BOOL WINAPI CoolSB_InitializeApp(void);
extern BOOL WINAPI CoolSB_UninitializeApp(void);
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////
// CWBApp
BEGIN_MESSAGE_MAP(CWBApp, CWinApp)
//{{AFX_MSG_MAP(CWBApp)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWBApp construction
CWBApp::CWBApp()
{
}
BOOL CWBApp::InitInstance()
{
CoolSB_InitializeApp();
return CWinApp::InitInstance();
}
int CWBApp::ExitInstance()
{
CoolSB_UninitializeApp();
return CWinApp::ExitInstance();
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CWBApp object
/*
2005-4-28 設計電子白板,所有的畫圖屬性都在DRAW結構里,所有的畫圖類都繼承CDrawBase
所有的圖元都保存在map里面,每個圖元有自己唯一的名稱標志name
*/
CWBApp theApp;
//創建白板窗口
extern "C" __declspec( dllexport ) HWND WB_Create( bool ( * OnWB )( void * pContext , HWND hWnd , const char * buffer , int size ) , void * pContext )
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CDrawFrame * frame = new CDrawFrame( );
if( frame->GetSafeHwnd() )
{ //回調函數
frame->GetView( )->OnWB = OnWB;
//用戶自定義參數
frame->GetView( )->pContext = pContext;
//保存類
::SetProp( frame->GetSafeHwnd() , "__WB__" , frame );
return frame->GetSafeHwnd();
}
delete frame;
return NULL;
}
//修改用戶名
extern "C" __declspec( dllexport ) void WB_SetName( HWND hWnd , const char * username )
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ) );
if( ::IsWindow( hWnd ) )
{
CDrawFrame * frame = ( CDrawFrame * )::GetProp( hWnd , "__WB__" );
if( frame )
frame->GetView()->username = username;
}
}
//設定消息
extern "C" __declspec( dllexport ) void WB_SetMessage( HWND hWnd , const char * buffer , int size )
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ) );
if( ::IsWindow( hWnd ) )
{
CDrawFrame * frame = ( CDrawFrame * )::GetProp( hWnd , "__WB__" );
//通過消息處理同步問題
if( frame )
{
char * buf = new char[ size ];
if( buf )
{
memcpy( buf , buffer , size );
frame->GetView()->PostMessage( WM_PARSE_DATA , ( WPARAM )buf , ( LPARAM )size );
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -