BOOL CErSender::VLCStart()
{
//==================================================================================================================
HKEY nKey = NULL ;
DWORD dwType = NULL ;
DWORD nSize = NULL ;
char strPath[256] ;
memset( strPath, _T('\0'), 256 ) ;
// 레지스트리에 등록된 키값을 찾는다.
if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("SOFTWARE\\VideoLAN\\VLC"), 0, KEY_READ, &nKey ) == ERROR_SUCCESS )
{
// 우선 레지스트리에서 얻고자하는 서브키값의 데이터 타입과 길이를 얻어온다.
if ( RegQueryValueEx( nKey, _T("InstallDir"), 0, &dwType, NULL, &nSize ) == ERROR_SUCCESS )
{
// 실제 데이터 값을 가져온다.
RegQueryValueEx( nKey, _T("InstallDir"), 0, &dwType, (LPBYTE)strPath, &nSize ) ;
}
else
{
AfxMessageBox(_T("Error RegQueryValueEx()")) ;
return FALSE ;
}
}
else
{
AfxMessageBox(_T("You Must Install VideoLAN")) ;
return FALSE ;
}
// 레지스트리 키값을 종료
RegCloseKey( nKey) ;
//==================================================================================================================\
// VLC를 구동한다.
m_stSI.cb = sizeof(STARTUPINFO) ;
m_stSI.lpReserved = NULL ;
m_stSI.lpReserved2 = NULL ;
m_stSI.cbReserved2 = 0 ;
m_stSI.lpDesktop = NULL ;
m_stSI.lpTitle = NULL ;
m_stSI.dwFlags = STARTF_USESHOWWINDOW ;
m_stSI.dwX = 0 ;
m_stSI.dwY = 0 ;
m_stSI.dwFillAttribute = 0 ;
m_stSI.wShowWindow = SW_SHOW ;
CString strVLCPath ;
strVLCPath = strPath ;
if ( m_strSDPPath.GetLength() <= 0 )
{
AfxMessageBox( _T("Need to SDP File Path")) ;
return FALSE ;
}
else
{
CString strVLCPullPath ;
strVLCPullPath = strPath ;
strVLCPullPath += _T("\\vlc.exe") ;
//////////////////////////////////////////////////////////////////////////
// 06/04 공백이 있는 문자열의 디렉토리는 다음과 같이 ""사이에 묶어준다.
m_strSDPPath = _T("D:\\TS\\DVB-H\\RT P\\TiM\\MTV.sdp") ;
CString strSDPPath = "\"" + m_strSDPPath + "\"" ;
//////////////////////////////////////////////////////////////////////////
strVLCPullPath += strSDPPath ;
// Process 생성 & Play
if ( CreateProcess( NULL, (LPSTR)(LPCTSTR)strVLCPullPath, NULL, NULL, FALSE, 0, NULL, NULL, &m_stSI, &m_stPI ) == FALSE )
{
AfxMessageBox( _T("Error CreateProcess(VLC)")) ;
return FALSE ;
}
return TRUE ;
}
'Programming > MFC' 카테고리의 다른 글
ReadFile (0) | 2007.07.17 |
---|---|
메뉴에 항목을 넣고 활성화 시키고, 메시지 받아오기 (0) | 2007.06.12 |
자료형 정리(문자열)-all (0) | 2007.05.26 |
Class name 만들고 확인하기. (0) | 2007.04.26 |
WinExec (0) | 2007.03.22 |