My Project
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
ParaEngine::CInterprocessAppClient Class Reference

This is used to create an application using interprocess communication. More...

#include <InterprocessAppClient.h>

Inheritance diagram for ParaEngine::CInterprocessAppClient:
ParaEngine::CAutoUpdaterApp NPL::IAutoUpdaterClient::IAutoUpdaterCallback

Public Types

typedef boost::shared_ptr< boost::thread > Boost_Thread_ptr_type
 
- Public Types inherited from ParaEngine::CAutoUpdaterApp
typedef std::list< std::string > Domain_Map_t
 

Public Member Functions

 CInterprocessAppClient (const char *appName=NULL)
 
void SetAppName (const char *appName)
 set the application name
 
virtual int SetCommandLine (const char *sCmdLine)
 init command line so that we can use IPC calls before calling Run() method. More...
 
int Run (HINSTANCE hInst, const char *sCmdLine)
 run the application using a given command line. More...
 
void SetParentWindow (HWND hWndParent)
 set the parent window
 
int Start (int nMinResolutionWidth=0, int nMinResolutionHeight=0)
 
int Stop ()
 
HWND GetMainHWnd ()
 
virtual bool SendHostMsg (int nMsg, DWORD param1=0, DWORD param2=0, const char *filename=NULL, const char *sCode=NULL, int nPriority=0)
 sent interprocess message to the host process. More...
 
- Public Member Functions inherited from ParaEngine::CAutoUpdaterApp
virtual int SetAppDir ()
 set working directory More...
 
virtual bool BeginCoreUpdate (const char *sCurVersion, const char *sSessionDir)
 begin core update. More...
 
virtual void SendError (int nErrorCode, const char *errorMsg=NULL)
 send error message to host app. More...
 
virtual void SendLog (const char *logMsg)
 send log message to host app. More...
 
virtual bool IsUrlTrusted (const std::string &sUrl)
 whether the url is from a trusted web domain. More...
 
virtual void OnProgress (const NPL::IAutoUpdaterClient::ProgressMessage &msg)
 auto updater call back. More...
 

Protected Member Functions

int HandleAppMsg (InterProcessMessage &msg)
 return 0 if succeed, otherwise we will terminate the application. More...
 
bool CheckLoad ()
 load ParaEngineClient.dll if not loaded before. More...
 
void handle_mainloop_timer (const boost::system::error_code &err)
 the main loop in the main thread. More...
 
double GetElapsedAppTime ()
 
HRESULT StartWindowThread ()
 create the default win32 windows for rendering. More...
 
void DefaultWinThreadProc ()
 
void PrintGetLastError ()
 print the GetLastError
 
void EnableAutoUpdateWhenComplete (bool bEnable)
 enable auto update when complete. More...
 
- Protected Member Functions inherited from ParaEngine::CAutoUpdaterApp
bool TryGetNextCoreUpdateMessage ()
 
NPL::CAutoUpdaterClientCreateGetAutoUpdater ()
 
void ReleaseAutoUpdater ()
 
int DoCoreUpdate_imp ()
 update the core game engine. More...
 

Static Protected Member Functions

static LRESULT CALLBACK DefaultWinThreadWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- Static Protected Member Functions inherited from ParaEngine::CAutoUpdaterApp
static int MatchFilePattern (const std::string &input, const std::string &sPattern)
 whether the input string match a given file pattern. More...
 
static bool IsAlphaNumeric (char c)
 

Protected Attributes

std::string m_app_name
 the application name is also the interprocess message queue name. More...
 
std::string m_app_host
 the interprocess queue name for the host app. More...
 
std::string m_sUsage
 
bool m_bAutoUpdateWhenStart
 whether we will automatically update the client when receiving PEAPP_Start. More...
 
int m_nMinWidth
 
int m_nMinHeight
 
HWND m_hWndParent
 
bool m_bStarted
 
ParaEngine::CPluginLoader m_ParaEngine_plugin
 
ParaEngine::IParaEngineCorem_pParaEngine
 
ParaEngine::IParaEngineAppm_pParaEngineApp
 
CInterprocessQueue * m_ipAppQueueIn
 
CInterprocessQueue * m_ipHostQueueOut
 
bool m_bQuit
 
bool m_bMainLoopExited
 
ParaEngine::Mutex m_mutex
 
boost::asio::io_service m_main_io_service
 the main game loop
 
boost::asio::steady_timer m_main_timer
 the main timer that ticks 30 times a second
 
HWND m_hWnd
 
std::string m_sRedistDir
 
Domain_Map_t m_trusted_domains
 
Boost_Thread_ptr_type m_win_thread
 
ParaEngine::Mutex m_win_thread_mutex
 
DWORD m_dwWinThreadID
 
HINSTANCE m_hInst
 
- Protected Attributes inherited from ParaEngine::CAutoUpdaterApp
std::string m_sCmdLine
 
CCommandLineParserm_pCmdLineParams
 
bool m_bAutoUpdateComplete
 
NPL::CAutoUpdaterClientm_pAutoUpdater
 
Domain_Map_t m_trusted_domains
 

Friends

class CMyProcessAppThread
 

Detailed Description

This is used to create an application using interprocess communication.

Member Function Documentation

§ CheckLoad()

bool ParaEngine::CInterprocessAppClient::CheckLoad ( )
protected

load ParaEngineClient.dll if not loaded before.

§ DefaultWinThreadProc()

void ParaEngine::CInterprocessAppClient::DefaultWinThreadProc ( )
protected

LiXizhi 2010.4.25: this is extremely tricky. We first create an invisible window using WS_OVERLAPPED style. This will trick the win32 to create IME context for the current thread. Then we will re-parent the window and remove the WS_OVERLAPPED style. And by resizing the window twice afterwards, we will force the win32 window to remove the window title bar. If we do not do this, and create the window using WS_CHILD | WS_VISIBLE style directly, IME messages will not be received by the child window.

§ EnableAutoUpdateWhenComplete()

void ParaEngine::CInterprocessAppClient::EnableAutoUpdateWhenComplete ( bool  bEnable)
protected

enable auto update when complete.

§ handle_mainloop_timer()

void ParaEngine::CInterprocessAppClient::handle_mainloop_timer ( const boost::system::error_code &  err)
protected

the main loop in the main thread.

§ HandleAppMsg()

int ParaEngine::CInterprocessAppClient::HandleAppMsg ( InterProcessMessage msg)
protected

return 0 if succeed, otherwise we will terminate the application.

Note: for security reasons, it is not advised to use this function. This may be removed in future release.

§ Run()

int ParaEngine::CInterprocessAppClient::Run ( HINSTANCE  hInst,
const char *  sCmdLine 
)

run the application using a given command line.

§ SendHostMsg()

bool ParaEngine::CInterprocessAppClient::SendHostMsg ( int  nMsg,
DWORD  param1 = 0,
DWORD  param2 = 0,
const char *  filename = NULL,
const char *  sCode = NULL,
int  nPriority = 0 
)
virtual

sent interprocess message to the host process.

Reimplemented from ParaEngine::CAutoUpdaterApp.

§ SetCommandLine()

int ParaEngine::CInterprocessAppClient::SetCommandLine ( const char *  sCmdLine)
virtual

init command line so that we can use IPC calls before calling Run() method.

Reimplemented from ParaEngine::CAutoUpdaterApp.

§ StartWindowThread()

HRESULT ParaEngine::CInterprocessAppClient::StartWindowThread ( )
protected

create the default win32 windows for rendering.

and assigning to m_hWnd. window is created in another thread. Since windows uses single threaded apartment, the window procedure should also be in that thread.

Member Data Documentation

§ m_app_host

std::string ParaEngine::CInterprocessAppClient::m_app_host
protected

the interprocess queue name for the host app.

§ m_app_name

std::string ParaEngine::CInterprocessAppClient::m_app_name
protected

the application name is also the interprocess message queue name.

§ m_bAutoUpdateWhenStart

bool ParaEngine::CInterprocessAppClient::m_bAutoUpdateWhenStart
protected

whether we will automatically update the client when receiving PEAPP_Start.

This is automatically set to true when command line contains m_sUsage="webplayer"


The documentation for this class was generated from the following files: