WB.cpp
资源名称:视频会议系统.rar [点击查看]
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:3k
源码类别:
IP电话/视频会议
开发平台:
Visual C++
- // WB.cpp : Defines the initialization routines for the DLL.
- //
- #include "stdafx.h"
- #include "WB.h"
- #include "MainFrame.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.
- //
- /////////////////////////////////////////////////////////////////////////////
- // CWBApp
- BEGIN_MESSAGE_MAP(CWBApp, CWinApp)
- //{{AFX_MSG_MAP(CWBApp)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CWBApp construction
- CWBApp::CWBApp()
- {
- }
- /*
- 定义数据包结构
- 用户名 + 图元id + 图元类型 + 图元操作(包括增加、删除和移动) + 图元的参数
- 增加:图元类型 + 图元区域 + 图元的参数(包括颜色等等)
- 删除:图元操作为空
- 修改:图元操作区域的位置 + 图元颜色
- */
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CWBApp object
- CWBApp theApp;
- extern "C" __declspec( dllexport ) CWnd * CreateWBWnd( void ( * OnWB )( void * pContext , CWnd * pWnd , char * buffer , int size ) , void * pContext , const char * username )
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- if( ! strlen( username ) )
- {
- CWnd::GetActiveWindow( )->MessageBox( "用户名不能为空,请输入用户名" , "电子白板" , MB_ICONSTOP | MB_OK );
- return NULL;
- }
- CMainFrame * frame = new CMainFrame( );
- //回调函数
- frame->GetView( )->OnWB = OnWB;
- //用户自定义参数
- frame->GetView( )->pContext = pContext;
- //用户名
- frame->GetView( )->userName = username;
- frame->SetWindowText( frame->GetView( )->userName + " - 电子白板" );
- return frame;
- }
- extern "C" __declspec( dllexport ) void SetWBMessage( CWnd * pWnd , char * buffer , int size )
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState( ) );
- CMainFrame * frame = ( CMainFrame * )pWnd;
- if( ::IsWindow( frame->GetSafeHwnd( ) ) )
- {
- try
- {
- frame->GetView( )->parseData( buffer , size );
- }
- catch( ... )
- {
- }
- }
- }