实现IFileDialog
实例说明了IFileDialog的使用,以及自定义打开文件对话框,监听打开文件对话框事件等等,vs2010 win7下编写。该代码是我博文的代码,下载前可阅读博文了解情况
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2624 2014-03-27 22:14 IFDIFDFileDialogEvent.cpp
文件 1441 2014-03-27 22:06 IFDIFDFileDialogEvent.h
文件 104912 2014-03-28 20:30 IFDIFDIFD.APS
文件 1954 2014-03-27 16:11 IFDIFDIFD.cpp
文件 424 2014-03-27 16:11 IFDIFDIFD.h
文件 8658 2014-03-28 20:30 IFDIFDIFD.rc
文件 5979 2014-03-27 16:54 IFDIFDIFD.vcxproj
文件 2156 2014-03-27 16:54 IFDIFDIFD.vcxproj.filters
文件 143 2014-03-27 16:11 IFDIFDIFD.vcxproj.user
文件 8416 2014-03-28 20:37 IFDIFDIFDDlg.cpp
文件 652 2014-03-28 20:30 IFDIFDIFDDlg.h
文件 2937 2014-03-27 16:11 IFDIFDReadMe.txt
....... 67777 2009-08-31 02:31 IFDIFD
esIFD.ico
文件 662 2014-03-27 16:11 IFDIFD
esIFD.rc2
文件 1260 2014-03-28 20:30 IFDIFD
esource.h
文件 136 2014-03-27 16:11 IFDIFDstdafx.cpp
文件 1650 2014-03-27 16:54 IFDIFDstdafx.h
文件 234 2014-03-27 16:11 IFDIFD argetver.h
文件 876 2014-03-27 16:11 IFDIFD.sln
..A..H. 15360 2014-03-28 20:43 IFDIFD.suo
目录 0 2014-03-27 16:11 IFDIFD
es
目录 0 2014-03-28 20:25 IFDipchifd-d8af53ee
目录 0 2014-03-28 20:43 IFDIFD
目录 0 2014-03-28 20:25 IFDipch
目录 0 2014-03-28 20:43 IFD
文件 63524864 2014-03-28 20:43 IFDIFD.sdf
----------- --------- ---------- ----- ----
63753115 26
// FileDialogEvent.cpp : 实现文件
//
#include “stdafx.h“
#include “IFD.h“
#include “FileDialogEvent.h“
// CFileDialogEvent
CFileDialogEvent::CFileDialogEvent()
{
this->m_Ref=1;
}
CFileDialogEvent::~CFileDialogEvent()
{
}
// 接口方法及成员函数的实现
HRESULT CFileDialogEvent::QueryInterface(REFIID iid void**ppobject)
{
if(ppobject==NULL)
return E_INVALIDARG;
static const QITAB qit[] = {
QITABENT(CFileDialogEvent IFileDialogEvents)
QITABENT(CFileDialogEvent IFileDialogControlEvents)
{ 0 }
};
return QISearch(this qit iid ppobject);
}
ULONG CFileDialogEvent::AddRef()
{
return InterlockedIncrement(&m_Ref);
}
ULONG CFileDialogEvent::Release()
{
long cRef = InterlockedDecrement(&m_Ref);
if (!cRef)
delete this;
return cRef;
}
//////////////////////////////////////////IFileDialogEvents接口的方法
HRESULT CFileDialogEvent::OnFileOk(IFileDialog *pfd)
{
return S_OK;
}
HRESULT CFileDialogEvent::OnFolderChange(IFileDialog *pfd)
{
return S_OK;
}
HRESULT CFileDialogEvent::OnFolderChanging(IFileDialog *pfdIShellItem *psiFolder)
{
return S_OK;
}
HRESULT CFileDialogEvent::OnOverwrite(IFileDialog *fdIShellItem *siFDE_OVERWRITE_RESPONSE *fde)
{
return S_OK;
}
HRESULT CFileDialogEvent::onselectionchange(IFileDialog *pfd)
{
return S_OK;
}
HRESULT CFileDialogEvent::OnShareViolation(IFileDialog *pfdIShellItem *psiFDE_SHAREVIOLATION_RESPONSE *pResponse)
{
return S_OK;
}
HRESULT CFileDialogEvent::OnTypeChange(IFileDialog *pfd)
{
return S_OK;
}
////////////////////////////IFileDialogControlEvents 接口方法
HRESULT CFileDialogEvent::OnButtonclicked(IFileDialogCustomize *pfdcDWORD dwIDCtl)
{
if(dwIDCtl==1)
{
AfxMessageBox(L“我是收割者A“);
}
else if(dwIDCtl==2)
{
AfxMessageBox(L“我是收割者B“);
}
return S_OK;
}
HRESULT CFileDialogEvent::OnCheckButtonToggled(IFileDialogCustomize *pfdcDWORD dwIDCtlBOOL bChecked)
{
return E_NOTIMPL;
}
HRESULT CFileDialogEvent::OnControlActivating(IFileDialogCustomize *pfdcDWORD dwIDCtl)
{
return E_NOTIMPL;
}
HRESULT CFileDialogEvent::OnItemSelected(IFileDialogCustomize *pfdcDWORD dwIDCtl DWORD dwIDItem)
{
return E_NOTIMPL;
}
///////////////////建立对象
HRESULT CFileDialogEvent::CreateInstance(REFIID iidvoid**ppobject)
{
if(ppobject==NULL)
{
return E_POINTER;
}
CFileDialogEvent *fdf=new (std::nothrow)CFileDialogEvent;
if(fdf==NULL)
{
return E_FAIL;
}
fdf->QueryInterface(iidppobject);
fdf->Release();
return S_OK;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2624 2014-03-27 22:14 IFDIFDFileDialogEvent.cpp
文件 1441 2014-03-27 22:06 IFDIFDFileDialogEvent.h
文件 104912 2014-03-28 20:30 IFDIFDIFD.APS
文件 1954 2014-03-27 16:11 IFDIFDIFD.cpp
文件 424 2014-03-27 16:11 IFDIFDIFD.h
文件 8658 2014-03-28 20:30 IFDIFDIFD.rc
文件 5979 2014-03-27 16:54 IFDIFDIFD.vcxproj
文件 2156 2014-03-27 16:54 IFDIFDIFD.vcxproj.filters
文件 143 2014-03-27 16:11 IFDIFDIFD.vcxproj.user
文件 8416 2014-03-28 20:37 IFDIFDIFDDlg.cpp
文件 652 2014-03-28 20:30 IFDIFDIFDDlg.h
文件 2937 2014-03-27 16:11 IFDIFDReadMe.txt
....... 67777 2009-08-31 02:31 IFDIFD
esIFD.ico
文件 662 2014-03-27 16:11 IFDIFD
esIFD.rc2
文件 1260 2014-03-28 20:30 IFDIFD
esource.h
文件 136 2014-03-27 16:11 IFDIFDstdafx.cpp
文件 1650 2014-03-27 16:54 IFDIFDstdafx.h
文件 234 2014-03-27 16:11 IFDIFD argetver.h
文件 876 2014-03-27 16:11 IFDIFD.sln
..A..H. 15360 2014-03-28 20:43 IFDIFD.suo
目录 0 2014-03-27 16:11 IFDIFD
es
目录 0 2014-03-28 20:25 IFDipchifd-d8af53ee
目录 0 2014-03-28 20:43 IFDIFD
目录 0 2014-03-28 20:25 IFDipch
目录 0 2014-03-28 20:43 IFD
文件 63524864 2014-03-28 20:43 IFDIFD.sdf
----------- --------- ---------- ----- ----
63753115 26
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)