abcd wrote:
> there is no fear but somehow the code is not working and documentation on
> IISMimeMap, IISMimeType looks insufficient.
>
> I am not getting the below code runnning. Its not iterating through with the
> values....I only get type and not the extension.....In VB the values are
> accessed as ArrName[i].Extension and ArrName[i].Type...so simple....
>
> ==>
>
> The code is
>
> VARIANT var;
> VariantInit(&var);
>
>
> hr = LP.pADs->GetEx(L"MimeMap", &var);
>
>
> if ( SUCCEEDED(hr) )
> {
> LONG lstart, lend;
> SAFEARRAY *sa = V_ARRAY( &var );
> VARIANT varItem;
>
> // Get the lower and upper bound.
> hr = SafeArrayGetLBound( sa, 1, &lstart );
> hr = SafeArrayGetUBound( sa, 1, &lend );
>
> // Iterate and print the content.
> VariantInit(&varItem);
>
>
> for ( long idx=lstart; idx <= lend; idx++ )
> {
> hr = SafeArrayGetElement( sa, &idx, &varItem );
>
> _variant_t var1(varItem);
>
> IISMimeType *mt = NULL;
> IUnknown *uk = (IUnknown *) var1;
> HRESULT hr = uk->QueryInterface(IID_IISMimeType, (void **)&mt);
> if(SUCCEEDED(hr))
> {
> BSTR type;
> BSTR extension;
> hr = mt->get_Extension(&extension);
> hr = mt->get_MimeType(&type);
> mt->Release();
> /*SysFreeString(type);
> SysFreeString(extension);*/
> }
>
> VariantClear(&varItem);
> }
>
> VariantClear(&var);
>
> }
>
> Andrey P wrote:
>
>>Sorry, I don't have big experience tricking Visual C++. I usually
>>follow
>>documentation and examples :-)
>>
>>By the way, I don't see anything to be afraid of using SafeArrays ....
>>
>>-Andrey
>>
>>abcd wrote:
>>
>>
>>>for me its a big problem.
>>>
>>>I am reading the MimeMap, VB does the job in one line...In VC++ I
>>>get that
>>>as a SafeArray and I dont know how to read that SafeArray. Not that
>>>simple
>>>for me.
>>>If Safe Array can be avoided then I would like to see some sample.
>>>
>>>I am stucked
>>>
>>>
>>>"Andrey P" <andrey@paramonov.pp.ru> wrote in message
>>>news:10f9bql8kmjmk4e@news.supernews.com...
>>>
>>>
>>>>abcd wrote:
>>>>
>>>>
>>>>
>>>>>Can somebody give me the example of setting MimeTypes in C++. MSDN
>>>>>gives
>>>>>only VB examples. I have not very much experience with SAFEArrays
>>>>>
>>>>>
>>>>
>>>>Well, information on how to manage MIME via ADSI you can find here:
>>>>
>>>>
>>>
>>>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_prog_iaorefimm.asp
>
>>>>and general idea on how to access ADSI via C# you can find here:
>>>>
>>>>
http://support.microsoft.com/default.aspx?scid=KB;EN-US;315716 >>>>
>>>>I don't think translate this examples to MS/VC++ is a very big
>>>>problem :-)
>>>>
>>>>
>>>
>>>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/setting_up_c___for_adsi_development.asp
>
>>>>-Andrey
>
>