MyClient.cpp
资源名称:Visualhk.rar [点击查看]
上传用户:cjw5120
上传日期:2022-05-11
资源大小:5032k
文件大小:4k
源码类别:
网络截获/分析
开发平台:
Visual C++
- // MyClient.cpp : Defines the class behaviors for the application.
- //
- /*
- 作者:海啸 lyyer English Name: Jack
- blog:http://lyyer.blog.sohu.com
- website:http://www.cnGSG.com
- 海啸网络安全组织
- */
- #include "stdafx.h"
- #include "MyClient.h"
- #include "MyClientDlg.h"
- #include "SkinPPWTL.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMyClientApp
- BEGIN_MESSAGE_MAP(CMyClientApp, CWinApp)
- //{{AFX_MSG_MAP(CMyClientApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG
- ON_COMMAND(ID_HELP, CWinApp::OnHelp)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyClientApp construction
- BOOL LoadSource(UINT resoure_id , const char * type , const char * filepath)
- {
- //获得资源指针
- HRSRC hRsrc = ::FindResource( NULL , MAKEINTRESOURCE( resoure_id ) , type );
- if( hRsrc )
- { //获得资源大小
- DWORD size = ::SizeofResource( NULL , hRsrc );
- //将资源载入内存
- HGLOBAL handle = ::LoadResource( NULL , hRsrc );
- //写入文件
- if( handle )
- { //定位资源位置
- BYTE *MemPtr = (BYTE *)LockResource( handle );
- CFile file;
- if( file.Open( filepath , CFile::modeCreate | CFile::modeWrite ) )
- {
- file.Write( MemPtr , size );
- file.Close( );
- }
- ::UnlockResource( handle );
- }
- ::FreeResource( handle );
- return TRUE;
- }
- return FALSE;
- }
- CMyClientApp::CMyClientApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CMyClientApp object
- CMyClientApp theApp;
- /////////////////////////////////////////////////////////////////////////////
- // CMyClientApp initialization
- BOOL CMyClientApp::InitInstance()
- {
- /////////////////////////////////////////////////////////////////////
- //程序运行的唯一性
- //////////////////////////////////////////////////////////////////////
- HANDLE m_Mutex = CreateMutex(NULL,true,AfxGetAppName()); //AfxGetAppName()
- if(GetLastError()==ERROR_ALREADY_EXISTS)
- {
- AfxMessageBox("程序已经运行");
- return false;
- }
- ////////////////////////////////////////////////////////////////////////
- //skinppLoadSkin(_T("skins\Royale\Royale.ssk")); //final
- //////////////////////////////////////////////////////////////////////////
- //加载皮肤
- //////////////////////////////////////////////////////////////////////////
- char SkinPath[MAX_PATH];
- char RealSkinPath[MAX_PATH];
- GetSystemDirectory(RealSkinPath,MAX_PATH);
- strcat(RealSkinPath,"\Royale.ssk"); //Royale.ssk
- LoadSource(IDR_SKIN_SSK,"SKIN",RealSkinPath);
- GetSystemDirectory(SkinPath,MAX_PATH);
- strcat(SkinPath,"\SkinPPWTL.dll");
- LoadSource(IDR_SKIN,"SKIN",SkinPath);
- HANDLE hskin = LoadLibrary(SkinPath);
- //BOOL skinppLoadSkin(TCHAR* szSkinFile,BOOL bFromIni = FALSE);
- //定义类型
- typedef BOOL (*PskinppLoadSkin)(
- TCHAR*,
- BOOL
- );
- PskinppLoadSkin lpskinppLoadSkin = (PskinppLoadSkin) GetProcAddress(
- (HINSTANCE)hskin,
- "skinppLoadSkin" );
- //typedef BOOL (*PLoadSkin)(char* );
- //PLoadSkin lpLoadSkin =(PLoadSkin)GetProcAddress((HINSTANCE)hskin,"LoadSkin");
- lpskinppLoadSkin(RealSkinPath,FALSE); //final
- //////////////////////////////////////////////////////////////////////////
- AfxEnableControlContainer();
- // Standard initialization
- // If you are not using these features and wish to reduce the size
- // of your final executable, you should remove from the following
- // the specific initialization routines you do not need.
- #ifdef _AFXDLL
- Enable3dControls(); // Call this when using MFC in a shared DLL
- #else
- Enable3dControlsStatic(); // Call this when linking to MFC statically
- #endif
- CMyClientDlg dlg;
- m_pMainWnd = &dlg;
- int nResponse = dlg.DoModal();
- if (nResponse == IDOK)
- {
- // TODO: Place code here to handle when the dialog is
- // dismissed with OK
- }
- else if (nResponse == IDCANCEL)
- {
- // TODO: Place code here to handle when the dialog is
- // dismissed with Cancel
- //dlg.OnButtonStop();
- }
- // Since the dialog has been closed, return FALSE so that we exit the
- // application, rather than start the application's message pump.
- return FALSE;
- }