亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? phonelistbox.cpp

?? 以前做NOKIA手機與PC通信時所參考的源代碼,里面包括兩個程序,一個是手機文件夾瀏覽源碼,另一個手機SIS安裝程序.
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*
Filename    : PhoneListBox.cpp
Part of     : File Browser
Description : Implementation of File Browser's phone list box
Version     : 3.2

This example is only to be used with PC Connectivity API version 3.2.
Compability ("as is") with future versions is not quaranteed.

Copyright (c) 2007 Nokia Corporation.
 
This material, including but not limited to documentation and any related 
computer programs, is protected by intellectual property rights of Nokia 
Corporation and/or its licensors.
All rights are reserved. Reproducing, modifying, translating, or 
distributing any or all of this material requires the prior written consent 
of Nokia Corporation. Nokia Corporation retains the right to make changes 
to this material at any time without notice. A copyright license is hereby 
granted to download and print a copy of this material for personal use only.
No other license to any other intellectual property rights is granted. The 
material is provided "as is" without warranty of any kind, either express or 
implied, including without limitation, any warranty of non-infringement, 
merchantability and fitness for a particular purpose. In no event shall 
Nokia Corporation be liable for any direct, indirect, special, incidental, 
or consequential loss or damages, including but not limited to, lost profits 
or revenue,loss of use, cost of substitute program, or loss of data or 
equipment arising out of the use or inability to use the material, even if 
Nokia Corporation has been advised of the likelihood of such damages occurring.
*/ 

#include "stdafx.h"
#include "FileBrowser.h"
#include "FileBrowserDlg.h"
#include "PhoneListBox.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

const CString g_strPhoneRoot = L"\\\\"; // '\\' means phone root

//===================================================================
// CPhoneListBox

//===================================================================
// Constructor
//
//===================================================================
CPhoneListBox::CPhoneListBox():CListBox()
{
    m_wState = PHONELIST_STATE_PHONELIST;
	m_hFS = NULL;
    m_strCurrentSN = L"";
    m_strCurrentFolder = L"";
    m_pLabel = NULL;
	TRACE(L"CPhoneListBox::CPhoneListBox(): Calling CONAOpenDM...");
    DWORD dwResult = CONAOpenDM(&m_hDM);
    if(dwResult != CONA_OK)
    {
        TRACE(L"CPhoneListBox::CPhoneListBox(): CONAOpenDM failed\n");
        ErrorMessageDlg(L"CPhoneListBox::CPhoneListBox(): CONAOpenDM failed", dwResult);
    }
    else
    {
        TRACE(L"CPhoneListBox::CPhoneListBox(): CONAOpenDM succeeded\n");
    }
	dwResult = CONARegisterDMNotifyIF(m_hDM, API_REGISTER, this);
    if(dwResult != CONA_OK)
    {
        TRACE(L"CPhoneListBox::CPhoneListBox(): CONARegisterDMNotifyIF() failed\n");
        ErrorMessageDlg(L"CPhoneListBox::CPhoneListBox(): CONARegisterDMNotifyIF() failed", dwResult);
    }
    else
    {
        TRACE(L"CPhoneListBox::CPhoneListBox(): CONARegisterDMNotifyIF() succeeded\n");
    }
}

//===================================================================
// Destructor
//
//===================================================================
CPhoneListBox::~CPhoneListBox()
{  
    TRACE(L"CPhoneListBox::~CPhoneListBox()\n");
	DWORD dwResult = CONARegisterDMNotifyIF(m_hDM, API_UNREGISTER, this);
    if(dwResult != CONA_OK)
    {
        TRACE(L"CPhoneListBox::~CPhoneListBox(): CONARegisterDMNotifyIF() failed\n");
        ErrorMessageDlg(L"CPhoneListBox::~CPhoneListBox(): CONARegisterDMNotifyIF() failed", dwResult);
    }
    else
    {
        TRACE(L"CPhoneListBox::~CPhoneListBox(): CONARegisterDMNotifyIF() succeeded\n");
    }
}

BEGIN_MESSAGE_MAP(CPhoneListBox, CListBox)
	//{{AFX_MSG_MAP(CPhoneListBox)
	ON_WM_DESTROY()
	ON_WM_LBUTTONDBLCLK()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

//===================================================================
// Init
// 
// Sets member variable m_pLabel
// 
//===================================================================
void CPhoneListBox::Init(CStatic* pLabel)
{
    // Set static control to write status information
    m_pLabel = pLabel;
}


//===================================================================
// PostNcDestroy
// 
// Overridden for cleanup
// 
//===================================================================
void CPhoneListBox::PostNcDestroy()
{
	// Close phone file system handle
	CloseFS(m_hFS);
	// Close device management handle
    DWORD dwResult = CONACloseDM(m_hDM);
    if(dwResult != CONA_OK)
    {
        TRACE(L"CPhoneListBox::~CPhoneListBox(): CONACloseDM failed\n");
        ErrorMessageDlg(L"CPhoneListBox::~CPhoneListBox(): CONACloseDM failed", dwResult);
    }
    else
    {
        TRACE(L"CPhoneListBox::~CPhoneListBox(): CONACloseDM succeeded\n");
    }

	__super::PostNcDestroy();
}

//===================================================================
// PhoneItemDblClicked
// 
// Called, when user has doubleclicked phone item
// If item is [..], shows parent folder
// If item is [foldername], shows subfolder
// 
//===================================================================
void CPhoneListBox::PhoneItemDblClicked()
{
    CString strSelectedTxt, strCurrentFolder;
    int index = GetCurSel();
    if(index != LB_ERR)
    {
        GetText(index, strSelectedTxt);
        if(strSelectedTxt == L"[..]")
        { // go up in folder tree
            if((strCurrentFolder = GetSelectedFolder()) == g_strPhoneRoot)
            { // root folder --> show phone list
                ResetContent();
                m_wState = PHONELIST_STATE_PHONELIST;            
                ListAllPhones();
            }
            else
            {
                // getting parent folder of strCurrentFolder:
                if(strCurrentFolder != g_strPhoneRoot)
                {
                    strCurrentFolder = strCurrentFolder.Left(strCurrentFolder.ReverseFind('\\'));
                    if(strCurrentFolder == L"\\") 
                    { // move to root folder
                        strCurrentFolder = g_strPhoneRoot;
                    }
                }
                ShowPhoneFolder(strCurrentFolder);
            }
        }
        else if(strSelectedTxt[0] == '[')
        { // selected item is folder
            ShowPhoneFolder(GetSelectedFolder());
        }
        else
        { // selected item is file
            TRACE(L"CPhoneListBox::PhoneItemDblClicked(): Double clicked file %s --> ignoring...\n", strSelectedTxt);
        }
    }
    else
    {
        TRACE(L"CPhoneListBox::PhoneItemDblClicked(): No list box item selected.\n");
    }
}

//===================================================================
// ShowFolders
//
// Adds all found folders to listbox by using CONAFindNextFolder.
// 
//===================================================================
void CPhoneListBox::ShowFolders(FINDHANDLE hFindHandle)
{
    CONAPI_FOLDER_INFO FolderInfo = {0};
    DWORD dwResult = 0;
    while((dwResult = CONAFindNextFolder(hFindHandle, &FolderInfo)) == CONA_OK)
    {  
        CTime time = CTime(FolderInfo.tFolderTime);
        TRACE(L"Folder: %s\t%s\tModified: %s\tLabel: %s\tMemory type: %s\n", 
            FolderInfo.pstrName,
            Permissions2String(FolderInfo.dwAttributes),
            time.Format(L"%d.%m.%Y %H:%M:%S"), 
            FolderInfo.pstrLabel,
            FolderInfo.pstrMemoryType);
        int index = AddString(L"[" + CString(FolderInfo.pstrName) + L"]");
        
        // Setting folder name as itemdata
        CString* pItemData = new CString(FolderInfo.pstrName);        
        SetItemDataPtr(index, pItemData);
        dwResult = CONAFreeFolderInfoStructure(&FolderInfo);
        if(dwResult != CONA_OK)
        {            
            ErrorMessageDlg(L"CPhoneListBox::ShowFolders(): CONAFreeFolderinfoStructure failed", dwResult);
        }
    }    
    if(dwResult != ECONA_ALL_LISTED)
    {
        ErrorMessageDlg(L"CPhoneListBox::ShowFolders(): CONAFindNextFolder failed!", dwResult);
    }
}

//===================================================================
// ShowFolders
//
// Adds all found files to listbox by using CONAFindNextFile.
// 
//===================================================================
void CPhoneListBox::ShowFiles(FINDHANDLE hFindHandle)
{
    CONAPI_FILE_INFO FileInfo = {0};
    DWORD dwResult = 0;
    while((dwResult = CONAFindNextFile(hFindHandle, &FileInfo)) == CONA_OK)
    {  
        CTime time = CTime(FileInfo.tFileTime);
        CString strAttributes = L"";
        TRACE(L"File: %s\t%s\tSize: %d\tModified: %s\tMIMEType: %s\n", 
            FileInfo.pstrName,
            Permissions2String(FileInfo.dwAttributes),
            FileInfo.dwFileSize, 
            time.Format(L"%d.%m.%Y %H:%M:%S"), 
            CString(FileInfo.pstrMIMEType));
        int index = AddString(FileInfo.pstrName);
        // Setting file name as itemdata
        CString* pItemData = new CString(FileInfo.pstrName);
        SetItemDataPtr(index, pItemData);
        dwResult = CONAFreeFileInfoStructure(&FileInfo);
        if(dwResult != CONA_OK)
        {
            ErrorMessageDlg(L"CPhoneListBox::ShowFiles(): CONAFreeFileInfoStructure failed!", dwResult);
        }
    }    
    if(dwResult != ECONA_ALL_LISTED)
    {
        ErrorMessageDlg(L"CPhoneListBox::ShowFiles(): CONAFindNextFile failed!", dwResult);
    }
}

//===================================================================
// ShowPhoneFolder
//
// Adds all files and folders to listbox by using
// functions CONAFindBegin and CONAFindEnd.
// 
//===================================================================
void CPhoneListBox::ShowPhoneFolder(CString strFolder)
{       
    TRACE(L"CPhoneListBox::ShowPhoneFolder(): Begin\n\tstrFolder = %s\n", strFolder);
    FINDHANDLE hFind = NULL;
    DWORD dwMedia = API_MEDIA_ALL;
    DWORD dwDeviceID = 0;
	DWORD dwFindOptions = 0;
	if(((CFileBrowserDlg*)GetParent())->GetCacheOption())
	{
		dwFindOptions |= CONA_FIND_USE_CACHE;
	}
    DWORD dwResult = CONAFindBegin(m_hFS, dwFindOptions, &hFind, strFolder);
    if(dwResult == CONA_OK)
    {            
        ResetContent();
        AddString(L"[..]");            
        ShowFolders(hFind);
        ShowFiles(hFind);
        m_strCurrentFolder = strFolder;
        dwResult = CONAFindEnd(hFind);                
        if(dwResult != CONA_OK)
        {
            ErrorMessageDlg(L"CPhoneListBox::ShowPhoneFolder(): CONAFindEnd failed!", dwResult);
        }
    }
    else
    {
        CString strErrortxt;
        strErrortxt.Format(L"CPhoneListBox::ShowPhoneFolder(): CONAFindBegin(%s) failed!\nm_hFS = 0x%X, hFind = 0x%X", strFolder, m_hFS, hFind);
        ErrorMessageDlg(strErrortxt, dwResult);
        ListAllPhones();
    }

    if(m_pLabel)
    {
        CONAPI_DEVICE Device = {0};
        dwResult = CONAGetDevice(m_hDM, m_strCurrentSN, &Device);
        if(dwResult == CONA_OK)
        {
            CString mFN = Device.pstrFriendlyName;
            m_pLabel->SetWindowText(mFN + L":" + strFolder);
            dwResult = CONAFreeDeviceStructure(1, &Device);
            if(dwResult != CONA_OK)
            {
                ErrorMessageDlg(L"CPhoneListBox::ShowPhoneFolder(): CONAFreeDeviceStructure failed!", dwResult);
            }
        }            
    }
    TRACE(L"CPhoneListBox::ShowPhoneFolder(): End\n");
}

//===================================================================
// GetCurrentSN
//
// Returns serial number of currently selected phone
// 
//===================================================================
CString CPhoneListBox::GetCurrentSN()
{
    CString strRetVal = L"";
    if(m_wState == PHONELIST_STATE_PHONELIST)
    { // phone list is shown
        int index = GetCurSel(); 
        if(index != LB_ERR)
        { // there is a selected item
            CONAPI_DEVICE *pDevice = (CONAPI_DEVICE*)GetItemDataPtr(index);
            if(pDevice)
            { // copying serial number to strRetVal
                strRetVal = CString(pDevice->pstrSerialNumber);
            }
        }
    }
    else
    { // user is browsing phone content
        strRetVal = m_strCurrentSN;
    }
    return strRetVal;
}

//===================================================================
// GetState
//
// Returns current state of listbox 
// (PHONELIST_STATE_PHONELIST or PHONELIST_STATE_PHONECONTENT)
// 
//===================================================================
DWORD CPhoneListBox::GetState()
{
    return m_wState;
}

//===================================================================
// GetFreeMemoryString
//
// Returns string containing free memory of "DEV"
// This function demonstrates use of functions
// CONARefreshDeviceMemoryValues, CONAGetMemoryTypes and
// CONAGetMemoryValues
// 
//===================================================================
CString CPhoneListBox::GetFreeMemoryString(CONAPI_DEVICE* pDevice)
{  
    TRACE(L"CPhoneListBox::GetFreeMemoryString(): Begin\n");
    CString strRetVal = L"";
	CString strTmp = L"";
    WCHAR* pstrMemoryTypes = NULL;
    DWORD dwMedia = pDevice->pItems->dwMedia;
    DWORD dwDeviceID = 0;
    __int64 dwFreeMem = -1, dwTotalMem = -1, dwUsedMem = -1;

	FSHANDLE hFS = OpenFS(pDevice->pstrSerialNumber);
	if(!hFS)
	{
		return strRetVal;
	}
    // refreshing memory values
    DWORD dwResult = CONARefreshDeviceMemoryValues(hFS);
    if(dwResult != CONA_OK)
    {
        ErrorMessageDlg(L"CPhoneListBox::GetFreeMemoryString(): CONARefreshDeviceMemoryValues failed!", dwResult);
    }
    
    // Getting memory types of connected device
    dwResult = CONAGetMemoryTypes(hFS, &pstrMemoryTypes);
    if(dwResult == CONA_OK)
    {
        // go through memory type list:
        WCHAR* separator = L",";
		wchar_t* next_token;
		bool bFirst = true;
        WCHAR* token = wcstok_s(pstrMemoryTypes, separator, &next_token);
        while(token != NULL)
        {
            dwResult = CONAGetMemoryValues(hFS, token, &dwFreeMem, &dwTotalMem, &dwUsedMem);
            if(dwResult == CONA_OK)
            {
                TRACE(L"CPhoneListBox::GetFreeMemoryString(): %s: free %0.2f MB used %0.2f/%0.2f MB\n",
                    token, (double)dwFreeMem/1024/1024, (double)dwUsedMem/1024/1024, (double)dwTotalMem/1024/1024);

				// let's show memory values of the memory type
				if(bFirst)
				{
					bFirst = false;
					strTmp.Format(L"%s: ", token);
				}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美国一区二区三区在线播放| 日韩福利电影在线| 欧美韩日一区二区三区| 日韩一区二区三区视频| 欧美精品视频www在线观看| 欧美性色黄大片| 欧美高清视频www夜色资源网| 欧美日韩国产另类一区| 制服丝袜一区二区三区| 日韩欧美综合一区| 久久久一区二区| 国产蜜臀av在线一区二区三区| 久久精品人人做人人爽人人| 中文字幕电影一区| 亚洲男同性恋视频| 亚洲成人手机在线| 男女视频一区二区| 国产**成人网毛片九色| 色婷婷久久一区二区三区麻豆| 欧美色倩网站大全免费| 日韩欧美一级精品久久| 国产精品天美传媒沈樵| 樱花影视一区二区| 日本不卡的三区四区五区| 国产毛片精品国产一区二区三区| 成人精品鲁一区一区二区| 欧美系列日韩一区| 久久久久亚洲蜜桃| 亚洲欧美一区二区三区久本道91| 天堂蜜桃91精品| 懂色中文一区二区在线播放| 欧美亚男人的天堂| 久久精品欧美一区二区三区不卡 | 日韩三级免费观看| 国产午夜三级一区二区三| 亚洲资源在线观看| 久久国产精品99久久人人澡| 不卡一区二区三区四区| 欧美一区二区成人| 亚洲欧美一区二区三区久本道91| 捆绑调教美女网站视频一区| 91美女精品福利| 久久网这里都是精品| 亚洲国产wwwccc36天堂| 99久久伊人网影院| 欧美成人一区二区三区在线观看 | 欧美一区三区四区| 国产精品久久精品日日| 麻豆免费精品视频| 欧美日韩一区二区不卡| 国产精品激情偷乱一区二区∴| 日本一不卡视频| 欧美性猛交xxxx乱大交退制版 | 一区二区三区四区五区视频在线观看| 蜜桃一区二区三区在线观看| 色综合久久久久网| 国产偷国产偷亚洲高清人白洁| 免费成人结看片| 欧美男男青年gay1069videost| 亚洲视频在线一区| 国产91精品一区二区麻豆亚洲| 欧美刺激午夜性久久久久久久| 日日骚欧美日韩| 欧美日韩精品免费| 亚洲一二三四区不卡| 99国产精品99久久久久久| 国产人久久人人人人爽| 精品在线免费视频| 精品国产乱码久久久久久老虎| 日本中文字幕一区二区有限公司| 欧美又粗又大又爽| 亚洲一区二区欧美激情| 欧美综合在线视频| 中文字幕制服丝袜一区二区三区| 日韩电影免费在线看| 日韩欧美国产小视频| 久久99精品久久久久久| 欧美精品一区二区久久久| 精品亚洲免费视频| 久久久亚洲精品石原莉奈| 国产美女精品一区二区三区| 久久精品日产第一区二区三区高清版| 国产高清不卡一区二区| 日本一区二区综合亚洲| 99精品欧美一区| 一区二区三区在线视频免费观看| 欧美亚洲自拍偷拍| 日本中文字幕一区二区视频 | 蜜桃视频第一区免费观看| 欧美大片在线观看| 成人丝袜18视频在线观看| 国产精品久久久久久久久免费相片 | 亚洲国产综合色| 91精品国产aⅴ一区二区| 精品一区二区三区日韩| 国产欧美精品一区二区色综合朱莉| 激情综合网激情| 国产精品毛片高清在线完整版| 一本大道久久a久久精二百| 香蕉成人伊视频在线观看| 久久综合色婷婷| 色婷婷亚洲综合| 久久99精品国产.久久久久 | 91极品视觉盛宴| 日本麻豆一区二区三区视频| 中文字幕的久久| 欧美女孩性生活视频| 国产成人免费视频网站高清观看视频| 亚洲色图丝袜美腿| 3d成人h动漫网站入口| 成人免费毛片片v| 亚洲高清视频中文字幕| 国产欧美一区二区精品性色| 欧美在线综合视频| 国产美女在线观看一区| 亚洲国产成人tv| 国产精品麻豆一区二区| 日韩欧美国产精品一区| 91亚洲精品乱码久久久久久蜜桃| 看电视剧不卡顿的网站| 一区二区不卡在线视频 午夜欧美不卡在| 69堂精品视频| 色综合久久99| 国产精品538一区二区在线| 日韩精品五月天| 一区二区成人在线视频| 国产精品久久久久一区二区三区 | 欧美一区永久视频免费观看| 99精品欧美一区| 国产精品77777竹菊影视小说| 天天爽夜夜爽夜夜爽精品视频| 欧美激情一二三区| 久久青草欧美一区二区三区| 在线播放一区二区三区| 91视频.com| 99精品1区2区| 99视频一区二区| 成人av免费观看| 国产成人午夜视频| 久久精品国产精品亚洲综合| 亚洲一区在线视频观看| 亚洲欧美综合在线精品| 久久蜜桃av一区二区天堂| 日韩你懂的电影在线观看| 555www色欧美视频| 欧美日韩一区二区在线观看| 日本高清不卡视频| 99国产一区二区三精品乱码| 成人av手机在线观看| 国产精品99久| 国产成人综合在线| 高清视频一区二区| 波多野结衣91| 一本大道久久a久久精品综合| 91免费观看视频在线| 色哦色哦哦色天天综合| 91麻豆文化传媒在线观看| 在线看不卡av| 欧美伊人精品成人久久综合97| 在线影院国内精品| 欧美三级在线视频| 911精品国产一区二区在线| 欧美精品xxxxbbbb| 欧美电影免费观看高清完整版在| 日韩亚洲欧美综合| 久久精品欧美日韩精品| 136国产福利精品导航| 亚洲精品中文字幕乱码三区| 一区二区三区免费在线观看| 亚洲大片精品永久免费| 麻豆精品久久精品色综合| 国产精品白丝jk白祙喷水网站| 不卡的av网站| 欧美日韩中文一区| 亚洲精品在线三区| 中文字幕一区二区不卡| 亚洲成人黄色小说| 国内一区二区视频| 色美美综合视频| 日韩美女视频在线| 国产精品国模大尺度视频| 亚洲电影第三页| 国产一区二区三区四| 91行情网站电视在线观看高清版| 69av一区二区三区| 国产欧美va欧美不卡在线| 亚洲综合av网| 国产乱码字幕精品高清av | 欧美三片在线视频观看| 精品日韩一区二区三区 | 久久一区二区三区四区| 亚洲欧美中日韩| 蜜桃久久久久久久| 91视频com| 国产亚洲成av人在线观看导航| 亚洲成a人在线观看| 成人av免费在线播放| 日韩欧美电影一区| 亚洲综合成人在线视频| 成人黄色av电影|