|
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;
}
|
|
|
|
|
You can't get the actual status without sending a job to the printer. Only when the printer is accessed by the spooler API, the status is updated. You can't even check if the printer is connected and powered this way because OpenPrinter() and GetPrinter() will succeed and set the generic info fields like name and attributes as long as the printer is known.
|
|
|
|
|
Has idea on how to retrieve status of printer hopefully can help me find the solution?
I know application which can't get the IO status by running on ring3,so the status got is always zero.
|
|
|
|
|
Your code can retrieve the status. You may try to access the printer in some way so that the status is updated. But I have not done that and don't know how to do it.
|
|
|
|
|
Hi there. I am trying to use xxxx.lib file and all of it's xxxx.h files in my project. For the xxxx.h files I have set
Properties -> C/C++ -> General -> Additional Include Directories
and for the xxxx.lib files I have set
Properties -> Linker -> Input -> Additional Dependencies Other than these settings, I haven't done anything. So it says that it can not find certain methods and structures. What setting am I missing? Thanks for anything you share.
|
|
|
|
|
This can't be answered definitively without seeing the error messages. But it seems that you forgot to include the xxxx.h header file.
With VC, you can also add all necessary information to your source files without changing the project settings:
#include "[path_to_h]\xxxx.h"
#pragma comment(lib, "[path_to_lib]\\xxxx")
To avoid full paths, the library files can be copied to a subdirectory of your project directory (e.g. with subdirectory xxxx [path_to_lib] becomes .\\xxxx ).
|
|
|
|
|