Click here to Skip to main content
15,897,704 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to create new DNS Zone with C/C++? Pin
Matias11-Dec-02 3:20
Matias11-Dec-02 3:20 
QuestionListCtrl: How can i make the last column visible for the user? Pin
whofmans11-Dec-02 2:36
whofmans11-Dec-02 2:36 
AnswerRe: ListCtrl: How can i make the last column visible for the user? Pin
Roger Allen11-Dec-02 2:55
Roger Allen11-Dec-02 2:55 
GeneralIVariantDictionary HELL !!!! Pin
Christian Graus11-Dec-02 0:59
protectorChristian Graus11-Dec-02 0:59 
GeneralRe: IVariantDictionary HELL !!!! Pin
Stephane Rodriguez.11-Dec-02 2:02
Stephane Rodriguez.11-Dec-02 2:02 
GeneralRe: IVariantDictionary HELL !!!! Pin
Christian Graus11-Dec-02 10:05
protectorChristian Graus11-Dec-02 10:05 
GeneralRe: IVariantDictionary HELL !!!! Pin
Stephane Rodriguez.11-Dec-02 10:16
Stephane Rodriguez.11-Dec-02 10:16 
GeneralRe: IVariantDictionary HELL !!!! Pin
Rene De La Garza11-Dec-02 3:37
Rene De La Garza11-Dec-02 3:37 
from "ATL Internals"
Chris Sells does this, on his definition:

<br />
IPrimeNumbers : IDispatch<br />
{<br />
  [propget]<br />
  HRESULT Count([out,retval] long *pCount);<br />
  [propget,id(DISPID_VALUE)]<br />
  HRESULT Item([in] long n, [out,retval] long* pVal);<br />
  [propget, id(DISPID_NEWENUM)]<br />
  HRESULT _NewEnum([out,retval] IUnknown** ppunkEnum);<br />
}<br />
interface IMyEnum : IUnknown<br />
{<br />
[local]<br />
[helpstring("method Next")] HRESULT Next([in] ULONG celt, [out] long* rgelt, [out] ULONG* pceltFetched);<br />
<br />
[call_as(Next)]<br />
[helpstring("method RemoteNext")] HRESULT RemoteNext([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] long* rgelt,[out] ULONG* pceltFetched);<br />
<br />
[helpstring("method Reset")] HRESULT Reset();<br />
[helpstring("method Clone")] HRESULT Clone([out] IMyEnum **ppenum);<br />
[helpstring("method Skip")] HRESULT Skip([in] ULONG celt);<br />
};<br />

that worked for me when i needed to do a for each in vb.

you also need to add this at the end of the idl file, just change IMyEnum with your enum interface:

<br />
// Implement local/call_as for IEnumPrimes<br />
cpp_quote("#ifdef __midl_proxy")<br />
cpp_quote("static HRESULT STDMETHODCALLTYPE")<br />
cpp_quote("IMyEnum_Next_Proxy(IMyEnum* This, ULONG celt, long* rgelt, ULONG* pceltFetched)")<br />
cpp_quote("{")<br />
cpp_quote("  ULONG cFetched;")<br />
cpp_quote("  if( !pceltFetched && celt != 1 ) return E_INVALIDARG;")<br />
cpp_quote("  return IMyEnum_RemoteNext_Proxy(This, celt, rgelt, pceltFetched ? pceltFetched : &cFetched);")<br />
cpp_quote("}")<br />
cpp_quote("")<br />
cpp_quote("static HRESULT STDMETHODCALLTYPE")<br />
cpp_quote("IMyEnum_Next_Stub(IEnumPrimes* This, ULONG celt, long* rgelt, ULONG* pceltFetched)")<br />
cpp_quote("{")<br />
cpp_quote("  HRESULT hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);")<br />
cpp_quote("  if( hr == S_OK && celt == 1 ) *pceltFetched = 1;")<br />
cpp_quote("  return hr;")<br />
cpp_quote("}")<br />
cpp_quote("#endif // __midl_proxy")<br />


hope this can help you.
also this page may help you:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcconImplementingSTLBasedCollection.asp[^]



"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
[^]

GeneralRe: IVariantDictionary HELL !!!! Pin
Daniel Turini11-Dec-02 4:32
Daniel Turini11-Dec-02 4:32 
GeneralScrolling in Listbox Pin
kubbazoob11-Dec-02 0:06
kubbazoob11-Dec-02 0:06 
GeneralRe: Scrolling in Listbox Pin
Joan M11-Dec-02 5:18
professionalJoan M11-Dec-02 5:18 
GeneralRe: Scrolling in Listbox Pin
Alvaro Mendez11-Dec-02 8:43
Alvaro Mendez11-Dec-02 8:43 
QuestionHow to remove a handle HFONT from memory? Pin
Daed11-Dec-02 0:00
Daed11-Dec-02 0:00 
AnswerRe: How to remove a handle HFONT from memory? Pin
Gert Boddaert11-Dec-02 0:25
Gert Boddaert11-Dec-02 0:25 
AnswerRe: How to remove a handle HFONT from memory? Pin
Ted Ferenc11-Dec-02 0:34
Ted Ferenc11-Dec-02 0:34 
AnswerRe: How to remove a handle HFONT from memory? Pin
Daed11-Dec-02 2:58
Daed11-Dec-02 2:58 
GeneralRe: How to remove a handle HFONT from memory? Pin
Ted Ferenc11-Dec-02 5:11
Ted Ferenc11-Dec-02 5:11 
GeneralRe: How to remove a handle HFONT from memory? Pin
Ted Ferenc11-Dec-02 5:13
Ted Ferenc11-Dec-02 5:13 
GeneralRe: How to remove a handle HFONT from memory? Pin
Daed11-Dec-02 6:04
Daed11-Dec-02 6:04 
GeneralRe: How to remove a handle HFONT from memory? Pin
Ted Ferenc11-Dec-02 6:27
Ted Ferenc11-Dec-02 6:27 
GeneralProfiling Tools Pin
Steve Thresher11-Dec-02 0:00
Steve Thresher11-Dec-02 0:00 
GeneralRe: Profiling Tools Pin
Andreas Saurwein11-Dec-02 2:09
Andreas Saurwein11-Dec-02 2:09 
GeneralSocket Program Problem!!! Pin
John Bosko10-Dec-02 23:10
John Bosko10-Dec-02 23:10 
GeneralRe: Socket Program Problem!!! Pin
jhwurmbach10-Dec-02 23:42
jhwurmbach10-Dec-02 23:42 
GeneralRe: Socket Program Problem!!! Pin
John Bosko10-Dec-02 23:44
John Bosko10-Dec-02 23:44 

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.