⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 systeminfo.cpp

📁 一款用与WINCE.0下播放MP3的播放软件,可以播放多中音频文件
💻 CPP
字号:
// SystemInfo.cpp : implementation file
//

#include "stdafx.h"

SysInfoData	SysData;
CStringList	g_StrList;

//judge the existence of file
BOOL IsFileExist(TCHAR* chFile)
{
	if(-1 == GetFileAttributes(chFile))
		return FALSE;
	else
		return TRUE;
}

BOOL MByteToWChar(LPCSTR lpcszStr, LPWSTR lpwszStr, DWORD dwSize)
{
    // Get the required size of the buffer that receives the Unicode string. 
    DWORD dwMinSize;
    dwMinSize = MultiByteToWideChar (CP_ACP, 0, lpcszStr, -1, NULL, 0);
	
    if(dwSize < dwMinSize)
    {
		return FALSE;
    }
	
	
    // Convert headers from ASCII to Unicode.
    MultiByteToWideChar (CP_ACP, 0, lpcszStr, -1, lpwszStr, dwMinSize); 
    return TRUE;
}


BOOL WCharToMByte(LPCWSTR lpcwszStr, LPSTR lpszStr, DWORD dwSize)
{
    // Get the required size of the buffer that receives the ASCII string. 
	DWORD dwMinSize;
	dwMinSize = WideCharToMultiByte(CP_OEMCP,NULL,lpcwszStr,-1,NULL,0,NULL,FALSE);
	if(dwSize < dwMinSize)
	{
		return FALSE;
	}
    // Convert headers from Unicode to ASCII.
	WideCharToMultiByte(CP_OEMCP,NULL,lpcwszStr,-1,lpszStr,dwMinSize,NULL,FALSE);
	return TRUE;
}

TCHAR* GetCurrentListName()
{
	TCHAR CFileName[MAX_STRING];
	DWORD dSize = GetModuleFileName(GetModuleHandle(NULL),CFileName,MAX_PATH);
	
	if(!dSize)
		return NULL;

	CString strPath(CFileName);
	int nPos = strPath.ReverseFind('.');
	strPath = strPath.Left(nPos);
	strPath = strPath+TEXT("List.dat");
	
	return strPath.GetBuffer(strPath.GetLength());
	
}

BOOL LoadPlayList()
{
	CFile	file; 
	int		nCount = 0;
	char	cByte;
	char	szByte[MAX_STRING];
	TCHAR	chStr[MAX_STRING];
	short	tmp;

	//first delete all space
	g_StrList.RemoveAll();
	//open file
	if (file.Open(GetCurrentListName(), CFile::modeRead)) 
	{
		while(1)
		{
			tmp = file.Read(&cByte, 1);
			if (0 ==tmp)
				break;
			else if(cByte == 13)
			{
				szByte[nCount] = 0;
				MByteToWChar(szByte,chStr,MAX_STRING);
				
				if(IsFileExist(chStr))
				{
					//chstr is fullname
					g_StrList.AddTail(chStr);
				}
				nCount = 0;
				continue;
			}
			szByte[nCount++] = cByte;
		}
		file.Close(); 
		return TRUE;
	}
	return FALSE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -