History. How do I get URL?

History. How do I get URL?

Post by Valery Kriga » Fri, 14 Jul 2000 04:00:00



Hi,
I have a PIDL of history object. So how do I get URL?
    SHGetFileInfo returns only page title (it's a caption in IE window)
I write smth like this
   if( SUCCEEDED(hr=cur->BindToObject(il,NULL,IID_IUnknown,(void**)&ism))
to get an IUnknown interface to object (OK). But it fails when I'm trying to
get
IStorage, IStream or ISequentialStream :((
Any ideas?

Thanks in advance

 
 
 

History. How do I get URL?

Post by Strohm Armstron » Fri, 14 Jul 2000 04:00:00


History "objects", as you call them, are nothing more than URL files. Check
out CLSID_InternetShortcut and IUniformResourceLocator.


Quote:> Hi,
> I have a PIDL of history object. So how do I get URL?
>     SHGetFileInfo returns only page title (it's a caption in IE window)
> I write smth like this
>    if( SUCCEEDED(hr=cur->BindToObject(il,NULL,IID_IUnknown,(void**)&ism))
> to get an IUnknown interface to object (OK). But it fails when I'm trying
to
> get
> IStorage, IStream or ISequentialStream :((
> Any ideas?

> Thanks in advance


 
 
 

History. How do I get URL?

Post by Valery Kriga » Fri, 14 Jul 2000 04:00:00



> History "objects", as you call them, are nothing more than URL files.
Check
> out CLSID_InternetShortcut and IUniformResourceLocator.

Thanks for your response!
But, hmm... I've wtitten this test code... it works... and I have only page
title, not URL :(

            hr=
CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_ALL,IID_IUnknown,(void**
)&unk);
            hr= unk->QueryInterface(IID_IShellLink,(void**)&isl);
            hr= isl->SetIDList(pil);
            hr=
unk->QueryInterface(IID_IUniformResourceLocator,(void**)&iurl);
            hr= iurl->GetURL(&url);
            if( url && hr==S_OK )
                ...................

It seams like 'History "objects"', are something more than URL files, *&%&^

 
 
 

History. How do I get URL?

Post by Strohm Armstron » Fri, 14 Jul 2000 04:00:00


Why are you calling SetIDList? You don't want to change the shortcut, you
want to get information out of it. You need to QI for IPersistFile and call
IPersistFile::Load before you can use IUniformResourceLocator or IShellLink.
See KB article Q229092 for more details on this.



> > History "objects", as you call them, are nothing more than URL files.
> Check
> > out CLSID_InternetShortcut and IUniformResourceLocator.

> Thanks for your response!
> But, hmm... I've wtitten this test code... it works... and I have only
page
> title, not URL :(

>             hr=

CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_ALL,IID_IUnknown,(void**
Quote:> )&unk);
>             hr= unk->QueryInterface(IID_IShellLink,(void**)&isl);
>             hr= isl->SetIDList(pil);
>             hr=
> unk->QueryInterface(IID_IUniformResourceLocator,(void**)&iurl);
>             hr= iurl->GetURL(&url);
>             if( url && hr==S_OK )
>                 ...................

> It seams like 'History "objects"', are something more than URL files,
*&%&^

 
 
 

History. How do I get URL?

Post by Valery Kriga » Sat, 15 Jul 2000 04:00:00


Quote:> Why are you calling SetIDList? You don't want to change the shortcut, you
> want to get information out of it. You need to QI for IPersistFile and
call
> IPersistFile::Load before you can use IUniformResourceLocator or
IShellLink.
> See KB article Q229092 for more details on this.

OK, I've read it. This code woks fine:
            hr=
CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_ALL,IID_IUnknown,(void**
)&iunk);
            hr= iunk->QueryInterface(IID_IPersistFile,(void**)&ipf);
            hr= ipf->Load(L"d:\\tmp\\msn.url", STGM_READ);
            hr=
iunk->QueryInterface(IID_IUniformResourceLocator,(void**)&iurl);
            hr= iurl->GetURL(&url); // url==http://www.msn.com; hr==0;
"d:\\tmp\\msn.url"- is a real file.

The problem with history is that I have only PIDL (it's not a real file).
And this code dasn't work:
            hr=
CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_ALL,IID_IUnknown,(void**
)&iunk);
            hr= iunk->QueryInterface(IID_IPersistFile,(void**)&ipf);
            hr= SHGetPathFromIDList(pil,THE_BUFF); // this path is invalid
            MultiByteToWideChar (CP_ACP, 0, THE_BUFF, -1, W_BUFF, MAX_PATH);
            hr= ipf->Load(W_BUFF, STGM_READ);
            hr=
iunk->QueryInterface(IID_IUniformResourceLocator,(void**)&iurl);
            hr= iurl->GetURL(&url); // url==0; hr==1;

Best  regards,

 
 
 

History. How do I get URL?

Post by Strohm Armstron » Sat, 15 Jul 2000 04:00:00


How did you get the PIDL?

 
 
 

History. How do I get URL?

Post by Valery Kriga » Sat, 15 Jul 2000 04:00:00


Quote:> How did you get the PIDL?

OK, I have code like this

    hr= SHGetSpecialFolderLocation(NULL, CSIDL_HISTORY, &pidl);
    hr= SHGetDesktopFolder(&root);
    hr= root->BindToObject(pidl,NULL,IID_IShellFolder,(void**)&cur);
    if( SUCCEEDED(hr) && cur )
    { IEnumIDList       *pL= NULL;
      ULONG             fetched= 0;
      ITEMIDLIST        *il= NULL;
        hr= cur->EnumObjects(NULL,SHCONTF_FOLDERS,&pL);
        while( pL && SUCCEEDED(hr=pL->Next(1,&il,&fetched)) && fetched==1 )
        {   // at this point I have parents absolute PIDL and childrens
relative PIDL
           // I join them and call this function recursively
.........................................
        }
        if(pL)  pL->Release();  pL=NULL;

        hr= cur->EnumObjects(NULL,SHCONTF_NONFOLDERS,&pL);
        while( pL && SUCCEEDED(hr=pL->Next(1,&il,&fetched)) && fetched==1 )
        {  // here I join two PIDLs to get absolute PIDL of history item.

 
 
 

History. How do I get URL?

Post by Valery Kriga » Sat, 15 Jul 2000 04:00:00


Quote:> > How did you get the PIDL?

> OK, I have code like this

>     hr= SHGetSpecialFolderLocation(NULL, CSIDL_HISTORY, &pidl);

       SearchSubFolders(pidl);

void SearchSubFolders(ITEMIDLIST *pidl)
{

Quote:>     hr= SHGetDesktopFolder(&root);
>     hr= root->BindToObject(pidl,NULL,IID_IShellFolder,(void**)&cur);
>     if( SUCCEEDED(hr) && cur )
>     { IEnumIDList       *pL= NULL;
>       ULONG             fetched= 0;
>       ITEMIDLIST        *il= NULL;
>         hr= cur->EnumObjects(NULL,SHCONTF_FOLDERS,&pL);
>         while( pL && SUCCEEDED(hr=pL->Next(1,&il,&fetched)) &&
fetched==1 )
>         {   // at this point I have parents absolute PIDL and childrens
> relative PIDL
>            // I join them and call this function recursively
> .........................................
>         }
>         if(pL)  pL->Release();  pL=NULL;

>         hr= cur->EnumObjects(NULL,SHCONTF_NONFOLDERS,&pL);
>         while( pL && SUCCEEDED(hr=pL->Next(1,&il,&fetched)) &&
fetched==1 )
>         {  // here I join two PIDLs to get absolute PIDL of history item.

.................................
            }

- Show quoted text -

Quote:}

 
 
 

History. How do I get URL?

Post by Strohm Armstron » Sat, 15 Jul 2000 04:00:00


Never mind, I had a brain fart. You kept saying "History" folder and I kept
thinking "Favorites".

To get the information for a History object (they are not files), you need
to use the containing fodler's IShellFolder::GetUIObjectOf with
IID_IShellLink and the PIDL for the item. You can then use QueryInterface
on this IShellLink object to get IUniformResourceLocator.

 
 
 

History. How do I get URL?

Post by Valery Kriga » Sat, 15 Jul 2000 04:00:00


Thanks a lot!
It works.

Quote:> Never mind, I had a brain fart. You kept saying "History" folder and I
kept
> thinking "Favorites".

> To get the information for a History object (they are not files), you need
> to use the containing fodler's IShellFolder::GetUIObjectOf with
> IID_IShellLink and the PIDL for the item. You can then use QueryInterface
> on this IShellLink object to get IUniformResourceLocator.

 
 
 

1. URL-getting to MSN chatroom using a URL

Is there any way to access a chat to a user or a chatroom
using a URL in internet explorer???? or a way of calling
the msn program from IE, like using HTML or PHP or JAVA
or javascript, or any other language, someone please
help!!!!!!, i want AIM and MSNM for my site!!!

2. Linux/SLS under Boot Manager

3. getting a url with perl, the url_get library?

4. Who knows how to make an `ogonek'?

5. vi-history, vi for dos, mks-vi

6. delete, where, and subselects...

7. . dos sed15 URL

8. what *education* is needed.......

9. . emacs 19.34 DOS URL

10. . dos sed15 URL

11. History Channel: History of Robotics

12. seeking history of undo/history palette, etc.