|
From: Harish Kumar Dixit on 30 Apr 2008 08:03 Hello friends, I have one API of IWMHeaderInfo3 interface. That API takes (BYTE* pT) as one of the output parameter and returns some value in this parameter. But for a one special case the value of this parameter set to blank. API: virtual HRESULT STDMETHODCALLTYPE GetAttributeByIndexEx( /* [in] */ WORD wStreamNum, /* [in] */ WORD wIndex, /* [size_is][out] */ LPWSTR pwszName, /* [out][in] */ WORD *pwNameLen, /* [out] */ WMT_ATTR_DATATYPE *pType, /* [out] */ WORD *pwLangIndex, /* [size_is][out] */ BYTE *pValue, /* [out][in] */ DWORD *pdwDataLength) = 0; When i seen in the memory location pointed by pT variable the value is " J]jZ;(1 )ì±Qaqe>M". first chracter is space(32). Since in memory window i can see this value. But why the API is setting this variable to blank. Thanks on advance.
From: Joseph M. Newcomer on 30 Apr 2008 08:54 See below... On Wed, 30 Apr 2008 05:03:28 -0700 (PDT), Harish Kumar Dixit <harishdixit1(a)gmail.com> wrote: >Hello friends, > > >I have one API of IWMHeaderInfo3 interface. That API takes (BYTE* pT) >as one of the output parameter and returns some value in this >parameter. But for a one special case the value of this parameter set >to blank. > >API: > >virtual HRESULT STDMETHODCALLTYPE GetAttributeByIndexEx( > /* [in] */ WORD wStreamNum, > /* [in] */ WORD wIndex, > /* [size_is][out] */ LPWSTR pwszName, > /* [out][in] */ WORD *pwNameLen, > /* [out] */ WMT_ATTR_DATATYPE *pType, > /* [out] */ WORD *pwLangIndex, > /* [size_is][out] */ BYTE *pValue, > /* [out][in] */ DWORD *pdwDataLength) = 0; > > >When i seen in the memory location pointed by pT variable the value is >" J]jZ;�(1 )�Qaqe>M". >first chracter is space(32). **** I don't see a pT anywhere in the above list. You mentioned a (BYTE * pT) as a single parameter, then you show an API that takes 8 parameters; do you mean that you are calling this as GetAttributeByIndexEx(stream, index, name, &len, type, lang, pT, &dlen) or something like that? How do we correlate the first paragraph of your question with the API you show? Given that its a BYTE*, why do you think the first character is a space, when it is probably an integer in the range 0..255, and it happens to be 32? Why do you think these are characters? I looked at this API, and it does not suggest that the output is a character string. It explicitly states that it is a sequence of unsigned 8-bit numeric values. **** > >Since in memory window i can see this value. But why the API is >setting this variable to blank. **** Repeat above question: why do you think it makes sense to interpret these values as if they are characters? You did not specify what attribute you are attempting to retrieve, for example, and as far as I can tell from reading the list of attributes, the format of what you get back varies with the type of the attribute. You have shown no code at all. How are we supposed to answer this question, given there is no information we can use to determine what you are doing? joe **** > >Thanks on advance. Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Giovanni Dicanio on 30 Apr 2008 10:28 Please show some code that you are having problem with. As Joe wrote, your question is not very clear... Thanks, Giovanni "Harish Kumar Dixit" <harishdixit1(a)gmail.com> ha scritto nel messaggio news:3fd1987b-0fab-4a49-885f-765ac385d6d3(a)u36g2000prf.googlegroups.com... Hello friends, I have one API of IWMHeaderInfo3 interface. That API takes (BYTE* pT) as one of the output parameter and returns some value in this parameter. But for a one special case the value of this parameter set to blank. API: virtual HRESULT STDMETHODCALLTYPE GetAttributeByIndexEx( /* [in] */ WORD wStreamNum, /* [in] */ WORD wIndex, /* [size_is][out] */ LPWSTR pwszName, /* [out][in] */ WORD *pwNameLen, /* [out] */ WMT_ATTR_DATATYPE *pType, /* [out] */ WORD *pwLangIndex, /* [size_is][out] */ BYTE *pValue, /* [out][in] */ DWORD *pdwDataLength) = 0; When i seen in the memory location pointed by pT variable the value is " J]jZ;z(1 )�Qaqe>M". first chracter is space(32). Since in memory window i can see this value. But why the API is setting this variable to blank. Thanks on advance.
From: Giovanni Dicanio on 30 Apr 2008 18:23 "Harish Kumar Dixit" <harishdixit1(a)gmail.com> ha scritto nel messaggio news:3fd1987b-0fab-4a49-885f-765ac385d6d3(a)u36g2000prf.googlegroups.com... > Hello friends, > I have one API of IWMHeaderInfo3 interface. That API takes (BYTE* pT) [...] I read that you posted the same message on the ATL group (microsoft.public.vc.atl). I answered you there about using a wchar_t-based string (Unicode UTF-16 string). BTW: I don't know what the correct rules are... but I think that you should cross post on both newsgroups the same post, instead of doing separate posts ("multipost"). (Please correct me if I'm wrong about that...) Giovanni
From: Giovanni Dicanio on 30 Apr 2008 18:28 "Giovanni Dicanio" <giovanni.dicanio(a)invalid.com> ha scritto nel messaggio news:OaAdXBxqIHA.3940(a)TK2MSFTNGP03.phx.gbl... > I think that your problem is that you are trying to using char * or > CStringA or std::string to "handle" strings, instead the strings used by > the aforementioned API are *Unicode* (UTF-16) strings, so you should use a > wchar_t-based string, e.g. wchar_t *, or CStringW, or std::wstring. To be more explicit, if the buffer storing the result is 'BYTE * pValue' and it contains a Unicode UTF-16 string, you may use code like this: <code> // // Reinterpret BYTE pointer as // pointer to a UTF-16 string buffer // const wchar_t * wsz = reinterpret_cast< const wchar_t * >( pValue ); // // Store the string in a "safe" place, like // a robust string class ... // CStringW str( wsz ); // ... manage 'str' instance </code> HTH, Giovanni PS: I added also MFC newsgroup, because the post started there too (I don't know what the rules of these newsgroups are... is multipost allowed? Is cross-post allowed? ...Thanks...)
|
Next
|
Last
Pages: 1 2 3 4 Prev: VC6 (was Re: C++0x (was: passing vector as argument)) Next: MenuBar like VS IDE |