Click here to Skip to main content
15,891,423 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Event Handling for Dynamically created ListBox Pin
Karthik Kalyanasundaram28-Jun-08 5:58
Karthik Kalyanasundaram28-Jun-08 5:58 
AnswerRe: Event Handling for Dynamically created ListBox Pin
Hamid_RT30-Jun-08 18:56
Hamid_RT30-Jun-08 18:56 
QuestionIncreasing font size of text in static text box Pin
VCProgrammer28-Jun-08 0:29
VCProgrammer28-Jun-08 0:29 
AnswerRe: Increasing font size of text in static text box Pin
leonigah28-Jun-08 2:16
leonigah28-Jun-08 2:16 
AnswerRe: Increasing font size of text in static text box Pin
Ștefan-Mihai MOGA28-Jun-08 3:36
professionalȘtefan-Mihai MOGA28-Jun-08 3:36 
AnswerRe: Increasing font size of text in static text box [modified] Pin
Karthik Kalyanasundaram28-Jun-08 6:04
Karthik Kalyanasundaram28-Jun-08 6:04 
AnswerRe: Increasing font size of text in static text box Pin
Hamid_RT30-Jun-08 18:54
Hamid_RT30-Jun-08 18:54 
Questionhow to return variable to VB.NET Pin
boyindie27-Jun-08 23:18
boyindie27-Jun-08 23:18 
Hi
I have been writing this piece of code which will search for all the possible video capture devices on the machine using the Windows DirectShow API.

But no matter what I do I can't get this block of code to return the list of devices in a suitable format back to my VB.NET code.

I keep getting the error pInvoke Restriction:Can't return a variant.

Is there away to convert possibly the variant to a char array, and return the array back to the vb.NET GUI?

The code I have is as follows :

extern "C" __declspec(dllexport) VARIANT __cdecl getDevice()
{
	// Create the System Device Enumerator.
    hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
    CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, 
    reinterpret_cast<void**>(&pDevEnum));

	if (SUCCEEDED(hr))
	{
		// Create an enumerator for the video capture category.
		hr = pDevEnum->CreateClassEnumerator(
			CLSID_VideoInputDeviceCategory,
			&pEnum, 0);
	}

	while (pEnum->Next(1, &pMoniker, NULL) == S_OK)
	{
		IPropertyBag *pPropBag;
		hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, 
			(void**)(&pPropBag));
		if (FAILED(hr))
		{
			pMoniker->Release();
			continue;  // Skip this one, maybe the next one will work.
		} 
		// Find the description or friendly name.
		extern VARIANT varName;
		VariantInit(&varName);
		hr = pPropBag->Read(L"FriendlyName", &varName, 0);

		pPropBag->Release();
		pMoniker->Release();
	}
	return varName;
}


Any feedback would be greatly appreciated

Cheers
Boyindie
QuestionHow to create "Bitmap Font " using Pixel Data. Pin
phanindra varma27-Jun-08 23:12
phanindra varma27-Jun-08 23:12 
AnswerRe: How to create "Bitmap Font " using Pixel Data. Pin
Hamid_RT30-Jun-08 18:51
Hamid_RT30-Jun-08 18:51 
QuestionProfiling in Visual Studio Pin
AndreFratelli27-Jun-08 22:48
AndreFratelli27-Jun-08 22:48 
AnswerRe: Profiling in Visual Studio Pin
Hamid_RT30-Jun-08 18:47
Hamid_RT30-Jun-08 18:47 
GeneralRe: Profiling in Visual Studio Pin
AndreFratelli14-Jul-08 10:10
AndreFratelli14-Jul-08 10:10 
Questionsql server using ODBC in a MFC application Pin
jiangbing27-Jun-08 21:41
jiangbing27-Jun-08 21:41 
AnswerRe: sql server using ODBC in a MFC application Pin
Ștefan-Mihai MOGA28-Jun-08 3:42
professionalȘtefan-Mihai MOGA28-Jun-08 3:42 
GeneralRe: sql server using ODBC in a MFC application Pin
jiangbing28-Jun-08 16:10
jiangbing28-Jun-08 16:10 
AnswerRe: sql server using ODBC in a MFC application Pin
Mark Salsbery28-Jun-08 7:56
Mark Salsbery28-Jun-08 7:56 
AnswerRe: sql server using ODBC in a MFC application Pin
Hamid_RT30-Jun-08 18:47
Hamid_RT30-Jun-08 18:47 
QuestionHelp with getting a spawned process's return value Pin
XKonSoftware27-Jun-08 21:26
XKonSoftware27-Jun-08 21:26 
AnswerRe: Help with getting a spawned process's return value Pin
CPallini27-Jun-08 21:53
mveCPallini27-Jun-08 21:53 
GeneralRe: Help with getting a spawned process's return value Pin
MANISH RASTOGI27-Jun-08 22:54
MANISH RASTOGI27-Jun-08 22:54 
GeneralRe: Help with getting a spawned process's return value Pin
CPallini28-Jun-08 2:24
mveCPallini28-Jun-08 2:24 
GeneralRe: Help with getting a spawned process's return value Pin
MANISH RASTOGI28-Jun-08 2:35
MANISH RASTOGI28-Jun-08 2:35 
QuestionReceive messages in dialog based application through socket Pin
Mushtaque Nizamani27-Jun-08 20:50
Mushtaque Nizamani27-Jun-08 20:50 
QuestionCompare two strings Pin
manju#12327-Jun-08 20:49
manju#12327-Jun-08 20:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.