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) (unidiff)
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 @@
1#include "stdafx.h"
2#include "URLSource.h"
3
4#include <intshcut.h>
5#include <initguid.h>
6#include <isguids.h>
7
8CURLSource::CURLSource(LPCTSTR strURL)
9{
10IUniformResourceLocator *lpURL;
11 if(CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_INPROC_SERVER,IID_IUniformResourceLocator,(LPVOID*)&lpURL)==S_OK){
12 ASSERT(lpURL);
13 lpURL->SetURL(strURL,IURL_SETURL_FL_GUESS_PROTOCOL);
14 LPDATAOBJECT lpDO = NULL;
15 VERIFY(lpURL->QueryInterface(IID_IDataObject,(LPVOID*)&lpDO)==S_OK);
16 COleDataObject odo;
17 odo.Attach(lpDO,TRUE);
18 odo.BeginEnumFormats();
19 FORMATETC fe;
20 while(odo.GetNextFormat(&fe)){
21 HGLOBAL hg = odo.GetGlobalData(fe.cfFormat,NULL);
22 if(hg)
23 CacheGlobalData(fe.cfFormat,hg,NULL);
24 }
25 lpURL->Release();
26 }
27HGLOBAL hg = GlobalAlloc(GHND,strlen(strURL)+1);
28LPVOID lpv = GlobalLock(hg);
29 memmove(lpv,strURL,strlen(strURL)+1);
30 GlobalUnlock(hg);
31 CacheGlobalData(CF_TEXT,hg,NULL);
32}