|
Ummm - how about a simple object that encapsulates and inherits from a single 'IDispEventSimpleImpl<1, class-name, &__uuidof(Outlook::ItemEvents)> ', then have a collection of those, one for each object whose events you want to handle?
Can't think of a better way off the top of my head.
|
|
|
|
|
ah, sure... thanks. i guess i was just blind
|
|
|
|
|
Hi all
I have to copy elements of a std::vector at the end of a second std::vector.
What is the most efficient approach?
I think that method insert is not very efficient (am I right?);
what if I use copy in <algorithm>? If also this is not good,
what way can I follow?
Kind Regards
ManuStone
|
|
|
|
|
Does
insert(vec2.end(), vec1.begin(), vec1.end());
work?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
manustone wrote: I think that method insert is not very efficient (am I right?);
what if I use copy in ?
Do you mean the copy constructor? I think performance is quite comparable to insertion method (as suggested by Steve Echols), but why don't you make a test?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
(Sorry for the delay)
Thank you very much for your response!
ManuStone
|
|
|
|
|
std::vector<t> vec1;<br />
std::vector<t> vec2;<br />
<br />
std::copy(vec1.begin(), vec1.end(), std::back_inserter(vec2));</t></t>
Pax Domini sit semper vobiscum
|
|
|
|
|
hi guys,
i m new to atl programming, i creating toolbar on rebar in which i add TBBUTTON with TBSTYLE_DROPDOWN , for button with seprate arrow for which i send message
SendMessage(TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_DOUBLEBUFFER );
which enlarge size of TBBUTTONs for this i send
SendMessage(TB_SETPADDING, (WPARAM )0, MAKELPARAM (setpaddingXaxis,setpaddingYaxis));
but on themechange from winXP to window classic style or vice-versa toolbar button size change drastically.
Is anyone know the solution of it...
thnx in advance.
|
|
|
|
|
hi friends,
i have created one ATL project and add one simple Atl class then, just add one class in list of inherianced classes in new simple atl class like below
class ATL_NO_VTABLE CSlider :<br />
public CComObjectRootEx<CComSingleThreadModel>,<br />
public CComCoClass<CSlider, &CLSID_Slider>,<br />
public IObjectWithSiteImpl<CSlider>,<br />
public IDispatchImpl<ISlider, &IID_ISlider, &LIBID_TabSlingLib, 1, 0>,<br />
<br />
public CWindowImpl<CSlider><br />
Then a got the error message like
error C2259: 'ATL::CComObject<Base>' : cannot instantiate abstract class
please help...
Thanks,
|
|
|
|
|
zakkas2483 wrote: Then a got the error message like
error C2259: 'ATL::CComObject<base />' : cannot instantiate abstract class
please help...
Thanks,
If you are using Visual Studio, you can switch from the tasks tab to the output tab, and you'll find the actual error message includes "Due to the following members..." and a list of the members that you need to override.
Nathan
|
|
|
|
|
I found surprisingly few articles that can help me about the subject. I simply want to have my program execute from the Windows Explorer context menu, and to have an icon with it. I found out that I can add an entry to *\\shell\\MyProgram, but I don't know how to associate an icon with it.
Could any one of you direct me to a nice article about this issue? I would like to do this in my own code, not to use some extension dll or something.
Thanks.
|
|
|
|
|
|
I have created an ATL control project which draws a polygon.
sides is the property wich takes input from user.
Inserted this control to MFC dialog.
when i tried to add variable for this control causes error as follows.
"Error: the Extender provider failed to return an extender for this object".
what does it mean?
|
|
|
|
|
Dear All,
Unable to convert CString to BSTR! Am I a stupid?!
I have an interface method which needs to convert CString to BSTR and return BSTR to caller.
AllocSysString of CString is not copying the data to BSTR.
STDMETHODIMP CTP_Interface_ErrorCode_Wrp::GetAdditionalDataFlag(BSTR *AddDataFlag)<br />
{<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState())<br />
<br />
<br />
CString temp = pTP_Interface_ErrorCode->GetAdditionalDataFlag();<br />
*AddDataFlag = temp.AllocSysString();<br />
<br />
return S_OK;<br />
}
Any one please help me.
Thanks very much, Nani
|
|
|
|
|
You code looks correct.
How do you see that value is not copied? I mean have you used debugger or you just saw it on the client side?
BTW try first something simpler such as
CString temp(_T("foo"));
*AddDataFlag = temp.AllocSysString();
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Yeah. I am real crap!!!
I did everything correctly, but the debugger is giving some number instead of string.
I dont know why?!
I converted back from BSTR to CString in my client, and was able to print results properly.
Thank very much
|
|
|
|
|
Hello mandanani,
If I understand your problem correctly, I think the problem you are facing is the formatting of the debugger output.
Were yu looking at the contents of the BSTR from the Watch Window ? If so, simply put a ", su" after the BSTR variable and see the contents of the BSTR transformed into something you can read.
This is known as reformatting the varible. The "su" means "string unicode".
- Bio.
|
|
|
|
|
Hi Nani,
Your code is correct and here CString is converted into BSTR also.
Just add one messagebox and check it out.
MessageBox(0,(LPCTSTR)(CString)*AddDataFlag,"1",0);
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
better use _bstr_t(CSTRIBG).Detach() or .copy
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Hi, my program uses a WebBrowser Control with the following code:
HRESULT hr = CoCreateInstance(CLSID_WebBrowser,<br />
NULL,<br />
CLSCTX_INPROC,<br />
IID_IWebBrowser,<br />
(void**)&m_spWebBrowser);
Then I navigate the control to a local html file, which contains some type text inputs, the code is like this;
<span contentEditable="true"></span>
Upon the load completion, I attached a render behevior for each element, the definition is list below:
class ATL_NO_VTABLE CIdsUISpanRB : <br />
public CComObjectRootEx<CComSingleThreadModel>,<br />
public CComCoClass<CIdsUISpanRB, &CLSID_IdsUISpanRB>,<br />
public IDispatchImpl<IIdsUISpanRB, &IID_IIdsUISpanRB, &LIBID_IdsViewer>,<br />
public IElementBehavior,<br />
public IElementBehaviorFactory,<br />
public IHTMLPainter
The render behavior above implemented an event sink, I conneted it with the webbrowser control by AtlAdvise:
hr = AtlAdvise(m_spElem, (IDispatch*)this,
DIID_HTMLElementEvents2,<br />
&m_dwCookie);
What I want to do, is to process the input event within the invoke method of IDispatch interface:
STDMETHODIMP CIdsUISpanRB::Invoke( DISPID dispidMember,<br />
REFIID riid,<br />
LCID lcid,<br />
WORD wFlags,<br />
DISPPARAMS* pdispparams,<br />
VARIANT* pvarResult,<br />
EXCEPINFO* pexcepinfo,<br />
UINT* puArgErr)<br />
{<br />
switch (dispidMember)<br />
{<br />
case DISPID_HTMLDOCUMENTEVENTS_ONKEYDOWN:<br />
{<br />
break;<br />
}<br />
}<br />
}
The problem I have, is that I can't get keydown or keyup event, but only keypress message, so any one can tell me why? how to get the keydown event?
Another thing, I attached an edit designer to the whole html docuement mentioned above, in order to handle events within the html doc. Within the edit designer, I can get keydown event, but no keyup.
moreover, as docuemented, the TranslateAccelerator method of IEditDesigner, will be called first if any keyboard event triggered, but acutally this function was never called even I press the keyborad, what's wrong?
|
|
|
|
|
Hello guys,
I have encountered a strange issue with Vista, and if anybody has any clue please let me know.
So okay, I have a normal dialog with a tab control, it has embedded a few tab pages with controls, this all work regularely on Win 2000 and XP and Server 2003. Now with Vista, one control is a password control, and if I hit CAPS and start typing into that control, there will be a big tooltip notifying me that I am typing with my caps on, bla bla. This is a OS level tooltip, because I see it everywhere on Vista whenever I do the same, from logging on to Vista, to any of the system dialogs.
The problem is that when the tooltip disappears, the area below it is blank, I don't see the controls as if they were eraised. This is the problem that the controls does not repaint themselves, I guess, but I don't know why - if I open a Notepad, for example, move it in front of my WTL dialog, and them aside, the dialog and controls are painted regularely.
So if anybody has any thoughts on this please let me know.
Thank you.
Sarajevo, Bosnia
|
|
|
|
|
Hi everybody,
I have a problem with a menu on a regular dialog. I want to change the text of the menu item in run-time, so I do this:
ModifyMenu( GetMenu(), 0, MF_STRING | MF_BYPOSITION, 0, (LPCTSTR) _T( "View" ) );
This works if the menu is submenu and I am changing the items there, but if I want to change the root menu (the one that sits on the menu bar and does not have an ID), then it changes but it does not display any changes until I move the mouse over it, so I guess it does not refreshes immediatelly.
Or maybe there is a whole better way to change the text of the menu items at runtime?
I went through Michael Dunn's articles, but only have seen the examples of toolbar and statusbar, with UISetText, but this does not work in my case.
Thanks for your help in advance.
|
|
|
|
|
You need to call DrawMenuBar() to redraw the menu.
|
|
|
|
|
Exactly! Thanks for your help, I really appreciate it.
|
|
|
|
|
The problem still persists in some way. After I call DrawMenuBar(), it does refreshes the menu but now the code that checks and unchecks the menu item does not work at all. Also, the code that grays out some menu item does not work either, and it doesn't matter how many times I call DrawMenuBar().
I am not sure whether this behavior is specific to DrawMenuBar(), or is caused by the ModifyMenu command, but it sure screws up the app.
Thank you.
|
|
|
|
|