main.cpp: In function `BOOL GetShortcutTarget(const TCHAR, TCHAR, SIZE_T)':
main.cpp:23: error: 'struct IShellLinkA' has no member named 'lpVtbl'
main.cpp:26: error: 'struct IPersistFile' has no member named 'lpVtbl'
main.cpp:29: error: 'struct IShellLinkA' has no member named 'lpVtbl'
main.cpp:35: error: 'struct IPersistFile' has no member named 'lpVtbl'
main.cpp:36: error: 'struct IShellLinkA' has no member named 'lpVtbl'
make.exe: *** [main.o] Error 1
Execution terminated
If any one who has prev experience in COM then I guess you need a member called lpVtbl to access all interface methods. If not this then how else can we access it?
-deostroll
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Trying to run a small COM example using the IShellLink interface. Below is the source code and the compile log:
----main.cpp
include <windows.h>
include <objbase.h>
include <objidl.h> / For IPersistFile /
include <shlobj.h> / For IShellLink /
BOOL GetShortcutTarget(LPCTSTR szShortcutFile, LPTSTR szTarget, SIZE_T cchTarget)
{
IShellLink psl = NULL;
IPersistFile ppf = NULL;
BOOL bResult = FALSE;
if !defined(UNICODE)
else
endif
cleanup:
if (ppf) ppf->lpVtbl->Release(ppf);
if (psl) psl->lpVtbl->Release(psl);
if (!bResult && cchTarget != 0) szTarget[0] = TEXT('\0');
return bResult;
}
if 1 / Test code. /
include <stdio.h>
include <tchar.h>
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
TCHAR szTarget[MAX_PATH];
}
endif
----compile log
Compiler: Default compiler
Building Makefile: "D:\Dev-Cpp\My Examples\COMTest\Makefile.win"
Executing make...
make.exe -f "D:\Dev-Cpp\My Examples\COMTest\Makefile.win" all
g++.exe -DDEBUG -c main.cpp -o main.o -I"d:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"d:/Dev-Cpp/include/c++/3.4.2/backward" -I"d:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"d:/Dev-Cpp/include/c++/3.4.2" -I"d:/Dev-Cpp/include" -luuid -lole32 -g3 -O0 -ansi -traditional-cpp -fexceptions -pg -g3 -mwindows
main.cpp: In function `BOOL GetShortcutTarget(const TCHAR, TCHAR, SIZE_T)':
main.cpp:23: error: 'struct IShellLinkA' has no member named 'lpVtbl'
main.cpp:26: error: 'struct IPersistFile' has no member named 'lpVtbl'
main.cpp:29: error: 'struct IShellLinkA' has no member named 'lpVtbl'
main.cpp:35: error: 'struct IPersistFile' has no member named 'lpVtbl'
main.cpp:36: error: 'struct IShellLinkA' has no member named 'lpVtbl'
make.exe: *** [main.o] Error 1
Execution terminated
If any one who has prev experience in COM then I guess you need a member called lpVtbl to access all interface methods. If not this then how else can we access it?
-deostroll