环境:win2kadv server+VC6.0+sp5+platform SDK 6.0
我编的是用atl生成的DHTMl controls,在Controls的Oncreate事件
把客户端的收藏夹上传!所以用到了
Microsoft Shell Controls And Automation(Ver 1.0)控件关键程序:
#import <shell32.dll> Shell32::IShellDispatchPtr pshell;
hr=pshell.CreateInstance(__uuidof(Shell32::Shell),NULL);
if(!SUCCEEDED(hr))
//MessageBox("Create Shell ok!","ok",MB_OK);
{ MessageBox("Create Shell Error!","致命错误",MB_OK);
return !S_OK;
}
这段程序在我自己的机器下好用,但是在win98se下不好用,
我认为可能的问题:
在win2k下Microsoft Shell Controls And Automation(Ver 1.0) 对应的dll是C:\winnt\system32\shell32.dll
而在win98下Microsoft Shell Controls And Automation(Ver 1.0) 对应的dll是C:\windows\system\shdoc401.dll /*查了说是for IE4.01的在win98se下把#import <shell32.dll> 改为
#import <shdoc401.dll> ,编译通过,在win98se下还是不好用,但是在win2k下还是好用,我还怀疑是
hr=pshell.CreateInstance(__uuidof(Shell32::Shell),NULL);
的GUID问题,但是我不会用GUID CreateInstance!大侠帮帮忙了!
我编的是用atl生成的DHTMl controls,在Controls的Oncreate事件
把客户端的收藏夹上传!所以用到了
Microsoft Shell Controls And Automation(Ver 1.0)控件关键程序:
#import <shell32.dll> Shell32::IShellDispatchPtr pshell;
hr=pshell.CreateInstance(__uuidof(Shell32::Shell),NULL);
if(!SUCCEEDED(hr))
//MessageBox("Create Shell ok!","ok",MB_OK);
{ MessageBox("Create Shell Error!","致命错误",MB_OK);
return !S_OK;
}
这段程序在我自己的机器下好用,但是在win98se下不好用,
我认为可能的问题:
在win2k下Microsoft Shell Controls And Automation(Ver 1.0) 对应的dll是C:\winnt\system32\shell32.dll
而在win98下Microsoft Shell Controls And Automation(Ver 1.0) 对应的dll是C:\windows\system\shdoc401.dll /*查了说是for IE4.01的在win98se下把#import <shell32.dll> 改为
#import <shdoc401.dll> ,编译通过,在win98se下还是不好用,但是在win2k下还是好用,我还怀疑是
hr=pshell.CreateInstance(__uuidof(Shell32::Shell),NULL);
的GUID问题,但是我不会用GUID CreateInstance!大侠帮帮忙了!
void CTest7Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
char lpszPath[MAX_PATH];
if( !SHGetSpecialFolderPath( NULL, lpszPath, CSIDL_FAVORITES, 0 ) )
return; printFolder( lpszPath );
}void printFolder(char* lpszPath)
{
char lpszChildPath[MAX_PATH];
char lpszURLFileName[MAX_PATH];
strcpy( lpszChildPath, lpszPath );
strcat( lpszChildPath, "\\*.*" );
WIN32_FIND_DATA fdata;
HANDLE handle = FindFirstFile( lpszChildPath, &fdata );
if( INVALID_HANDLE_VALUE == handle ) return;
BOOL bNext = TRUE;
while( bNext )
{
sprintf( lpszURLFileName, "%s%s%s", lpszPath, "\\", fdata.cFileName );
if( FILE_ATTRIBUTE_DIRECTORY == fdata.dwFileAttributes )
{
if( strcmp(fdata.cFileName, ".") && strcmp(fdata.cFileName, "..") )
{
TRACE( "%s\n", fdata.cFileName );
printFolder( lpszURLFileName );
TRACE( "\n" );
}
}
else
{
if( NULL != strstr( fdata.cFileName, "url" ) )
{
TRACE( "%s ", fdata.cFileName );
char lpszURL[MAX_PATH];
int cch = MAX_PATH;
GetPrivateProfileString("InternetShortcut", "URL", NULL, lpszURL, cch, lpszURLFileName);
TRACE( "%s\n", lpszURL );
}
}
bNext = FindNextFile( handle, &fdata );
}
}