From 5305ddd8332ebd905ebef3b8365fc0d736858a7a Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Mon, 05 Jul 2004 01:53:09 +0000 Subject: initial commit into svn repository git-svn-id: http://svn.klever.net/kin/dipstick/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8 --- (limited to 'URLSource.cpp') diff --git a/URLSource.cpp b/URLSource.cpp new file mode 100644 index 0000000..7c265b7 --- a/dev/null +++ b/URLSource.cpp @@ -0,0 +1,32 @@ +#include "stdafx.h" +#include "URLSource.h" + +#include +#include +#include + +CURLSource::CURLSource(LPCTSTR strURL) +{ +IUniformResourceLocator *lpURL; + if(CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_INPROC_SERVER,IID_IUniformResourceLocator,(LPVOID*)&lpURL)==S_OK){ + ASSERT(lpURL); + lpURL->SetURL(strURL,IURL_SETURL_FL_GUESS_PROTOCOL); + LPDATAOBJECT lpDO = NULL; + VERIFY(lpURL->QueryInterface(IID_IDataObject,(LPVOID*)&lpDO)==S_OK); + COleDataObject odo; + odo.Attach(lpDO,TRUE); + odo.BeginEnumFormats(); + FORMATETC fe; + while(odo.GetNextFormat(&fe)){ + HGLOBAL hg = odo.GetGlobalData(fe.cfFormat,NULL); + if(hg) + CacheGlobalData(fe.cfFormat,hg,NULL); + } + lpURL->Release(); + } +HGLOBAL hg = GlobalAlloc(GHND,strlen(strURL)+1); +LPVOID lpv = GlobalLock(hg); + memmove(lpv,strURL,strlen(strURL)+1); + GlobalUnlock(hg); + CacheGlobalData(CF_TEXT,hg,NULL); +} -- cgit v0.9.0.2