I have 2 tabs in my program on first tab i have 10 MFCEDitBrowse control
and on second tab I have calculate button when ever
i clicked on calculate button it should called .exe file and input for .exe file is
selected files in mfceditbrowse control on (tab1).
selected files are not fixed it is between 1 to 10.
Please help me out I dont understand how i can give filename(with path) from mfceditbrowse
(dlg1) to .exe file (dlg2)
I don't understand where the problem is. Just create a string with the file names from your browse controls and pass this string as parameters to ShellExecute(). When creating the string, separate the file names by spaces and quote them using double quotes when they contain spaces:
void CMyClass::AppendFileName(CString& str, LPCTSTR lpszFileName) const
bool bMustQuote = _tcschr(lpszFileName, _T(' ')) != NULL;
str += _T(' ');
str += _T('"');
str += lpszFileName;
str += _T('"');
// Get file names from browse controls and append them
strFileName = GetNameFromBrowseControl1();
// Repeat this for all browse controls
// Pass strParameters to ShellExecute()
ShellExecute(NULL, _T("open"), _T("myfile.exe"), strParameters.GetString(), NULL, SW_SHOWNORMAL);
This is not a programming "how to", just looking for short explanation/ verification of usage of "moniker".
My basic understanding is that it's function is similar to DOS path, allowing access to an object.
Now it this particular sequence I do not get the enumeration, followed by getting the first moniker and bind it to , I guess filter.
This is part of my code to get data from USB camera and I am still learning how to put all this COM and DirectShow stuff together.
This is what I understand so far – the enumeration identify the “object class” in my case USB cameras and than I can select which one using the Next in loop ( this snippet gets only the first one) and than let the filter “connect / bind “ to the selected camera.
This is still plain COM code , no DirectShow.
Am I right so far?
Thanks for reading.
TRACE("\nObtain a category enumerator by calling ICreateDevEnum::CreateClassEnumerator with the CLSID of the desired category");
IEnumMoniker* cams = 0;
hr = devs?devs->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &cams, 0) ;
TRACE("\nFailed devs->CreateClassEnumerator (CLSID_VideoInputDeviceCategory");
ASSERT(cams); // redundant
TRACE("\nget first found capture device (webcam?)");
// moniker - similar to DOS path to get info on object
IMoniker* mon = 0;
hr = cams->Next (1,&mon,0); // get first found capture device (webcam?)
TRACE("\nFailed get first found capture device (webcam?)");
I came up with a little puzzle/challenge for C++, so for those interested, my challenge to you is this:
Using any C++ constructs, other than any of the casting constructs*, reimplement the following code:
int i = someIntValue();
int *pint = reinterpret_cast<int*>(i)
Or in words, find a way to reinterpret_cast an integer into a pointer without casting (implicitly, or explicitly!). You may assume that sizeof(int)==sizeof(int*).
I hope to be surprised by answers I hadn't thought of
* with casting constructs, I mean any form of implicit casts (e.g. int to long int), C-style casts (e.g. (int*)i) and C++-style casts (e.g. reinterpet_cast<int*>(i)); and also any functions/macro's/API calls (such as STL implementations) which rely internally on casts.