|
<pre><pre lang="text">
I can specify relative path from current directory using “Additional include directories “ to a directory on same level and it compiles. Same method works when “going up” in directory tree.
Additional include directories ( for compiler )
.\TESTLib
#include "..\_TEST.h"
#include "..\StdAfx.h"
Now how do I specify the path to a subdirectory?
My directory “Modules” is on same level as project directory and “DIrectShow 8.1 SDK” is its
subdirectory.
This does not work, obviously I am missing something.
Additional include directories
.\Modules\DIrectShow 8.1 SDK
#include "..\Modules\DIrectShow 8.1 SDK\_TEST_B.h"
Any help or reference source / sample would be greatly appreciated.
Cheers Vaclav </pre></pre>
|
|
|
|
|
Ive always avoided specifying '3rd party' SDK's like that
What I usually do, is set a System Environment Variable with the path to the SDK eg DIRECTSHOW -> {whatever}\Modules\DirectShow 8.1 SDK\ , then use $(DIRECTSHOW)\_TEST_B.h in the compiler/link options
The reason or this is, if I then need to change the version of DirectShow, I can do that without frigging around with the project (I just change the environment variable)
Im sorry that this doesn't actually answer your question
|
|
|
|
|
Maybe this will work?
#include "Modules\DIrectShow 8.1 SDK\_TEST_B.h"
|
|
|
|
|
Yes, that works, I used it for test, but I need to specify common path for the rest of the includes. That is why it is in " Addtional include " settings.
The "problem " is I do not know how to access directories not in direct "up" path from the main (project) directory.
And to be honest, I kinda forgot how to do "system" variables. I guess I need to brush up on DOS.
|
|
|
|
|
You can specify the parent of a parent directory like so: ..\..\Parent\SubDir
You can put as many ..\ together as you need to back up to the common parent directory.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Additional include directories
.\Modules\DIrectShow 8.1 SDK
#include "..\Modules\DIrectShow 8.1 SDK\_TEST_B.h"
Do you see why that makes no sense? You have told the compiler to look in .\Modules\DIrectShow 8.1 SDK , that is to say, two subdirectories below the current one. You then give a different path in your #include statement, which says that the Modules directory is a sibling of the current one. If you add the paths in your project settings then you don't need to add them in your #include statements.
Veni, vidi, abiit domum
|
|
|
|
|
I do not think I was very clear in my post.
What I need is to build a common "include path".
I need to tell the compiler how to get from this full directory path:
D:\0\00 Video\Library\StaticLibrary\WebCam - from project WebCam
to streams.h file in this full directory path:
D:\0\00 Video\SDK\DIrectShow 8.1 SDK\samples\Multimedia\DirectShow\BaseClasses\streams.h
I need this path because there are other includes in streams.h
In my foolish way of thinking - I need to go up two levels to common 00 Video directory and than down 5 levels. I relatively know how to "go down ..\" but have no clue how to "go up".
Is that even possible?
|
|
|
|
|
Hi,
Vaclav_Sal wrote: What I need is to build a common "include path".
If you take advantage of the Macros for Build Commands and Properties[^]; based on your two paths I think you would this to your 'Additional Include Directories' :
$(ProjectDir)\..\..\..\SDK\DirectShow 8.1 SDK\samples\Multimedia\DirectShow\BaseClasses\
Note that $(SolutionDir) is the path to the solution file (*.SLN) and $(ProjectDir) is the path to the project file (*.vcproj || *.vcxproj)
Best Wishes,
-David Delaune
|
|
|
|
|
David,
I have been looking at compiler "include option - /I ".
There is something about putting a "base" directory in the option string. Pretty much in same line of though as you suggested. I'll play with that.
Richard,
as far as putting the absolute path in this option string there is a minor but important issue in reusing the project as a "module" in another, main , project.
Right now I finally got my main project working and it consists of several such modules. I prefer to build the module separately, it is less confusing.
Appreciate you taking time to help me.
|
|
|
|
|
You seem to be making things more difficult for yourself than necessary. Using relative paths in situations like this can cause problems if any part of the path gets moved or renamed. Just add the full absolute paths of all required directories into your project's properties file and then you don't need to specify any part of them in your #include directives. So in this case add both of the following to your project:
D:\0\00 Video\Library\StaticLibrary\WebCam
D:\0\00 Video\SDK\DIrectShow 8.1 SDK\samples\Multimedia\DirectShow\BaseClasses
Veni, vidi, abiit domum
|
|
|
|
|
I have changed my directory structure and separated the common "applications" from the project.
That way each project can access the common application, likes SDK for example, using direct path.
Thanks for all suggestions, it helped to reinforce the KISS motto.
|
|
|
|
|
I am a starter to UI Automation and I see there is no good example or document to read about UI Automation in C++.Any one please help me with some code snippnets to start wrkng with UI Automation in "C++"
Thanks in Advance.
Regards,
Amrut
|
|
|
|
|
|
|
hi help me to open ppt file using automation.
this working well for excel and word files but ppt files are not open from this.
can u please correct me where I m wrong
ifstream in_fp;
DISPPARAMS dpNoArgs = {NULL, NULL, 0, 0};
VARIANT vResult; OLECHAR FAR* szFunction;
IDispatch* pDispApp;
IDispatch* pDispXlBooks;
DISPID dispid_Books; DISPID dispid_Quit;
BSTR bstrFileName = ::SysAllocString(OLESTR("filename"));
BSTR bstrPassWord = ::SysAllocString(OLESTR("pass"));
CString error_str=_T("");
in_fp.open(file_name, ios::in);
if (!in_fp || file_name.GetLength() > MAX_PATH)
{
error_str.Format(_T("error loading %s\n"), file_name);
AfxMessageBox(error_str);
return ;
}
string ss = string(CT2CA(file_name));
const char *szFileName = ss.c_str();
wchar_t wszFileName[MAX_PATH+1];
MultiByteToWideChar(CP_ACP, 0, szFileName, strlen(szFileName)+1,
wszFileName, sizeof(wszFileName)/sizeof(wszFileName[0]));
bstrFileName = ::SysAllocString(wszFileName);
::CoInitialize(NULL);
CLSID clsid;
CLSIDFromProgID(L"Powerpoint.Application", &clsid);
IUnknown* pUnk;
HRESULT hr = ::CoCreateInstance( clsid, NULL,
CLSCTX_SERVER, IID_IUnknown, (void**) &pUnk);
hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDispApp);
szFunction = OLESTR("Presentations");
hr = pDispApp->GetIDsOfNames (IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_Books);
hr = pDispApp->Invoke (dispid_Books, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
&dpNoArgs, &vResult, NULL, NULL);
pDispXlBooks = vResult.pdispVal;
DISPID dispid_Open;
VARIANT vArgsOpen[5];
DISPPARAMS dpOpen;
dpOpen.cArgs = 5;
dpOpen.cNamedArgs = 0;
dpOpen.rgvarg = vArgsOpen;
wchar_t wszPassWord[MAX_PATH];
ss = string(CT2CA(Password));
const char *pwd_entry = ss.c_str();
MultiByteToWideChar(CP_ACP, 0, pwd_entry, -1,
wszPassWord, sizeof(wszPassWord)/sizeof(wszPassWord[0]));
bstrPassWord = ::SysAllocString(wszPassWord);
vArgsOpen[4].vt = VT_BSTR;
vArgsOpen[4].bstrVal = bstrFileName; vArgsOpen[3].vt = VT_ERROR;
vArgsOpen[3].scode = DISP_E_PARAMNOTFOUND; vArgsOpen[2].vt = VT_BOOL;
vArgsOpen[2].scode = TRUE; vArgsOpen[1].vt = VT_ERROR;
vArgsOpen[1].scode = DISP_E_PARAMNOTFOUND; vArgsOpen[0].vt = VT_BSTR;
vArgsOpen[0].bstrVal = bstrPassWord;
szFunction = OLESTR("Open");
hr = pDispXlBooks->GetIDsOfNames(IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_Open);
hr = pDispXlBooks->Invoke(dispid_Open, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dpOpen, NULL, NULL, NULL);
if (!FAILED(hr))
{
}
else
{
}
szFunction = OLESTR("Quit");
hr = pDispApp->GetIDsOfNames(IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_Quit);
hr = pDispApp->Invoke (dispid_Quit, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dpNoArgs, NULL, NULL, NULL);
::SysFreeString(bstrFileName);
::SysFreeString(bstrPassWord);
pDispXlBooks->Release();
pDispApp->Release();
pUnk->Release();
::CoUninitialize();
its return error "invalid number of parameters"
please help me thanks in advance.
modified 31-Jan-14 7:41am.
|
|
|
|
|
You should check the HRESULT return value of each function call and break execution upon failure. Then you know which call fails first and you can check the passed parameters.
|
|
|
|
|
its fail when I m trying to "open"
and same this working fine for word and excel files.
|
|
|
|
|
I have not use OLE automation with PowerPoint so far. But the errorQuote: "invalid number of parameters" indicates that the PowerPoint Open() method has other parameters than Excel or Word.
See https://support.microsoft.com/kb/222758/en-us[^] for the Presentations.Open() method.
|
|
|
|
|
please help me or ole automation with powerpoint...
|
|
|
|
|
|
so there is no option to open password protected PPT files in automation?
|
|
|
|
|
Sorry, I don't know. You will need to check the documentation details.
|
|
|
|
|
|
Need to dynamically create a matrix of strings in VC++. Did it in a class fifteen years ago. Now I don't seem to be able to make it work. Hope to produce a simple template class as I once did. I've lost alot of traction in C++ since that grad.class. Thanks in advance for any guidance.
|
|
|
|
|
Well it depends on your definition of a matrix of strings. Do you mean a 2-dimensional array of string ponters or something more complex?
Veni, vidi, abiit domum
|
|
|
|
|