Esempio n. 1
0
bool BBVideoDlg::bSetCaptureTempImage()
{
	m_dlg_control.Pause(); //플레이 중지.

	CString sFront = sGetCurrentDir() + "\\temp1.bmp";
	CString sRear = sGetCurrentDir() + "\\temp2.bmp";

	if(FileExists(sFront))
		DeleteFile(sFront);

	if(FileExists(sRear))
		DeleteFile(sRear);
	
	if( !m_api.Command(DEC_CMD_DISP_CAPTURE, 0, (DWORD)(LPCSTR)sFront) ) //전방
	{
		//AfxMessageBox( "Snapshot failed 1" );
		//return false;
	}

	if( !m_api.Command(DEC_CMD_DISP_CAPTURE, 1, (DWORD)(LPCSTR)sRear) ) //후방
	{
		//AfxMessageBox( "Snapshot failed 0" );
		//return false;
	}
	return true;
}
Esempio n. 2
0
bool BBVideoDlg::bSetCapture()
{
	CString strTime;
	CString sFile; 
	
	SYSTEMTIME sysTime;
	GetLocalTime(&sysTime);

	// YYYYMMDD_HHMMSS
	strTime.Format(_T("%04d-%02d-%02d-%02dh%02dm%02ds%03d"), sysTime.wYear, sysTime.wMonth, sysTime.wDay,
		sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds);
	
		
	CString mFile = m_dlg_control.m_file;
	mFile = mFile.Left(mFile.GetLength()-4); 
	sFile.Format("%s-%s", mFile, strTime);

	m_dlg_control.Pause(); //플레이 중지. 

	CString sConfigFile = sGetCurrentDir() + "\\config.ini";
	CString sCapturePath;
	TCHAR szSpecialPath[MAX_PATH] = {0};
	::SHGetSpecialFolderPath(NULL, szSpecialPath, CSIDL_MYDOCUMENTS, 0);
	sCapturePath = szSpecialPath;

	LPSTR read = (LPSTR)malloc( ( 21504 ) * sizeof( LPSTR) );
	::GetPrivateProfileString("CAPTURE_DIR","PATH",sCapturePath, read, 21504, sConfigFile);
	sCapturePath = read;	
	
	sCapturePath = sCapturePath +  "\\CAM_CAPTURE\\";

	if(!DirectoryExists(sCapturePath)){
		CreateDirectory(sCapturePath,NULL);
	}

	CString sFront = sCapturePath + sFile + "(Track1).bmp";
	if( !m_api.Command(DEC_CMD_DISP_CAPTURE, 0, (DWORD)(LPCSTR)sFront  ) )  //전방
	{
		MessageBox( "Snapshot failed 0", BB_WINDOWS_TEXT );
		return false;
	}
		
	CString sRear = sCapturePath + sFile + "(Track2).bmp";
	if( !m_api.Command(DEC_CMD_DISP_CAPTURE, 1, (DWORD)(LPCSTR)sRear ) ) //후방  
	{
		MessageBox( "Snapshot failed 1", BB_WINDOWS_TEXT );
		return false;
	}

	CString sMsg;
	sMsg.Format("%s 캡쳐 화면이 저장 되었습니다.\n저장된 폴더를 여시겠습니까?", sFront);
	
	if(MessageBox(sMsg, "캡쳐", MB_YESNO)== IDYES)
	{
		//폴더 열자.	
		ShellExecute(NULL, "explore", sCapturePath, NULL, NULL, SW_SHOWNORMAL);
	}
	
	return true;
}
Esempio n. 3
0
void BBVideoDlg::OnBnClickedBtnModeAll()
{
	CString sConfigFile = sGetCurrentDir() + "\\config.ini";
	::WritePrivateProfileString( "DEFAULT_CH", "CH",		"0",		sConfigFile); 

	vModeCh3();
}
Esempio n. 4
0
void sMakeAbsolutePath(const sStringDesc &buffer,const char *file)
{
  if(sIsAbsolutePath(file))
  {
    sCopyString(buffer,file);
  }
  else
  {
    sString<sMaxPath> b;
    sGetCurrentDir(b);
    b.Add("/");
    b.Add(file);
    sCopyString(buffer,b);
  }
}
Esempio n. 5
0
BOOL BBVideoDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	
	m_dlg_display1.Create( IDD_DISPLAY, this);	
	m_dlg_display1.ShowWindow( SW_HIDE );

	m_dlg_display2.Create( IDD_DISPLAY, this);
	m_dlg_display2.ShowWindow( SW_HIDE );

	m_dlg_control.Create( IDD_CONTROL, this);	
	m_dlg_control.ShowWindow( SW_SHOW );


#ifndef _DEBUG
	DEC_OPEN_PARAM param = { {m_dlg_display1.m_hWnd, m_dlg_display2.m_hWnd}, {15, 15}, 2, "" };
#else
	DEC_OPEN_PARAM param = { {m_dlg_display1.m_hWnd, m_dlg_display2.m_hWnd}, {60, 60}, 2, "E:\\study\\VPlayer\\EXE" };
#endif
	if( !m_api.Open(&param) )
	{
		MessageBox("Decoder Library Open failed...", BB_WINDOWS_TEXT);
		//return FALSE;
	}

	CString sConfigFile = sGetCurrentDir() + "\\config.ini";
	remove(sConfigFile);

	m_dlg_display1.m_api	= &m_api;
	m_dlg_display1.m_index	= 0;
	m_dlg_display2.m_api	= &m_api;
	m_dlg_display2.m_index	= 1;

	m_dlg_control.m_api		= &m_api;
	m_dlg_control.m_tat		= &m_winTab->m_wt_tat;
	m_dlg_control.m_disp1	= &m_dlg_display1;
	m_dlg_control.m_disp2	= &m_dlg_display2;

	m_dlg_control.vInitControl();

	vInitControl(); 

//	vSetViewModeBtnImage(fmNone);

	return TRUE;  
}
Esempio n. 6
0
sBool sSystemOpenFileDialog(const sChar *label,const sChar *extensions,sInt flags,const sStringDesc &buffer)
{
  sChar oldpath[2048];
  OPENFILENAMEW ofn;
  sInt result=0;

  // determine default extension (=first in list)
  sString<256> defaultExt;
  defaultExt = extensions;
  sInt pipePos;
  if((pipePos = sFindFirstChar(defaultExt,'|')) != -1)
    defaultExt[pipePos] = 0;

  sChar ext[2048];
  sClear(ext);
  sChar *extp = ext;
  sInt filterindex = 0;

  if((flags & 3) == sSOF_LOAD && sFindChar(extensions,'|')>=0) // opening, more than one extension specified?
  {
    filterindex = 1;
    static const sChar allSupported[] = L"All supported extensions";
    sCopyMem(extp,allSupported,sizeof(allSupported));
    extp += sCOUNTOF(allSupported);

    // add all supported extensions
    const sChar *curExt = extensions;
    sBool first = sTRUE;

    for(;;)
    {
      while(*curExt=='|') curExt++;
      if(!*curExt) break;

      if(!first)
        *extp++ = ';';

      *extp++ = '*';
      *extp++ = '.';
      while(*curExt!='|' && *curExt)
        *extp++ = *curExt++;

      first = sFALSE;
    }

    *extp++ = 0;
  }

  for(;;)
  {
    while(*extensions=='|') extensions++;
    if(!*extensions) break;
    const sChar *ext1 = extensions;
    while(*ext1!='|' && *ext1)
      *extp++ = *ext1++;
    *extp++ = 0;
    *extp++ = '*';
    *extp++ = '.';
    while(*extensions!='|' && *extensions)
      *extp++ = *extensions++;
    *extp++ = 0;
  }

  static const sChar allFiles[] = L"All files (*.*)\0*.*\0";
  sCopyMem(extp,allFiles,sizeof(allFiles));
  extp += sCOUNTOF(allFiles);

  sSetMem(&ofn,0,sizeof(ofn));
  ofn.lStructSize = sizeof(ofn);
  ofn.hwndOwner = sHWND;
  ofn.lpstrFile = buffer.Buffer;
  ofn.nMaxFile = buffer.Size;
  ofn.lpstrFilter = ext;
  ofn.nFilterIndex = filterindex;
  ofn.lpstrTitle = label;
  ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

  if(0)     // this stuff does not work in windows any more. thanks to microsoft being so very intuitive
  {
    sString<sMAXPATH> initialdir;
    sGetCurrentDir(initialdir);
    initialdir.AddPath(buffer.Buffer);
    sChar *lastslash = 0;
    for(sInt i=0;initialdir[i];i++)
      if(initialdir[i]=='/' || initialdir[i]=='\\')
        lastslash = &initialdir[i];
    if(lastslash)
      *lastslash = 0;
    if(buffer.Buffer[0]!=0)
      ofn.lpstrInitialDir = initialdir;
  }

  if(!defaultExt.IsEmpty())
    ofn.lpstrDefExt = defaultExt;

  for(sInt i=0;buffer.Buffer[i];i++) if(buffer.Buffer[i]=='/') buffer.Buffer[i]='\\';
  sInt len = sGetStringLen(buffer.Buffer);
  if(len>0 && buffer.Buffer[len-1]=='\\') buffer.Buffer[len-1]=0;

  GetCurrentDirectoryW(sCOUNTOF(oldpath),oldpath);
  sWin32::ModalDialogActive = sTRUE;

  switch(flags & 3)
  {
  case sSOF_LOAD:
    ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_EXPLORER;
    if (flags&sSOF_MULTISELECT) ofn.Flags|=OFN_ALLOWMULTISELECT;
    result = GetOpenFileNameW(&ofn);
    break;
  case sSOF_SAVE:
    ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_EXPLORER;
    result = GetSaveFileNameW(&ofn);
    break;
  case sSOF_DIR:
    { CoInitializeEx(0L,COINIT_APARTMENTTHREADED);
      BROWSEINFO bi;
      memset(&bi, 0, sizeof(bi));
      bi.ulFlags   = BIF_USENEWUI;
      bi.hwndOwner = GetDesktopWindow();
      bi.lpszTitle = label;

      SetActiveWindow(GetDesktopWindow());
      UpdateWindow(GetDesktopWindow());

      LPITEMIDLIST pIDL;
      pIDL = SHBrowseForFolderW(&bi);
      if(pIDL!=0L)
      { // Create a buffer to store the path, then 
        // get the path.
        sChar buffer2[_MAX_PATH] = L"\0";
        if(SHGetPathFromIDList(pIDL, buffer2) != 0)
        {
          // Set the string value.
          sCopyString(buffer,buffer2);
          result = true;
        }
        // free the item id list
        CoTaskMemFree(pIDL);
      }
    }
    break;
  default:
    result = 0;
    break;
  }

  sWin32::ModalDialogActive = sFALSE;
  SetCurrentDirectoryW(oldpath);

  for(sInt i=0;buffer.Buffer[i];i++)
    if(buffer.Buffer[i]=='\\') buffer.Buffer[i]='/';

  return result;
}