|
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
|
|
|
|
|
Hey there,
I want to make a MFC app that will capture 6 frames per second from the webcam connected to the PC. And i want to get the frames as imageData, i.e., as bitmap or PNG. The idea is to get these frames/images and then update them live on a web browser, so that it gives a "look and feel" of live video streaming.
I did a sample MFC app that shows webcam stream and then use the capGrabFrame & capFileSaveDIB to save the bmp to disk. This all works fine.
But now rather than saving into disk, i need to get the Image Data, so that i could make changes and update in a browser window.
Also, not sure whether it's possible to get 6 frames per second from the webcam.
Is this possible?
Please guide me with some code.
Thanks in advance.
|
|
|
|
|
It looks like you have gone down the Video For Windows route. You might want to consider stepping up to DirectShow instead. They are both old technologies, but VFW is just too old and annoying to deal with (we were using it on Windows 98).
Whether you will be able to achieve 6 FPS really depends on several factors, primarily if your camera supports that frame rate at your desired resolution.
You should be able to acquire the images as JPEGs or another bitmap format (RGB or YUV), but which formats are available depends completely on your camera.
Take a look at this totally awesome CP article: Realtime Webcam Sudoku Solver[^]
As I recall, it uses Video For Windows, so it should be easy for you to jump into the code and see how to access the image data.
For a DirectShow sample, check out this CP article: Video Preview and Frames Capture to Memory with SampleGrabber in Buffered Mode.[^]
And also browse through his other articles[^], it will not be a waste of your time.
Here are a couple more DirectShow related CP articles:
Simultaneous Previewing & Video Capture using DirectShow[^]
DirectX Video Stream and frame capture[^]
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
my printer is EPSON Stylus Photo R230 Series,IO is usb;
Anyone who has idea on how to retrieve status of printer hopefully can help me find the solution.
code:
HANDLE hPrinter = 0;
DWORD dwNeeded = 0;
PRINTER_INFO_2* pPrinterInfo = (PRINTER_INFO_2 *)malloc(0);
::OpenPrinter("EPSON Stylus Photo R230 Series", &hPrinter, NULL);
if (!::GetPrinter(hPrinter, 2, (LPBYTE)pPrinterInfo, 0, &dwNeeded)){
pPrinterInfo = (PRINTER_INFO_2 *)malloc(dwNeeded);
::GetPrinter(hPrinter, 2, (LPBYTE)pPrinterInfo, dwNeeded, &dwNeeded);
}
::ClosePrinter(hPrinter);
if (pPrinterInfo->Status == PRINTER_STATUS_PAPER_OUT){
free(pPrinterInfo);
return TRUE;
}
else{
free(pPrinterInfo);
return FALSE;
}
|
|
|
|
|