|
Customer told me he has tried the form of "domain\username", but failed.
Has anyone tried this scenario and got any successful achievements?
Thank you for your help, I'll ask customer try the form of "username@domain".
Chairman
|
|
|
|
|
when searching Temporary Internet Files folder why does it only show
. dir
.. dir
content.ie5 dir and
desktop.ini file after that it dont show anything and i know there is over 1200 items in that folder. how do i get it to list the files?
|
|
|
|
|
I'd guess because they're virtual folders. If this is the case you'll be able to see the contents with explorer but not the command prompt; give it a try and see if this is the case. You may have to use the shell interfaces such as IShellFolder to enumerate the contents.
Steve
|
|
|
|
|
|
Hi,
Definetly I agree with Stephen and WhiteSky - you can use API from Wininet:
FindFirstUrlCacheEntry
FindNextUrlCacheEntry
FindCloseUrlCache
-----------
Mila
|
|
|
|
|
Do you have Windows Explorer configured to not show contents of system folders?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i have it set to show all.
|
|
|
|
|
Here's some code which shows how to use the shell interfaces to enumerate the contents of a folder, in this case the Desktop. Note that "My Computer" and the like appears but wouldn't if you used FindFirstFile and company. It's a console app using ATL smart pointers. I edited the "StdAfx.h" to just include <iostream>
and <atlbase.h>.
--------------------------------------------------------------------------------
// VDir.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <shlobj.h>
#include <shlwapi.h>
#pragma comment(lib, "shlwapi.lib")
void Go()
{
using namespace std;
HRESULT hr;
CComPtr<IMalloc> spAlloc;
hr = SHGetMalloc(&spAlloc);
if (FAILED(hr))
{
cerr << "SHGetMalloc failed!" << endl;
return;
}
CComPtr<IShellFolder> spDesktop;
hr = SHGetDesktopFolder(&spDesktop);
if (FAILED(hr))
{
cerr << "SHGetDesktopFolder failed!" << endl;
return;
}
CComPtr<IEnumIDList> spEnum;
hr = spDesktop->EnumObjects(
NULL,
SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN,
&spEnum
);
if (FAILED(hr))
{
cerr << "IShellFolder::EnumObjects failed!" << endl;
return;
}
LPITEMIDLIST pPIDL;
while ( (hr=spEnum->Next(1, &pPIDL, NULL))==S_OK )
{
STRRET Name;
hr = spDesktop->GetDisplayNameOf(pPIDL, SHGDN_NORMAL, &Name);
if (SUCCEEDED(hr))
{
LPWSTR pDisplayName;
hr = StrRetToStrW(&Name, pPIDL, &pDisplayName);
if (SUCCEEDED(hr))
{
USES_CONVERSION;
cout << W2CA(pDisplayName) << endl;
spAlloc->Free(pDisplayName);
}
}
spAlloc->Free(pPIDL);
}
}
int main(int argc, char* argv[])
{
OleInitialize(NULL);
Go();
OleUninitialize();
return 0;
}
Steve
|
|
|
|
|
F:\projects\fry\fry.cpp(52) : error C2065: 'StrRetToStrW' : undeclared identifier
Error executing cl.exe.
i get just that 1 error i cant find that term anywhere but i found a StrRetToStrN in the platform sdk it may be that i dont have a path included that i should i dont know this is a little beyond what i know how to do.
but i do thank you for taking the time to code it so i can understand it a little more
|
|
|
|
|
Include <Shlwapi.h> and link to Shlwapi.lib . I notice that it's not in the SDK that comes with MSVC6 so if you're using this compiler you'll have to get a newer SDK (you should use the latest version anyway).
Steve
|
|
|
|
|
i have the newest sdk and it still has the error even looking in shlwapi.h it cant find StrRetToStrW. the console part makes it hard for me to understand im making a MFC dialog.
|
|
|
|
|
In the February 2003 SDK it’s on line 152.
Steve
|
|
|
|
|
i still get the error what file are you looking on to see it on line 152?
|
|
|
|
|
Shlwapi.h line 152.
Steve
|
|
|
|
|
ok i got it working but like i said this is over my head im trying to get it to show the folder i want but i havent figured out what part to change yet to get it right
|
|
|
|
|
Ok, here a crude implementation of the "Dir" DOS command which uses the shell instead of the file APIs:
--------------------------------------------------
// VDir.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <shlobj.h>
#include <shlwapi.h>
#pragma comment(lib, "shlwapi.lib")
void Go(LPCTSTR pFolder)
{
using namespace std;
USES_CONVERSION;
HRESULT hr;
CComPtr<IMalloc> spAlloc;
hr = SHGetMalloc(&spAlloc);
if (FAILED(hr))
{
cerr << "SHGetMalloc failed!" << endl;
return;
}
CComPtr<IShellFolder> spDesktop;
hr = SHGetDesktopFolder(&spDesktop);
if (FAILED(hr))
{
cerr << "SHGetDesktopFolder failed!" << endl;
return;
}
LPITEMIDLIST pFolderPIDL;
hr = spDesktop->ParseDisplayName(
NULL,
NULL,
T2OLE(pFolder),
NULL,
&pFolderPIDL,
NULL
);
if (FAILED(hr))
{
cerr << "IShellFolder::ParseDisplayName failed!" << endl;
return;
}
CComPtr<IShellFolder> spFolder;
hr = spDesktop->BindToObject(
pFolderPIDL,
NULL,
IID_IShellFolder,
reinterpret_cast<void**>(&spFolder)
);
spAlloc->Free(pFolderPIDL);
if (FAILED(hr))
{
cerr << "IShellFolder::BindToObject failed!" << endl;
return;
}
CComPtr<IEnumIDList> spEnum;
hr = spFolder->EnumObjects(
NULL,
SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN,
&spEnum
);
if (FAILED(hr))
{
cerr << "IShellFolder::EnumObjects failed!" << endl;
return;
}
LPITEMIDLIST pPIDL;
while ( (hr=spEnum->Next(1, &pPIDL, NULL))==S_OK )
{
STRRET Name;
hr = spFolder->GetDisplayNameOf(pPIDL, SHGDN_NORMAL, &Name);
if (SUCCEEDED(hr))
{
LPWSTR pDisplayName;
hr = StrRetToStrW(&Name, pPIDL, &pDisplayName);
if (SUCCEEDED(hr))
{
cout << W2CA(pDisplayName) << endl;
spAlloc->Free(pDisplayName);
}
}
spAlloc->Free(pPIDL);
}
}
int main(int argc, char* argv[])
{
using namespace std;
if (argc<2)
{
cerr << "No directory specified!" << endl;
return 1;
}
OleInitialize(NULL);
Go(argv[1]);
OleUninitialize();
return 0;
}
Steve
|
|
|
|
|
do you have msn or yahoo if so add me or this thread will be a mile long msn: fruitloop45@hotmail.com
yahoo: fruitloop455
|
|
|
|
|
Doesn't matter if the thread gets long. If MSN or some other messaging service is used then other people can't get any benefit from the thread.
Steve
|
|
|
|
|
ok. i took the first one you posted and stuck it in a dialog only changed the cout lines to be MessageBox changed
CComPtr<IShellFolder> spDesktop;<br />
hr = SHGetSpecialFolderPath(m_hWnd , buff, CSIDL_INTERNET_CACHE, 0);
that line to be the folder i want and changed
if (SUCCEEDED(hr))<br />
{<br />
USES_CONVERSION;<br />
file.Format("%s", W2CA(pDisplayName));<br />
m_list.InsertItem(index, file);<br />
spAlloc->Free(pDisplayName);<br />
index++;<br />
}
get a debug assertion in altbase.h line 474 Expression: p!=0
hr = spDesktop->EnumObjects(<br />
NULL,<br />
SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN,<br />
&spEnum<br />
);
has to be in there i have a MessageBox befor and after it first one works
|
|
|
|
|
That's because spDesktop is NULL but you're trying to call a method through it. You commented out the line which sets spDesktop .
Steve
|
|
|
|
|
Try this. The only changes are in 'main':
Also, you should look into 'FindFirstUrlCacheEntry' for an alternative (and perhaps easier) solution.
-----------------------------------------
// VDir.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <shlobj.h>
#include <shlwapi.h>
#pragma comment(lib, "shlwapi.lib")
void Go(LPCTSTR pFolder)
{
using namespace std;
USES_CONVERSION;
HRESULT hr;
CComPtr<IMalloc> spAlloc;
hr = SHGetMalloc(&spAlloc);
if (FAILED(hr))
{
cerr << "SHGetMalloc failed!" << endl;
return;
}
CComPtr<IShellFolder> spDesktop;
hr = SHGetDesktopFolder(&spDesktop);
if (FAILED(hr))
{
cerr << "SHGetDesktopFolder failed!" << endl;
return;
}
LPITEMIDLIST pFolderPIDL;
hr = spDesktop->ParseDisplayName(
NULL,
NULL,
T2OLE(pFolder),
NULL,
&pFolderPIDL,
NULL
);
if (FAILED(hr))
{
cerr << "IShellFolder::ParseDisplayName failed!" << endl;
return;
}
CComPtr<IShellFolder> spFolder;
hr = spDesktop->BindToObject(
pFolderPIDL,
NULL,
IID_IShellFolder,
reinterpret_cast<void**>(&spFolder)
);
spAlloc->Free(pFolderPIDL);
if (FAILED(hr))
{
cerr << "IShellFolder::BindToObject failed!" << endl;
return;
}
CComPtr<IEnumIDList> spEnum;
hr = spFolder->EnumObjects(
NULL,
SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN,
&spEnum
);
if (FAILED(hr))
{
cerr << "IShellFolder::EnumObjects failed!" << endl;
return;
}
LPITEMIDLIST pPIDL;
while ( (hr=spEnum->Next(1, &pPIDL, NULL))==S_OK )
{
STRRET Name;
hr = spFolder->GetDisplayNameOf(pPIDL, SHGDN_NORMAL, &Name);
if (SUCCEEDED(hr))
{
LPWSTR pDisplayName;
hr = StrRetToStrW(&Name, pPIDL, &pDisplayName);
if (SUCCEEDED(hr))
{
cout << W2CA(pDisplayName) << endl;
spAlloc->Free(pDisplayName);
}
}
spAlloc->Free(pPIDL);
}
}
int main(int argc, char* argv[])
{
using namespace std;
OleInitialize(NULL);
char cache[MAX_PATH];
HRESULT hr = SHGetSpecialFolderPath(NULL, cache, CSIDL_INTERNET_CACHE, 0);
if (FAILED(hr))
{
cerr << "SHGetSpecialFolderPath failed!" << endl;
return 1;
}
Go(cache);
OleUninitialize();
return 0;
}
Steve
|
|
|
|
|
Who can tell me how to get the total pages of excel when using Office Automation in VC++?
_Application excel;
Workbooks books;
_Workbook book;
Sheets sheets;
_Worksheet worksheet;
How can I get page for each sheet?
Thank for your reply.
|
|
|
|
|
_Worksheet worksheet;
Worksheets wssMysheets;
.
.
.
.
LONG mTotal = wssMysheets.GetCount();
LONG mPage =wsMysheet.GetIndex();
freeman
|
|
|
|
|
Sorry, I have made a mistake!
_Worksheet worksheet;
Worksheets wssMysheets;
.
.
.
.
LONG mTotal = wssMysheets.GetCount();
LONG mPage = worksheet.GetIndex();
-- modified at 23:14 Wednesday 25th October, 2006
freeman
|
|
|
|
|
Thank freeman for your replay.
Sorry I do not state very clear about my excel page.
I need to know how many pages if one excel printed.
So the pages should be printed pages.
I know how to calculate the word pages now. But it is not the same as Excel.
If I use VBA, I can use the following word to get it.
pages=(sheet.hpagebreaks.count+1)*(sheet.vpagebreaks.count+1)
or
pages=Workbook.Excel4MacroSheets(50)
|
|
|
|