#include "stdafx.h" #include "SplashLoading.h" #include "Resource.h" #include // 2010.08.09 - prodongi cSplashLoading::cSplashLoading(bool apply) : m_apply(apply) { ZeroMemory( &m_si, sizeof(m_si) ); m_si.cb = sizeof(m_si); ZeroMemory( &m_pi, sizeof(m_pi) ); } void cSplashLoading::begin(HINSTANCE hInstance) { if (!m_apply) return ; /* // 2010.08.09 - prodongi BOOL ret = CreateProcess( NULL, "SplashLoading.exe Potato.NF.Rappelz SFrame.exe", NULL, NULL, FALSE, 0, NULL, NULL, &m_si, &m_pi); */ /// 2010.10.26 process id 보내는 걸로 테스트 DWORD id = GetCurrentProcessId(); char str[MAX_PATH]; sprintf(str, "%s %s %d", "SplashLoading.exe", "Potato.NF.Rappelz", id); BOOL ret = CreateProcess( NULL, str, NULL, NULL, FALSE, 0, NULL, NULL, &m_si, &m_pi); #ifdef _DEV if (0 == ret) { char str[1024]; DWORD ret = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS , NULL, GetLastError(), 0, str, _countof(str), NULL ); if(ret > 0) { MessageBox(HWND_DESKTOP, str, "SplashLoading Error", MB_OK); } } #endif } void cSplashLoading::end(HWND hWnd) { if (!m_apply) return ; clear(); if (hWnd) ShowWindow(hWnd, SW_SHOW); } void cSplashLoading::clear() { // 2010.08.09 - prodongi if (m_pi.hProcess) { DWORD exitCode; GetExitCodeProcess(m_pi.hProcess, &exitCode); TerminateProcess(m_pi.hProcess, exitCode); CloseHandle( m_pi.hProcess ); m_pi.hProcess = NULL; } if (m_pi.hThread) { CloseHandle( m_pi.hThread ); m_pi.hThread = NULL; } }