Esempio n. 1
0
//---------------------------------------------------------------------------
void __fastcall TDllTestForm::FormShow(TObject *Sender)
{
    TIniFile    *IniFile;

    if (!FInitialized) {
        FInitialized     = TRUE;
        IniFile          = new TIniFile(FIniFileName);
        Top              = IniFile->ReadInteger(SectionWindow, KeyTop,    Top);
        Left             = IniFile->ReadInteger(SectionWindow, KeyLeft,   Left);
        Width            = IniFile->ReadInteger(SectionWindow, KeyWidth,  Width);
        Height           = IniFile->ReadInteger(SectionWindow, KeyHeight, Height);
        delete IniFile;
        DisplayMemo->Clear();

		DllHandle = LoadLibraryA("OverbyteIcsDLL1.dll");
        if (DllHandle == 0) {
            MyMessageBox("OverbyteIcsDLL1.dll not found", "Error", MB_OK);
            Application->Terminate();
            return;
        }

        IcsDllDemo = (TIcsDllDemo)GetProcAddress(DllHandle, "IcsDllDemo");
        if (IcsDllDemo == NULL) {
            MyMessageBox("IcsDllDemo not found (OverbyteIcsDLL1.dll)", "Error", MB_OK);
            Application->Terminate();
            return;
        }
    }
}
Esempio n. 2
0
void updatdChess() //更新棋盘数据至 chessdata
{
	if (!EnablePrivilege ())
	{
		MyMessageBox ("EnablePrivilege", GetLastError ());
	}

	//获取窗口句柄
	HWND gameh=::FindWindowA(NULL,g_ChessInfo.caption);
	
	//获取窗口进程ID
	DWORD processid;
	::GetWindowThreadProcessId(gameh,&processid);
	
	//打开指定进程
	HANDLE processH=::OpenProcess(PROCESS_ALL_ACCESS,false,processid);
	
	//读指定进程 内存数据
    DWORD byread;
	//LPCVOID pbase=(LPCVOID)0x0012A508;  //棋盘数据基址
	LPVOID  nbuffer=(LPVOID)&chessdata; //存放棋盘数据

	DWORD dwOldProtect;
	if(!VirtualProtectEx (processH , g_ChessInfo.lpQPBase, sizeof (chessdata), PAGE_READWRITE, &dwOldProtect)){
		MyMessageBox ("VirtualProtectEx", GetLastError ());
	}

	::ReadProcessMemory(processH,g_ChessInfo.lpQPBase,nbuffer,11*19,&byread);

	DWORD dwNewProtect;
	if(!VirtualProtectEx (processH, g_ChessInfo.lpQPBase, sizeof (chessdata), dwOldProtect, &dwNewProtect)){
		MyMessageBox ("VirtualProtectEx2", GetLastError ());
	}
}
Esempio n. 3
0
BOOL CWaveRecord::EncodeMp3(PBYTE pByData, DWORD dwSize, UINT uSaveFileCh)
{
	BE_ERR ulError = 0;
	DWORD dwWrite = 0;
	
	if(uSaveFileCh > 2)
	{
		MyMessageBox(_T("Invalid file channel"), eERR_ERROR);
		return FALSE;
	}
	
	ulError = m_mp3_Proc_hEncodeChunk(m_mp3_hStream[uSaveFileCh], dwSize / sizeof(SHORT),
		(SHORT*)pByData, m_mp3_pByMp3Buffer[uSaveFileCh], &dwWrite);
	
	if(ulError != BE_ERR_SUCCESSFUL)
	{
		m_mp3_Proc_hCloseStream(m_mp3_hStream[uSaveFileCh]);
		MyMessageBox(_T("Encode chunk failed"), eERR_ERROR);
		return FALSE;
	}
	
	m_mp3_File[uSaveFileCh].Write(m_mp3_pByMp3Buffer[uSaveFileCh], sizeof(BYTE) * dwWrite);
	
	return TRUE;
}
Esempio n. 4
0
void CHpsCtrl::Init(HWND hwndParent, LPRECT lpRect /*= NULL*/)
{
	m_clrBkgd = RGB(0, 0, 0);
	m_clrLines = RGB(75, 243, 167);
	m_clrText = RGB(98, 108, 104);
	
	if(!Create(hwndParent, lpRect))
	{
		MyMessageBox(_T("Create window failed"), eERR_ERROR);
	}

	if(!m_font.CreateFont(
			12,           // nHeight   
			6,            // nWidth   
			0,            // nEscapement   
			0,            // nOrientation   
			FW_NORMAL,    // nWeight   
			FALSE,        // bItalic   
			FALSE,        // bUnderline   
			0,            // cStrikeOut   
			ANSI_CHARSET, // nCharSet   
			OUT_DEFAULT_PRECIS, // nOutPrecision   
			CLIP_DEFAULT_PRECIS, // nClipPrecision   
			DEFAULT_QUALITY, // nQuality   
			DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily   
			"Arial")) // lpszFacename
	{
		MyMessageBox(_T("Create font failed"), eERR_ERROR);
	}
}
Esempio n. 5
0
BOOL CWaveRecord::LoadMp3Dll()
{
	if(m_mp3_hIn) return TRUE;
	
	m_mp3_hIn = LoadLibrary(_T("lame_enc.dll"));
	if(m_mp3_hIn == NULL)
	{
		MyMessageBox(_T("Load lame_enc.DLL failed"), eERR_ERROR);
		return FALSE;
	}
	
	// Get Interface functions from the DLL
	m_mp3_Proc_hInitStream = (BEINITSTREAM)GetProcAddress(m_mp3_hIn, TEXT_BEINITSTREAM);
	m_mp3_Proc_hEncodeChunk	= (BEENCODECHUNK)GetProcAddress(m_mp3_hIn, TEXT_BEENCODECHUNK);
	m_mp3_Proc_hDeinitStream = (BEDEINITSTREAM)GetProcAddress(m_mp3_hIn, TEXT_BEDEINITSTREAM);
	m_mp3_Proc_hCloseStream	= (BECLOSESTREAM)GetProcAddress(m_mp3_hIn, TEXT_BECLOSESTREAM);
	m_mp3_Proc_hWriteVBRHeader = (BEWRITEVBRHEADER)GetProcAddress(m_mp3_hIn, TEXT_BEWRITEVBRHEADER);
	m_mp3_Proc_hWriteInfoTag = (BEWRITEINFOTAG)GetProcAddress(m_mp3_hIn, TEXT_BEWRITEINFOTAG);
	
	// Check if all interfaces are present
	if(!m_mp3_Proc_hInitStream || !m_mp3_Proc_hEncodeChunk 
		||!m_mp3_Proc_hDeinitStream || !m_mp3_Proc_hCloseStream)
	{
		MyMessageBox(_T("Get lame interface functions failed"), eERR_ERROR);
		return FALSE;
	}
	
	return TRUE;
}
Esempio n. 6
0
//------------------------------------------------------------------------------------------------
// loades material list
//------------------------------------------------------------------------------------------------
int ap_Load_Material_List(char *p_File_Name, AUDIO_DATA * p_ad)
{
  FILE *file = 0;
  FILE *Material_file = 0;
  char text[30] = "", error[MAX_FILENAME];
  int i;

  if (p_ad->p_Material)
    return 0;

  achdir(pSndArchive, p_ber->dir.sound_dir);

  file = aopen(pSndArchive, p_File_Name, "r");
  if (!file) {
    //MessageBox(p_ad->hWnd,"Material list file not found","Error", MB_OK);
    MyMessageBox(NULL, "##error_title", "##material_list_error", "");
    kprintf(1, "Material list file not found");
    return 0;
  }

  agets(text, 30, file);
  p_ad->Size_of_Material_List = atoi(text);

  p_ad->p_Material =
    (MATERIAL_LIST_ITEM *) malloc((p_ad->Size_of_Material_List) *
    sizeof(MATERIAL_LIST_ITEM));
  if (!p_ad->p_Material) {
    //MessageBox(p_ad->hWnd,"Unable to allocate memory for material list","Error",MB_OK);
    kprintf(1, "Unable to allocate memory for material list");
    MyMessageBox(NULL, "##error_title", "##material_list_error", "");
    return 0;
  }

  for (i = 0; i < p_ad->Size_of_Material_List; i++) {
    if(!agets(text, 30, file))
      break;
    
    newline_cut(text);
    Material_file = aopen(pSndArchive, text, "rb");
    if (!Material_file) {
      sprintf(error, "%s not found", text);
      //MessageBox(p_ad->hWnd,error,"Error", MB_OK);
      kprintf(1, error);
    }
    else {
      aread(&p_ad->p_Material[i], sizeof(MATERIAL_LIST_ITEM), 1,
        Material_file);
      aclose(Material_file);
    }
  }

  aclose(file);
  return 1;
}
Esempio n. 7
0
void CWaveRecord::StopRecord()
{
	MMRESULT mmResult = 0;

	if(!m_hWaveIn)
	{
		return;
	}
	
	if(!m_bRecording)
	{
		return;
	}
	
	EnterCriticalSection(&g_CS);
	g_bResetting = TRUE;
	LeaveCriticalSection(&g_CS);

	mmResult = waveInReset(m_hWaveIn);
	if(mmResult)
	{
		MyMessageBox(_T("waveInReset failed"), eERR_ERROR);
		return;
	}
	g_bResetting = FALSE;
	
	mmResult = waveInClose(m_hWaveIn);
	if(mmResult) 
	{
		MyMessageBox(_T("waveInClose failed"), eERR_ERROR);	
		return;
	}

	for(int nCh = 0; nCh < 2; nCh++)
	{
		StopWriteFile(nCh);
	}
	
	m_bRecording = FALSE;

	FreeMp3Dll();
	
	if(m_hParentWnd)
	{
		CDC *pDC = GetDC();
		DrawWindowBG(pDC);
	}
}
Esempio n. 8
0
 //================================================================================================
//----------------------------------------+++--> Remove Launch T-Clock on Windows Startup ShortCut:
void RemoveStartup(HWND hDlg) { //----------------------------------------------------------+++-->
	LPITEMIDLIST pidl;
	char dstpath[MAX_PATH], path[MAX_PATH], path2[MAX_PATH];
	char *lpStr1, *lpStr2;
	int	retval;	

  if(!FileExists(hDlg)) return;

  if(SHGetSpecialFolderLocation(hDlg, CSIDL_STARTUP, &pidl) == NOERROR && SHGetPathFromIDList(pidl, dstpath) == TRUE);
  else return;

  if(MyMessageBox(hDlg, "Remove Shortcut From the Startup Folder.\nAre You Sure?", CONF_START, MB_YESNO, MB_ICONQUESTION) != IDYES) return;

  strcpy(path, dstpath);
  strcat(path, "\\");
  strcat(path, CONF_START);
  strcat(path, ".lnk");
  lpStr1 = path;
  retval = DeleteFile(lpStr1);
  if(retval == 1) return;
  else{
	strcpy(path2, dstpath);
	strcat(path2, "\\");
	strcat(path2, CONF_START);
    strcat(path2, ".lnk");
	lpStr2 = path2;
	retval = DeleteFile(lpStr2);
	if(retval == 1) return;
  }
 return;
}
Esempio n. 9
0
static change_resp ChangePrompt( void )
{
#ifdef __WIN__
    int     i;

    i = MyMessageBox( Root, "Change this occurence?", "Replace Text",
                      MB_ICONQUESTION | MB_YESNOCANCEL );
    if( i == IDNO ) {
        return( CHANGE_NO );
    } else if( i == IDCANCEL ) {
        return( CHANGE_CANCEL );
    } else {
        return( CHANGE_OK );
    }
#else
    vi_key      key = 0;

    Message1( "Change? (y)es/(n)o/(a)ll/(q)uit" );
    for( ;; ) {
        key = GetNextEvent( false );
        if( key == VI_KEY( y ) ) {
            return( CHANGE_OK );
        } else if( key == VI_KEY( n ) ) {
            return( CHANGE_NO );
        } else if( key == VI_KEY( a ) ) {
            return( CHANGE_ALL );
        } else if( key == VI_KEY( q ) ) {
            return( CHANGE_CANCEL );
        }
    }
#endif
}
Esempio n. 10
0
VOID NEAR PASCAL BoilThatDustSpec(register CHAR *pStart, BOOL bLoadIt)
{
  register CHAR *pEnd;
  WORD          ret;
  BOOL          bFinished;

  ENTER("BoilThatDustSpec");

  if (*pStart == TEXT('\0'))
      return;

  bFinished = FALSE;
  while (!bFinished)
    {
      pEnd = pStart;
      while ((*pEnd) && (*pEnd != ' ') && (*pEnd != ','))
#ifdef DBCS
          pEnd = AnsiNext(pEnd);
#else
          ++pEnd;
#endif

      if (*pEnd == TEXT('\0'))
          bFinished = TRUE;
      else
          *pEnd = TEXT('\0');

      ret = ExecProgram(pStart, szNULL, NULL, bLoadIt);
      if (ret)
          MyMessageBox(NULL, IDS_EXECERRTITLE, ret, MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL);

      pStart = pEnd+1;
    }
  LEAVE("BoilThatDustSpec");
}
Esempio n. 11
0
HANDLE KMainWindow::GetProcess(void)
{
	char sPid[64];
	DWORD nPid;

	GetWindowText(m_Pid, sPid, sizeof(sPid));
	sscanf(sPid, "%x", & nPid);

	if ( nPid != m_curPid )
	{
		HANDLE hProcess = OpenProcess(PROCESS_VM_READ, FALSE, nPid);

		if ( hProcess == NULL )
		{
			wsprintf(sPid, "Unable to open process %x", nPid);
			MyMessageBox(NULL, sPid, "Fosterer", MB_OK, IDI_SPY);
		}
		else
		{
			CloseHandle(m_curProcess);

			m_curPid = nPid;
			m_curProcess = hProcess;
		}
	}

	return m_curProcess;
}
Esempio n. 12
0
BOOL CWaveRecord::SaveRecordData2File(UINT uFileChannel, LPCTSTR lpszFileName)
{
	CString strErr;
	CString strFileName = lpszFileName;
	
	if(strFileName.Right(4) == _T(".mp3"))
	{
		m_bCompressMp3 = TRUE;

		if(m_format.wBitsPerSample == 8)
		{
			MyMessageBox(_T("Can not record 8 bits mp3"), eERR_ERROR);
			goto end;
		}

		if(!LoadMp3Dll())
		{
			MyMessageBox(_T("Load mp3 dll failed"), eERR_ERROR);
			goto end;
		}
	
		if(!PreEncodeMp3(strFileName, uFileChannel))
		{
			MyMessageBox(_T("Prepare encoding mp3 failed"), eERR_ERROR);
			goto end;
		}
	}
	else
	{
		m_bCompressMp3 = FALSE;
		if(!CreateWaveFile(strFileName, uFileChannel))
		{
			MyMessageBox(_T("Create wave file failed"), eERR_ERROR);
			goto end;
		}
	}
	
	return TRUE;
	
end:
	Release();
	return FALSE;
}
Esempio n. 13
0
void CWaveRecord::EndEncodeMp3(UINT uSaveFileCh)
{
	DWORD dwWrite = 0;
	BE_ERR ulError = 0;
	
	if(!m_mp3_Proc_hDeinitStream) return;
	if(m_mp3_File[uSaveFileCh].m_hFile == NULL) return;
	if(uSaveFileCh > 2) return;
	
	// De_init the stream
	ulError = m_mp3_Proc_hDeinitStream(m_mp3_hStream[uSaveFileCh], 
		m_mp3_pByMp3Buffer[uSaveFileCh], &dwWrite);
	
	if(ulError != BE_ERR_SUCCESSFUL)
	{
		m_mp3_Proc_hCloseStream(m_mp3_hStream[uSaveFileCh]);
		MyMessageBox(_T("Deinit stream fialed"), eERR_ERROR);
		return;
	}
	
	if(dwWrite)
	{
		m_mp3_File[uSaveFileCh].Write(m_mp3_pByMp3Buffer[uSaveFileCh], sizeof(BYTE) * dwWrite);
	}
	
	// Close the MP3 Stream
	m_mp3_Proc_hCloseStream(m_mp3_hStream[uSaveFileCh]);
	
	// Delete buffers
	if(m_mp3_pByMp3Buffer[uSaveFileCh])
	{
		delete []m_mp3_pByMp3Buffer[uSaveFileCh];
	}
	m_mp3_pByMp3Buffer[uSaveFileCh] = NULL;
	
	if(m_mp3_pByWavBuffer[uSaveFileCh]) 
	{
		delete []m_mp3_pByWavBuffer[uSaveFileCh];
	}
	m_mp3_pByWavBuffer[uSaveFileCh] = NULL;
	
	// Close file
	m_mp3_File[uSaveFileCh].Close();
	
	if(m_mp3_Proc_hWriteInfoTag)
	{
		m_mp3_Proc_hWriteInfoTag(m_mp3_hStream[uSaveFileCh], (LPCSTR)m_mp3_strFileName[uSaveFileCh]);	
	}
	else
	{
		m_mp3_Proc_hWriteVBRHeader((LPCSTR)m_mp3_strFileName[uSaveFileCh]);
	}
}
Esempio n. 14
0
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int)
{
    HWND hWnd = CreateWindow(_T("EDIT"), NULL, WS_OVERLAPPEDWINDOW,
		10, 10, 200, 100, GetDesktopWindow(), NULL, hInst, NULL);
	ShowWindow(hWnd, SW_SHOW);

	SetWindowText(hWnd, szRectWin);

	MyMessageBox(NULL, szRectWin, szProgram, MB_OK);

	HRGN hRgn = CreateEllipticRgn(0, 0, 200, 100);
	SetWindowRgn(hWnd, hRgn, TRUE);
	DeleteObject(hRgn);

	SetWindowText(hWnd, szEptcWin);
	MyMessageBox(NULL, szEptcWin, szProgram, MB_OK);

	DestroyWindow(hWnd);

	return 0;
}
Esempio n. 15
0
/*
**  Name: ingres_install_adobe_reader
**	
**  Description:
**	This function is responsible for checking for existance of
**	Adobe Reader and will suggest to install it if it isn't detected.
**	This function has been modified to open just a page browser instead
**	of redistributing the Adobe Reader. 
**
**  Side Effects:
**	None.
**
**  History:
**	16-Nov-2006 (drivi01)
**	    Created.
**	19-May-2008 (drivi01)
**	    Remove locale routines.  Currently we have no
**	    way to pull up locale dependent adobe site, so 
**	    we will point everyone at adobe.com and they
**	    can choose to go to the locale of their choice.
**	16-Jan-2009 (whiro01)
**	    Removed now unused local variables (clears compiler warnings).
*/
UINT __stdcall 
ingres_install_adobe_reader(MSIHANDLE hInstall)
{
	if (!IsCurrentAcrobatAlreadyInstalled())
	{
	    if (AskUserYN(hInstall, "The Ingres documentation is provided in Portable Document Format (PDF).\nTo view PDF files, you must download and install Adobe Reader from the\nAdobe website if it is not already installed on your computer.\n\nWould you like to go to the Adobe website to download Adobe Reader?\n(Version 7.0 or above is required.)"))
		OpenPageForAcrobat();
	    else
		MyMessageBox(hInstall, "Please obtain the correct version of the Adobe Acrobat Reader from http://www.adobe.com.");
	}
	return ERROR_SUCCESS;
}
Esempio n. 16
0
// #define ONLYID
VOID NEAR PASCAL MyHelp(HWND hWnd, WORD wCommand, DWORD wId)
{
#ifdef ONLYID
   if(wCommand != HELP_QUIT)
      MyMessageBox(hWnd, IDS_HELP, MB_OK, 0, wId);
#else
   HANDLE hHelpFile;
   PSTR pHelpFile;

   if(!(hHelpFile=MyLoadString(wHelpMain==IDW_SDKMAIN ?
	 IDS_SDKHELPFILE : IDS_HELPFILE, NULL, LMEM_MOVEABLE)))
      return;

   if(!WinHelp(hWndMain, pHelpFile=LocalLock(hHelpFile), wCommand, wId))
      MyMessageBox(hWnd, IDS_HELPERR, MB_OK, 0);
   else
      WinHelp(hWndMain, pHelpFile, HELP_SETINDEX, wHelpIndex);

   LocalUnlock(hHelpFile);
   LocalFree(hHelpFile);
#endif
}
Esempio n. 17
0
//------------------------------------------------------------------------------------------------
// loades play list
//------------------------------------------------------------------------------------------------
int ap_Load_Play_List(char *p_File_Name, AUDIO_DATA *p_ad)
{
	FILE *file = 0;
	char text[30];
	int i;

	if(p_ad->p_Play_List) return 0;

	chdir(p_ad->Music_Dir);

	file = fopen(p_File_Name,"r");
	if(!file)
	{
		//MessageBox(p_ad->hWnd,"Play list file not found","Error", MB_OK);
		MyMessageBox(hwnd_hry, "##error_title", "##play_list_error","");
		kprintf(1,"Play list file not found");
		return 0;
	}

	fgets(text,30,file);
	p_ad->Size_of_Play_List = atoi(text);

	p_ad->p_Play_List = (PLAY_LIST_ITEM *) malloc((p_ad->Size_of_Play_List) * sizeof(PLAY_LIST_ITEM));		
	if (!p_ad->p_Play_List)
	{
		//MessageBox(p_ad->hWnd,"Unable to allocate memory for play list","Error",MB_OK);
		kprintf(1,"Unable to allocate memory for play list");
		MyMessageBox(hwnd_hry, "##error_title", "##play_list_error","");
		return 0;
	}

	for(i=0;i<p_ad->Size_of_Play_List;i++)
	{
		fgets(p_ad->p_Play_List[i].Song_Name,30,file);
		p_ad->p_Play_List[i].Song_Name[strlen(p_ad->p_Play_List[i].Song_Name)-1] = '\0';	
	}
	fclose(file);
	return 1;
}
Esempio n. 18
0
BOOL CWaveRecord::AddInputBufferToQueue(int nIndex)
{
	MMRESULT mmResult = 0;

	if(nIndex < 0 || nIndex >= m_wInQueue)
	{
		return FALSE;
	}

	if(!m_pArrInData[nIndex])
	{
		return FALSE;
	}
	
	LPWAVEHDR pHdr = m_pArrHdr[nIndex];
	ZeroMemory(pHdr, sizeof(WAVEHDR));
	pHdr->lpData = (char*)m_pArrInData[nIndex];
	pHdr->dwBufferLength = m_dwQueBufferSize;
	
	// Prepares a buffer for waveform-audio input
	mmResult = waveInPrepareHeader(m_hWaveIn, pHdr, sizeof(WAVEHDR));
	if(mmResult)
	{
		MyMessageBox(_T("waveInPrepareHeader Failed"), eERR_ERROR);
		return false;
	}
	
	// Send an input buffer to the given waveform-audio input device
	mmResult = waveInAddBuffer(m_hWaveIn, pHdr, sizeof(WAVEHDR));
	if(mmResult)
	{
		MyMessageBox(_T("waveInAddBuffer failed"), eERR_ERROR);
		return false;
	}

	m_dwBufNumInQueue++;
	return TRUE;
}
Esempio n. 19
0
 //======================================
//--+++-->
void OnStartup(HWND hDlg) {
	LPITEMIDLIST pidl;
	char dstpath[MAX_PATH], myexe[MAX_PATH];

  if(FileExists(hDlg)) return;

  if(SHGetSpecialFolderLocation(hDlg, CSIDL_STARTUP, &pidl) == NOERROR && SHGetPathFromIDList(pidl, dstpath) == TRUE);
  else return;
	
  if(MyMessageBox(hDlg, "Add Shortcut To the Startup Folder.\nAre You Sure?", CONF_START, MB_YESNO, MB_ICONQUESTION) != IDYES) return;

  GetModuleFileName(GetModuleHandle(NULL), myexe, MAX_PATH);
  CreateLink(myexe, dstpath, CONF_START);
}
Esempio n. 20
0
//------------------------------------------------------------------------------------------------
// loades play list
//------------------------------------------------------------------------------------------------
int ap_Load_Play_List(char *p_File_Name, AUDIO_DATA * p_ad)
{
  FILE *file = 0;
  char text[30];
  int i;

  if (p_ad->p_Play_List)
    return 0;

  chdir(p_ber->dir.music_dir);

  file = fopen(p_File_Name, "r");
  if (!file) {    
    MyMessageBox(NULL, "##error_title", "##play_list_error", "");
    kprintf(1, "Play list file not found");
    return 0;
  }

  fgets(text, 30, file);
  p_ad->Size_of_Play_List = atoi(text);

  p_ad->p_Play_List = (PLAY_LIST_ITEM *) malloc((p_ad->Size_of_Play_List) * sizeof(PLAY_LIST_ITEM));
  if (!p_ad->p_Play_List) {
    kprintf(1, "Unable to allocate memory for play list");
    MyMessageBox(NULL, "##error_title", "##play_list_error", "");
    return 0;
  }

  for (i = 0; i < p_ad->Size_of_Play_List; i++) {
    char *p_name = p_ad->p_Play_List[i].Song_Name;
    fgets(p_name, 30, file);
    newline_cut(p_name);
  }
  fclose(file);
  return 1;
}
Esempio n. 21
0
/*------------------------------------------------
 「スタートアップ」にショートカットをつくる
--------------------------------------------------*/
void OnStartup(HWND hDlg)
{
	LPITEMIDLIST pidl;
	char dstpath[MAX_PATH], myexe[MAX_PATH];

	if(SHGetSpecialFolderLocation(hDlg, CSIDL_STARTUP, &pidl) == NOERROR &&
		SHGetPathFromIDList(pidl, dstpath) == TRUE)
		;
	else return;

	if(MyMessageBox(hDlg, MyString(IDS_STARTUPLINK),
		"TClock", MB_YESNO, MB_ICONQUESTION) != IDYES) return;

	GetModuleFileName(GetModuleHandle(NULL), myexe, MAX_PATH);
	CreateLink(myexe, dstpath, "TClock");
}
Esempio n. 22
0
void Test(HWND hWnd, const TCHAR * mess)
{
    SetWindowText(hWnd, mess);

    HDC hDC1 = GetWindowDC(hWnd);
    HDC hDC2 = GetDC(hWnd);

    TCHAR temp[MAX_PATH];

    wsprintf(temp, "%s GetWindowDC=%x, GetDC=%x", mess, hDC1, hDC2);

    MyMessageBox(NULL, temp, _T("Window Region"), MB_OK);

    ReleaseDC(hWnd, hDC1);
    ReleaseDC(hWnd, hDC2);
}
Esempio n. 23
0
int CWavFile::IsCanCombine(CString strPathL, CString strPathR)
{
	BOOL b = FALSE;
	DWORD m_dwDataSizeL = 0;
	DWORD m_dwDataSizeR = 0;

	memset(&m_formatL, 0, sizeof(WAVEFORMATEX));
	memset(&m_formatR, 0, sizeof(WAVEFORMATEX));
	ZeroMemory(&m_mmckinfoParent, sizeof(MMCKINFO));
	ZeroMemory(&m_mmckinfoSubChunk, sizeof(MMCKINFO));
	
	// Check Validity of the first(left channel) file
	m_dwDataSizeL = CheckValidity(m_hWaveFileL, strPathL, m_formatL);
	if(m_dwDataSizeL == -1)
	{
		MyMessageBox(_T("Invalid wave file: ") + strPathL, eERR_ERROR);
		return -1;
	}

	// Check Validity of the second(right channel) file
	m_dwDataSizeR = CheckValidity(m_hWaveFileR, strPathR, m_formatR);
	if(m_dwDataSizeR == -1)
	{
		MyMessageBox(_T("Invalid wave file: ") + strPathR, eERR_ERROR);
		return -1;
	}

	// All of them must be mono wave file
	if(!(m_formatL.nChannels == 1))
	{
		MyMessageBox(_T("Not a mono wave file: ") + strPathL, eERR_ERROR);
		return -1;
	}
	if(!(m_formatR.nChannels == 1))
	{
		MyMessageBox(_T("Not a mono wave file: ") + strPathR, eERR_ERROR);
		return -1;
	}

	// They must have the same bps
	if(!(m_formatL.wBitsPerSample == m_formatR.wBitsPerSample))
	{
		MyMessageBox(_T("They must have the same bps"), eERR_ERROR);
		return -1;
	}

	// They must have the same sps
	if(m_formatL.nSamplesPerSec != m_formatR.nSamplesPerSec)
	{
		MyMessageBox(_T("They must have the same sps"), eERR_ERROR);
		return -1;
	}

	return max(m_dwDataSizeL, m_dwDataSizeR);
}
Esempio n. 24
0
BOOL CWaveRecord::Create(HWND hWndParent, LPRECT lpRect/* = NULL*/)
{
	CRect rc(0, 0, 0, 0);
	rc = *lpRect;

	if(lpRect == NULL || hWndParent == NULL)
	{
		return FALSE;
	}
	
	LPCTSTR lpszClassName = AfxRegisterWndClass(
		0,
		LoadCursor(AfxGetInstanceHandle(), IDC_ARROW),
		NULL, NULL 
		);
	
	if(!CreateEx(0, 
		lpszClassName, 
		_T(""), 
		WS_CHILD | WS_TABSTOP,
		rc.left, 
		rc.top, 
		rc.Width(), 
		rc.Height(), 
		hWndParent, 
		NULL, 
		NULL)
		)
	{
		MyMessageBox(_T("Create window failed"), eERR_ERROR);
		return FALSE;
	}

	if(hWndParent && lpRect)
	{
		m_PenWave.CreatePen(PS_SOLID, 0, m_clrWaveform);
		m_penText.CreatePen(PS_SOLID, 0, m_clrText);
		m_penLine.CreatePen(PS_SOLID, 0, m_clrSplit);
	}

	ShowWindow(SW_SHOW);
	GetClientRect(&m_rcDrawWnd);
	
	return TRUE;
}
Esempio n. 25
0
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
	const int SAMPLES = 32;

	DWORD   t1[SAMPLES], t2[SAMPLES];
	__int64 t3[SAMPLES], t4[SAMPLES], freq3, freq4;

	TIMECAPS tc;
	timeGetDevCaps(&tc, sizeof(tc));
	timeBeginPeriod(1);
	
	QueryPerformanceFrequency((LARGE_INTEGER *) & freq3); freq3 /= 1000;
	freq4 = MyQueryFrequency();							  freq4 /= 1000;

	for (int i=0; i<SAMPLES; i++)
	{
		for (int j=0; j<200; j++)	// roughly 0.2 ms to 0.5ms delay
			DeleteObject(CreateSolidBrush(0));
		
		t1[i] = GetTickCount();
		t2[i] = timeGetTime();
		QueryPerformanceCounter((LARGE_INTEGER *) & t3[i]);
		t4[i] = MyQueryCounter();
	}
	timeEndPeriod(1);

	TCHAR buffer[1024];

	sprintf(buffer, _T("tick   mm %d Khz %5.1f Mhz %5.1f Mhz\n\n"), tc.wPeriodMin, freq3/1000.0, freq4/1000.0);
	
	for (i=0; i<SAMPLES; i++)
		wsprintf(buffer+ _tcslen(buffer), "%8d %8d %8d %8d\n", 
			(t1[i]-t1[0])*1000000, 
			(t2[i]-t2[0])*1000000, 
			(int)((t3[i]-t3[0])*1000000/freq3), (int)((t4[i]-t4[0])*1000000/freq4));

	MyMessageBox(NULL, buffer, "Timer Accuracy", MB_OK);

	return 0;
}
Esempio n. 26
0
BOOL CWaveFile::Open(CString strFilePath)
{
	BOOL b = FALSE;
	MMRESULT mmResult = 0;

	// Release buffers and resource
	Release(); 
	
	Init(); // Init local variables

	// If file path not exist
	if(!PathFileExists(const_cast<LPCSTR>((LPCTSTR)strFilePath)))
	{
		return FALSE;
	}

	// Check the validity of wave file
    b = CheckValidity(strFilePath);
	if(!b)
	{
		MyMessageBox(_T("Invalid wav file"), eERR_ERROR);
		return FALSE;
	}

	// The file path for playing
	m_strPlayPath = strFilePath;

	// Allocate memory for wave data
	m_lpData = new BYTE[m_dwDataSize];

	// Read all sound data from wave file
	mmioRead(m_hWaveFile, (HPSTR)m_lpData, m_dwDataSize);

	// Close file
	mmioClose(m_hWaveFile, 0);

	return TRUE;
}
Esempio n. 27
0
/*
**  Name: ingres_start_bookshelf
**	
**  Description:
**	This function is responsible for finding adobe acrobat 
**	and using it to open Bookshelf upon install completion.
**
**  Side Effects:
**	None.
**
**  History:
**	16-Nov-2006 (drivi01)
**	    Created.
**	19-Feb-2009 (drivi01)
**	    Rename Ingres Bookshelf.pdf to Ing_Bookshelf.pdf.
*/
UINT __stdcall
ingres_start_bookshelf(MSIHANDLE ihnd)
{
	char 	szPath[MAX_PATH];
	char 	szBuf[MAX_PATH];
	char	acrord[MAX_PATH];
	DWORD	dwSize, dwType;
	PROCESS_INFORMATION	pi;
    	STARTUPINFO		si;
	HKEY	hKey;
	int 	rc;
	char	subKey[MAX_PATH];
	memset((char*)&pi, 0, sizeof(pi));
	memset((char*)&si, 0, sizeof(si));
	si.cb = sizeof(si);
	si.dwFlags = STARTF_USESHOWWINDOW;
	si.wShowWindow = SW_SHOWNORMAL;
	dwSize = sizeof(szPath);
	//MsiGetTargetPath(ihnd, "DocFolder", szPath, &dwSize);
	MsiGetProperty(ihnd, "INSTALLDIR", szPath, &dwSize);
	if (_access(szPath, 00) == 0)
	{
		rc = RegOpenKeyEx(HKEY_CLASSES_ROOT,".pdf\\OpenWithList", 0,KEY_ENUMERATE_SUB_KEYS, &hKey );
		if (rc == ERROR_SUCCESS)
		{	
			dwSize = sizeof(subKey);
			rc = RegEnumKey(hKey, 0, subKey, dwSize);
			RegCloseKey(hKey);
			if (rc == ERROR_SUCCESS)
			{
				sprintf(szBuf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%s", subKey);
				rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szBuf,  0, KEY_ALL_ACCESS, &hKey );
				if (rc == ERROR_SUCCESS)
				{
					dwSize = sizeof(acrord);
					rc = RegQueryValueEx(hKey, "Path", NULL, &dwType, acrord, &dwSize);
					RegCloseKey(hKey);
				}
			}
			if (rc == ERROR_SUCCESS)
			{
				sprintf(szBuf, "\"%s\\%s\" \"%s\\Ing_Bookshelf.pdf\"", acrord, subKey, szPath);
				if (CreateProcess(NULL, szBuf, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi))
				{
					/*Sleep(1000);
					sprintf(szBuf, "Ingres %s Post Installation", tchII_INSTALLATION);
					hWnd=FindWindow(NULL, szBuf);
					if (hWnd)
						BringWindowToTop(hWnd);
					*/
		
					CloseHandle(pi.hProcess);
					CloseHandle(pi.hThread);
					return (ERROR_SUCCESS);
				}
				else 
				{
					sprintf(szBuf, "Failed to execute \"%s\\Ing_Bookshelf.pdf\" with error %d", szPath, GetLastError());
					MyMessageBox(ihnd, szBuf);
					return (ERROR_INSTALL_FAILURE);
				}
			}
		}
		return (ERROR_INSTALL_FAILURE);
	}
	else
	{
		return (ERROR_INSTALL_FAILURE);
	}
	
}
DWORD WINAPI vmsMediaConvertMgr::_threadConvertMediaFile(LPVOID lp)
{
	ProcWaitInfo *info = (ProcWaitInfo*) lp;

	vmsConvertMediaFileContext *pcmfc  = (vmsConvertMediaFileContext*) info->lpParam1;
	BOOL bDontDeleteSourceFile = (BOOL)info->lpParam2;

	CString strDst = pcmfc->dld->pMgr->get_OutputFilePathName ();
	strDst = strDst.Left (strDst.GetLength () - 4); 

	for (int i = 0; ; i++)
	{
		CString str;
		if (i)
			str.Format ("%s (%d).%s", strDst, i, pcmfc->stgs.strExtension);
		else
			str.Format ("%s.%s", strDst, pcmfc->stgs.strExtension);

		if (GetFileAttributes (str) == DWORD (-1))
		{
			strDst = str;
			break;
		}
	}
	
	_DldsMgr.AddEvent (pcmfc->dld, LS (L_CONVERTING), EDT_INQUIRY);

	if (vmsMediaConverter::ConvertMedia (pcmfc->dld->pMgr->get_OutputFilePathName (), 
			strDst, pcmfc->stgs.strFormat, pcmfc->stgs.strAudioCodec, -1, pcmfc->stgs.nAudioBitrate, -1, 
			pcmfc->stgs.strVideoCodec, pcmfc->stgs.nVideoBitrate, -1, pcmfc->stgs.sizeVideo.cx, pcmfc->stgs.sizeVideo.cy,
			&info->iProgress, &info->bNeedStop))
	{
		if (bDontDeleteSourceFile == FALSE)
		{
			pcmfc->dld->pMgr->DeleteFile ();

			fsDownload_Properties *dp = pcmfc->dld->pMgr->GetDownloadMgr ()->GetDP ();
			delete [] dp->pszFileName;
			dp->pszFileName = new char [strDst.GetLength () + 1];
			lstrcpy (dp->pszFileName, strDst);
			pcmfc->dld->pMgr->GetDownloadMgr ()->setDirty();
		}
		else
		{
			CString strDst2 = strDst;
			strDst2.SetAt (strDst2.GetLength () - 3, 't');
			strDst2.SetAt (strDst2.GetLength () - 2, 'm');
			strDst2.SetAt (strDst2.GetLength () - 1, 'p');
			if (FALSE == MoveFile (strDst, strDst2))
				strDst2 = strDst;
			CString strFilter; 
			strFilter.Format ("%s files (*.%s)|*.%s||", pcmfc->stgs.strExtension,
				pcmfc->stgs.strExtension, pcmfc->stgs.strExtension);
			CFileDialog dlg (FALSE, pcmfc->stgs.strExtension, strDst, 
				OFN_OVERWRITEPROMPT|OFN_NOCHANGEDIR, strFilter, AfxGetApp ()->m_pMainWnd);
			if (IDCANCEL == _DlgMgr.DoModal (&dlg))
			{
				DeleteFile (strDst2);
			}
			else
			{
				strDst = dlg.GetPathName ();

				MoveFile (strDst2, strDst);

				info->bWaitDone = TRUE;

				CString strMsg;
				strMsg.Format (LS (L_CONVERTED_OK), strDst);
				UINT nRet = MyMessageBox (NULL, strMsg, LS (L_DONE), NULL, IDI_QUESTION, 
					LS (L_LAUNCH), LS (L_OPENFOLDER), "OK");

				if (nRet == IDC_BTN1)
				{
					ShellExecute (0, "open", strDst, NULL, NULL, SW_SHOW);
				}
				else if (nRet == IDC_BTN2)
				{
					CString strCmd;
					strCmd.Format ("/select,\"%s\"", strDst);
					ShellExecute (NULL, "open", "explorer.exe", strCmd, NULL, SW_SHOW);
				}
			}
		}

		_DldsMgr.AddEvent (pcmfc->dld, LS (L_DONE), EDT_RESPONSE_S);

		if (bDontDeleteSourceFile == FALSE)
			_DldsMgr.DownloadStateChanged (pcmfc->dld);
	}
	else
	{
		DeleteFile (strDst);
		_DldsMgr.AddEvent (pcmfc->dld, info->bNeedStop ? LS (L_CANCELED) : LS (L_FAILED), 
			EDT_RESPONSE_E);
		info->bWaitDone = TRUE;
		if (info->bNeedStop == FALSE)
		{
			CString strMsg;
			strMsg.Format (LS (L_CONVERTED_FAILED), pcmfc->dld->pMgr->get_OutputFilePathName ());
			MessageBox (NULL, strMsg, LS (L_FAILED), MB_ICONERROR); 
		}
	}

	info->bWaitDone = TRUE;
	delete pcmfc;

	return 0;
}
Esempio n. 29
0
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR lpCmd, int nShow)
{
    if ( LoadLibrary("RICHED20.DLL")==NULL )
	{
		MyMessageBox(NULL, "Unable to load RICHED20.DLL", "Fosterer", MB_OK, IDI_SPY);
		return -1;
	}
	
	KMainWindow win(hInst);
	KLogWindow  log(hInst);
    
	log.CreateEx(0, "LogWindow", "LogWindow",
	             WS_OVERLAPPEDWINDOW,
	             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
	             NULL, NULL, hInst);
	log.ShowWindow(nShow);
    log.UpdateWindow();

    win.CreateEx(0, "Fosterer", "Fosterer",
	             WS_OVERLAPPEDWINDOW,
	             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
	             NULL, LoadMenu(hInst, MAKEINTRESOURCE(IDR_MAIN)), hInst);
        
    win.ShowWindow(nShow);
    win.UpdateWindow();

    KPeriscopeClient scope("PeriScope");
    KImageModule	 win32k;

	TCHAR fullname[MAX_PATH];
	GetFullName(hInst, "periscope.sys", fullname);

    if ( scope.Load(fullname)==ERROR_SUCCESS )
	{
		theHost.ExtOutput("Periscope loaded\n");

		try
		{
			char SysDir[MAX_PATH];

			GetSystemDirectory(SysDir, sizeof(SysDir)); // c:\winnt\system32

			char * p = strchr(SysDir, '\\');   // first '\\'
			while ( p && strchr(p+1, '\\') )   // last '\\'	
				p = strchr(p+1, '\\');

			if ( p )						   // c:\winnt
				* p = NULL;

			strcat(SysDir, "\\symbols\\sys");

			if ( win32k.Load("win32k.sys", SysDir) )
			{
				theHost.pWin32k = & win32k;
				theHost.pScope  = & scope;
	
				if ( ! win.gdi.Load(& ExtensionAPI, "gdikdx.dll") )
					MyMessageBox(NULL, "Unable to load GDI kernel extension GDIKDX.DLL.\n", "Fosterer", MB_OK, IDI_SPY);
			}
			else
				MyMessageBox(NULL, "Unable to load win32k.sys debug information", "Fosterer", MB_OK, IDI_SPY);
		}
		catch (...)
		{
			OutputDebugString("Exception in WinMain");
		}
	}
	else
		MyMessageBox(NULL, fullname, "Unable to load kernel mode driver", MB_OK, IDI_SPY);

    win.MessageLoop();

	DestroyWindow(log.m_hWnd);

	scope.Close();

	return 0;
}
Esempio n. 30
0
/*------------------------------------------------
 「その他」ページ用ダイアログプロシージャ
--------------------------------------------------*/
BOOL CALLBACK PageMiscProc(HWND hDlg, UINT message,
	WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
		case WM_INITDIALOG:
			OnInit(hDlg);
			return TRUE;
		case WM_COMMAND:
		{
			WORD id, code;
			id = LOWORD(wParam); code = HIWORD(wParam);
			switch(id)
			{
			// 「時計を改造しない」
			case IDC_NOCLOCK:
			case IDC_TASKWNDCTRL:
				{
				g_bApplyClock = TRUE;
				SendPSChanged(hDlg);
				break;
				}
			// 「デスクトップカレンダーの自動更新」
			case IDC_DESKCAL:
				OnDeskcal(hDlg);
				break;
			// 「定期的にネットワークの確認」
			case IDC_CHECKNETWORK:
				OnCheckNet(hDlg);
				break;
			case IDC_CHECKNETINTERVAL:
				if(code == EN_CHANGE)
					SendPSChanged(hDlg);
				break;
			// チェックボックス
			case IDC_MCIWAVE:
			case IDC_ONLYDATECHANGED:
			case IDC_RESUMESUSPEND:
			case IDC_TONIKAKU:
			case IDC_WATCHWALL:
				SendPSChanged(hDlg);
				break;
			// 何秒後に開始
			case IDC_DELAYSTART:
			case IDC_DELAYNET:
				if(code == EN_CHANGE)
					SendPSChanged(hDlg);
				break;
			// 「...」 デスクトップカレンダーの参照
			case IDC_SANSHODESKCAL:
				OnSanshoDeskcal(hDlg, id);
				break;
			// 「スタートアップ」にショートカットをつくる
			case IDC_STARTUP:
				OnStartup(hDlg);
				break;
			case IDC_DELREG:
				{
					int r;
					r = DelRegAll();
					if (r == 0)
						MyMessageBox(hDlg,MyString(IDS_DELREGNGINI),MyString(IDS_DELREGT),MB_OK,MB_ICONEXCLAMATION);
					else if (r == 1)
						MyMessageBox(hDlg,MyString(IDS_DELREGOK),MyString(IDS_DELREGT),MB_OK,MB_ICONINFORMATION);
					else
						MyMessageBox(hDlg,MyString(IDS_DELREGNG),MyString(IDS_DELREGT),MB_OK,MB_ICONEXCLAMATION);
				}
				break;
			case IDC_CONFMAX:
			case IDC_CFMAXSPIN:
				SendPSChanged(hDlg);
				break;
			}
			return TRUE;
		}
		case WM_NOTIFY:
			switch(((NMHDR *)lParam)->code)
			{
				case PSN_APPLY: OnApply(hDlg); break;
				case PSN_HELP: My2chHelp(GetParent(hDlg), 11); break;
			}
			return TRUE;
	}
	return FALSE;
}