-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlinks.h
60 lines (49 loc) · 1.15 KB
/
links.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#ifndef _LINKS_H_
/*
CLnkFile lnk(filename); // calls IShellLink::Resolve()
if (lnk.isValidLink)
{
if (user wants to open target)
filename = strTarget;
}
or this:
CLnkFile lnk(filename); // doesn't call IShellLink::Resolve()
if (lnk.isValidLink)
{
if (wxFile::Exists(lnk.strTarget))
{
if (user wants to open target)
filename = strTarget;
}
else
{
if (user wants to resolve target)
{
wxString tmpName = lnk.Resolve(hwnd);
if (user wants to open new target)
filename = tmpName;
}
}
}
The question is whether you can call Resolve() to see whether the file exists
as originally intended, without searching other files or directories.
*/
//class IShellLink;
#include <shlobj.h>
//#include <initguid.h>
class CLnkFile
{
public:
CLnkFile(wxString filename);
virtual ~CLnkFile() { Close(); }
HRESULT Resolve(HWND hWnd, DWORD flags); // update strTarget
wxString strTarget, strError;
bool isValidLink;
//bool targetIsFile;
WIN32_FIND_DATA wfd;
protected:
IShellLink *psl;
void Close();
};
#endif // _LINKS_H_