|
Steve,
I am actually using Visual Studio 2005 - so have MSC8 (with an STL that I thought was meant to be pretty good!).
Either way - with or without returning something - the code still won't compile.
Here it is in full:
#include "stdafx.h"
#include <windows.h>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
class CTest
{
public:
void SomeFunc(const std::wstring& str) const
{
OutputDebugString(str.c_str());
}
void DoSomething(void) const
{
std::vector<std::wstring> v;
v.push_back(L"test");
for_each(v.begin(), v.end(), std::bind1st(std::mem_fun1(&CTest::SomeFunc), this));
}
};
int _tmain(int argc, _TCHAR* argv[])
{
CTest test;
test.DoSomething();
return 0;
}
When I compile this, I get the following error:
error C2782: 'std::mem_fun1_t<_Result,_Ty,_Arg> std::mem_fun1(_Result (__thiscall _Ty::* )(_Arg))' : template parameter '_Ty' is ambiguous
c:\program files\microsoft visual studio 8\vc\include\functional(604) : see declaration of 'std::mem_fun1'
could be 'const CTest'
or 'CTest'
If I remove 'const' from the two methods, I get lots of different errors. Head meet brick wall.
|
|
|
|
|
Steve,
Thanks to the boost list and Stuart Dootson, I have a solution using boost::bind :
for_each(v.begin(), v.end(), bind(&CTest::SomeFunc, this, _1));
|
|
|
|
|
|
I want to pass my own information to propertypage that is created by propertysheet using "AddPage"&"Create".
But I found the fild "lParam" in m_psp has been used by WTL for core wrapp
Is there any method I can pass my own info to propertypage when they are created, initialize before shown.
-- modified at 9:20 Friday 10th March, 2006
|
|
|
|
|
|
Hello,
I was wondering if it is possible to implement MDI in a MFC based ActiveX control. I was able to implement SDI (using a sample from MSDN), but I faced some difficulties when implementing MDI. Any help would be highly appreciated.
Thanks in advance,
Dennis.
|
|
|
|
|
|
Disable "Minimize CRT use in ATL" in your project properties, and it should work.
|
|
|
|
|
Thanks a lot! That's really fantastic.
|
|
|
|
|
Does any one know how to make modeless dlgs/propertysheets destroy by themself?
my code:
<br />
pdlg = new CMyDlg;<br />
if(pdlg && pdlg->Create(hwndParent))<br />
pdlg->ShowWindow(SW_SHOW);<br />
<br />
void OnClose(UINT uCode, int nID, HWND hwndCtrl)
{<br />
DestroyWindow();<br />
}<br />
void OnNcDestory(void)<br />
{<br />
m_hWnd = NULL;<br />
delete this;
}<br />
But it works fine in MFC
http://www.codeproject.com/dialog/gettingmodeless.asp[^]
any idea?
-- modified at 10:34 Thursday 9th March, 2006
|
|
|
|
|
Override OnFinalMessage.
void OnFinalMessage(HWND /*hWnd*/)
{
delete this;
}
|
|
|
|
|
hfry wrote: Override OnFinalMessage.
void OnFinalMessage(HWND /*hWnd*/)
{
delete this;
}
Crashed!
I found that the m_hWnd is NULL when running to "delete this;".
But m_hWnd is reset again after the destructor of base class "CWindowImplRoot" is invoked-- line 2752 in file atlwin.h
BTW: I'm using WTL8.0.
-- modified at 7:55 Friday 10th March, 2006
|
|
|
|
|
Are you using VC6? or VC7+? If VC6 maybe you should look at Michael Dunn's post.
If it's happening in VC7.1, there was this long discussion on the WTL Yahoo forums a while back. I'm not sure if VC8 suffers from this problem.
http://groups.yahoo.com/group/wtl/message/10095[^]
|
|
|
|
|
The windowing code is from atlwin.h which is from ATL. So this is not part of WTL. WTL is built on top of ATL's windowing code so having the most updated WTL doesn't help.
New versions of ATL only ship with new versions of Visual Studio. The ATL files that is in the Platform SDK seems rather old.
|
|
|
|
|
There is a CBitmapButton IDC_CLOSE in my Dialog.
I destroy the whole Dialog in OnClose callback function
<br />
void CDlg::OnClose(UINT uCode, int nID, HWND hwndCtrl)<br />
{<br />
DestroyWindow();<br />
}<br />
When the Main Dlg is deleted, it crashed at line 2752 in file atlwin.h
<br />
if(m_hWnd != NULL)
{<br />
ATLTRACE(atlTraceWindowing, 0, _T("ERROR - Object deleted before window was destroyed\n"));<br />
ATLASSERT(FALSE);<br />
}<br />
The m_hWnd is the handle of button IDC_CLOSE!
|
|
|
|
|
|
hi
how to create an ATL class which is derived from IDIspEventImpl interface???
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
1. Add IDispEventImpl as a base class
class CAboutDlg: public CAxDialogImpl<CAboutDlg>,
public IDispEventImpl<IDC_ABOUT, CAboutDlg, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw, 1, 1>
2. Add a sink map to the class
BEGIN_SINK_MAP(CAboutDlg)
SINK_ENTRY_EX(IDC_ABOUT, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete)
END_SINK_MAP()
3. Implement the event handler - this is the implementation, you obviously need a corresponding declaration in the class.
void __stdcall CAboutDlg::OnDocumentComplete(IDispatch* pDisp, VARIANT * URL)
{
Do Stuff Here
}
This is from actual working code - a dialog that embeds HTML display using IE.
HTH!
|
|
|
|
|
We are a Software Development Company based in India and we are looking for experienced C++ ATL WTL developers to work as freelancers on our client's projects. The projects will be basically to develop BHO's and Toolbars for Internet Explorer.
Interested Persons can submit thier proposals to us at http://www.kbscript.com/contact.php
You should be an experienced developer in C++ with ATL/WTL in order to be selected.
Please answer the questions below mentioned with your proposal.
1) What is your experience level? (Intermediate or Expert)
2) How much experience you have int he programming of Toolbars and BHO's?
3) Why do you think you the best choice?
4) What are your hourly rates?
5) Would you like to be paid on "Per Hour Basis" or "Per Project Basis"?
6) Any relevant examples of your previous work realted the "toolbars" and "BHO's"?
7) Your present job and work areas?
So, Good Luck and hope to work with you soon.
Good Luck,
Ajay Chadha
|
|
|
|
|
you've got a job advertsisement ?
post it here[^]...
|
|
|
|
|
Has anyone tried compiling a VC6 MFC application using the VC7.1 compiler?
I followed this simple article on making VC6 to use the VC7.1 compiler.
http://pixwiki.bafsoft.com/wiki/index.php/Using_the_Optimizing_VC7_Compiler_with_the_VC6_IDE
Then all the errors I've been getting have been from the actual C:\Program
Files\Microsoft Visual Studio\VC98\MFC\Include\ folder (loads of template
syntax errors).
Surely Microsoft must've made a portability/conversion for VC6 MFC to be
used under VC7.1?
|
|
|
|
|
Doesn't surprise me - templates is the area where VC7.1 scores highest over VC6, in that it's nearly completely compliant with the C++ Standard, rather than being a not great attempt to be compliant with a draft standard (which was all that was around when VC6 was developed).
Let me guess - have you had to add/remove lots of 'typename' keywords? That's probably the biggest difference - VC6 will assume that dependent names are types, which isn't standard compliant. So, in this example from afxtempl.h (I compiled it with VC8)
<code>template<class TYPE, class ARG_TYPE>
CList<TYPE, ARG_TYPE>::CNode*
CList<TYPE, ARG_TYPE>::NewNode(CList::CNode* pPrev, CList::CNode* pNext)
{
... some more code ...
</code>
VC6 will assume CList<TYPE, ARG_TYPE>::CNode is a type, but VC7.1+ won't...because it might not be. You need to put typename CList<TYPE, ARG_TYPE>::CNode to tell the compiler that you are making a guarantee that it's a type.
Anyway - I'd suggest that you're out of luck - you should be OK compiling console and simple Win32 programs, but MFC and ATL programs require a match between compiler and library. That's the portability between VC6 and VC7.1 - you recompile you MFC programs with thea correct compiler/library match.
|
|
|
|
|
Hi All,
Can anyone tell me if there is an easy way to add 2 vectors?
Thanks and Regards,
Anil
|
|
|
|
|
std::vector<myType> v1;
std::vector<myType> v2;
for (std::vector<myType>::iterator
iter = v2.begin();
iter != v2.end();
iter++) {
v1.push_back(*iter);
}
|
|
|
|
|