summaryrefslogtreecommitdiffabout
path: root/URLSource.cpp
authorMichael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
committer Michael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
commit5305ddd8332ebd905ebef3b8365fc0d736858a7a (patch) (side-by-side diff)
treeba6dc874bdcb00bd2e116b377a92f347ab81a733 /URLSource.cpp
downloaddipstick-5305ddd8332ebd905ebef3b8365fc0d736858a7a.zip
dipstick-5305ddd8332ebd905ebef3b8365fc0d736858a7a.tar.gz
dipstick-5305ddd8332ebd905ebef3b8365fc0d736858a7a.tar.bz2
initial commit into svn repository
git-svn-id: http://svn.klever.net/kin/dipstick/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (limited to 'URLSource.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--URLSource.cpp32
1 files changed, 32 insertions, 0 deletions
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 <intshcut.h>
+#include <initguid.h>
+#include <isguids.h>
+
+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);
+}