IEGetWriteableFolderPath未在Window 7中实现? [英] IEGetWriteableFolderPath not implemented in Window 7?

查看:99
本文介绍了IEGetWriteableFolderPath未在Window 7中实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 一个IE插件,我想写一个简单的日志文件到磁盘。在XP中我写到AppData,但在Vista中使用IE7保护模式我不能,所以我使用ieframe.dll方法获取缓存目录的路径 - 如下所示:


 static HRESULT GetIECacheDir(CString& csPath)
{
typedef HRESULT(WINAPI * PFNIEGETWRITEABLEFOLDERPATH)(REFGUID clsidFolderID,LPWSTR * lppwstrPath);

PFNIEGETWRITEABLEFOLDERPATH pfnIEGetWritableFolderPath = NULL;
HRESULT hr = S_OK;
HINSTANCE hInstance = NULL;
LPWSTR wszPath = NULL;
csPath.Empty();

hInstance = LoadLibrary(_T(&ieframe.dll"));
if(NULL == hInstance)返回E_FAIL;

pfnIEGetWritableFolderPath =(PFNIEGETWRITEABLEFOLDERPATH)GetProcAddress

hInstance,
" IEGetWriteableFolderPath"
);
if(NULL == pfnIEGetWritableFolderPath)
{
FreeLibrary(hInstance);
返回E_FAIL;
}

hr = pfnIEGetWritableFolderPath(FOLDERID_InternetCache,& wszPath);
if(SUCCEEDED(hr)&& NULL!= wszPath)
{
CComBSTR bstrPath(wszPath);
csPath = bstrPath.Detach();
CoTaskMemFree(wszPath);
}

FreeLibrary(hInstance);
返回S_OK;
}


当我在带有IE8的Windows 7机箱中测试此代码时,我得到了这个方法的E_NOTIMPL。

我做错了什么?

解决方案

我在Windows 7上得到完全相同的结果IE8  - >    E_NOTIMPL

您的代码没有问题

其他人是否可以在Windows 7上调用IEGetWritableFolderPath?



THX



I hav e an IE plugin, and I want to write a simple log file to disk. In XP i write to AppData, but in Vista with IE7 Protected Mode I can't, so I'm using ieframe.dll methods to get the path to the cache directory - like so:

	static HRESULT GetIECacheDir( CString & csPath )
	{
		typedef HRESULT ( WINAPI *PFNIEGETWRITEABLEFOLDERPATH )( REFGUID clsidFolderID, LPWSTR *lppwstrPath );
		
		PFNIEGETWRITEABLEFOLDERPATH pfnIEGetWritableFolderPath = NULL;
		HRESULT hr = S_OK;
		HINSTANCE hInstance = NULL;
		LPWSTR wszPath = NULL;
		csPath.Empty();

		hInstance = LoadLibrary( _T("ieframe.dll") );
		if ( NULL == hInstance ) return E_FAIL;

		pfnIEGetWritableFolderPath = (PFNIEGETWRITEABLEFOLDERPATH) GetProcAddress
			(
			hInstance,
			"IEGetWriteableFolderPath"
			);
		if ( NULL == pfnIEGetWritableFolderPath )
		{
			FreeLibrary( hInstance );
			return E_FAIL;
		}

		hr = pfnIEGetWritableFolderPath( FOLDERID_InternetCache, &wszPath );
		if ( SUCCEEDED( hr ) && NULL != wszPath )
		{
			CComBSTR bstrPath( wszPath );
			csPath = bstrPath.Detach();
			CoTaskMemFree( wszPath );
		}

		FreeLibrary( hInstance );
		return S_OK;
	}

When I tested this code in a Windows 7 box with IE8, I got a E_NOTIMPL for this method.

Am I doing something wrong?


解决方案

I get the exact same result on windows 7 IE8  -->    E_NOTIMPL

there is nothing wrong with your code

are other people able to call IEGetWritableFolderPath on windows 7 ?



thx



这篇关于IEGetWriteableFolderPath未在Window 7中实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆