|
I believe you need to declare m_wndTree with type CContainedWindowT< CTreeViewCtrl > for it to have a SubclassWindow member.
[edit]You also need to construct m_wndTree correctly:
- If
m_wndTree doesn't have a message map (using ALT_MSG_MAP )
CMyTreeDlg() : m_wndTree(this)
. . .
. . . - If
m_wndTree has a message map (using ALT_MSG_MAP(number )
CMyTreeDlg() : m_wndTree(this, number)
. . .
. . .
[/edit]
|
|
|
|
|
i,ve an int that should be increased each time the picturebox gets a new picture, what is the event i can use, i tried LoadCompleted but it didn't success.
|
|
|
|
|
Hi,
I'm working on some test app and i need help. I'm using vs2008 wtl. I add an handler for timer functionality and it looks like: MESSAGE_HANDLER(WM_TIMER, OnTimer) ,
and implementationLRESULT OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
Unlike old MSG_WM_TIMER(OnTimer) and implementation void OnTimer ( UINT uTimerID, TIMERPROC pTimerProc )
My question how can I get timer id out from param's in 'new' MESSAGE_HANDLER ontimer f.?
Thanks in advance
|
|
|
|
|
Look at the documentation[^] - wParam == timer ID.
So, uncomment the relevant parameter's name in your implementation and use it. You should have something like this:
LRESULT OnTimer(UINT , WPARAM wParam, LPARAM , BOOL& );
or you could even alter the parameter's name to be more descriptive...
LRESULT OnTimer(UINT , WPARAM timerID, LPARAM , BOOL& );
|
|
|
|
|
Thanks once again Stuart, indeed I've done so.
UINT uTimerID = (UINT)wParam;
Similarly I've get HDC out from WM_ERASEBKGND implementer;
HDC hdc = (HDC)wParam;
One question do, I'm getting error on my CRect member: "error C2065: 'CRect' : undeclared identifier"
???
Do I need additional include?
|
|
|
|
|
By including 'atltypes.h'
|
|
|
|
|
CRect is defined in atltypes.h in ATL in Visual Studio 2003, 2005 and 2008, or alternatively in atlmisc.h in WTL - if you're using one of those Visual Studio versions, I'd #include atltypes.h rather than atlmisc.h .
|
|
|
|
|
THANKS!
I've included atltypes.h now complaining about
"error C2079: 'sTime' uses undefined class 'WTL::CString'"
sTime - is my CString variable
I have
#define _WTL_USE_CSTRING in my stdafx.h
|
|
|
|
|
Just remove my include 'atltypes.h' instead included 'atlmisc.h' no error now!
|
|
|
|
|
See the "WTL CString support" section on this page[^] - you're probably better off using ATL's CString rather than WTL's, as ATL's CString is (now) MFC's CString, so may be more fully featured and optimised?
|
|
|
|
|
Thanks, I've read the article and I must say it's a little ambiguous.
Why couldn't I just leave it as is (including atlmisc.h) is it wrong?
Everything is compiling ok?!
|
|
|
|
|
You can - I'm just pointing out the options I suspect that the WTL CString is no longer developed (I could be wrong), whereas the ATL/MFC CString is as mainstream as C++ gets in Microsoft development.
|
|
|
|
|
Hey everyone I'm having trouble with receiving events in ATL. I have a control that isn't receiving certain events. For example I've created a message handler for WM_CREATE. I've tested this with the ActiveX Control Test Container and the message is never triggered. The same happens with WM_PAINT. However I get messages for WM_LBUTTONDOWN. Can anyone tell me if I'm missing something?
|
|
|
|
|
I'm trying to get the icons on a CTabCtrl in high resolution, but all I've managed to establish is, WTL GetPage doesn't return something usefull or I don't know how to use it.
I've got this:
...
CTabCtrl tab = GetTabControl();
int nPages = tab.GetItemCount();
for(int i = 0; i < nPages; ++i)
{
???? HELP !!!! page = tab.GetPage(i);
ctrlImageList.AddIcon(LoadIcon(NULL, page.pszIcon));
}
tab.SetImageList(ctrlImageList);
...
ctrlImageList is created using ILC_COLOR32 | ILC_MASK
I'm only able to get the same stupid anoying hatefull error no matter what i try.
Please, i need help solving this
|
|
|
|
|
Use TCITEM structure
tab.SetImageList(ctrlImageList);
TCITEM tabItem;
BOOL bSuccess = tab.GetItem(nTabIndex, &tabItem);
//update members related to icons
if(bSuccess)
{
tabItem.mask = ..;
tabItem.iImage = ..;
tab.SetItem(nTabIndex, &tabItem);
}
|
|
|
|
|
Sorry the delay, I'm without connection at the moment.
I need to access the pszIcon in the m_psp, to load the icon into a CImageList. I've got a CTreeViewCtrl where I need the tab icons loaded into, and when i use ctrlTreeView.SetImageList(tab.GetImageList()), i only get 8 colors.
...
CTabCtrl tab = GetTabControl();
ctrlTreeView.SetImageList(tab.GetImageList());
...
I'm thinking in the lines of ctrlImageList.AddIcon(LoadIcon(NULL, m_psp.pszIcon)), but i don't know how to access the m_psp.
|
|
|
|
|
The following code compiled fine on VC6, but won't on VS2008. The first param to regex_search() does not match any of the function signatures.
string::const_iterator ssource_pos;
const boost::match_flag_type mflags = boost::match_default | boost::match_not_dot_newline | boost::format_default;
const boost::regex re( sre, boost::regex::perl | boost::regex::icase );
boost::match_results<std::string::const_iterator xmlns:std="#unknown"> what;
const bool bstat = boost::regex_search( ssource_pos, what, re, mflags );
</std::string::const_iterator>
In VC6 it must have been happy using:
bool regex_search(const basic_string<chart,>& s,
match_results<<br mode="hold" /> typename basic_string<chart,>::const_iterator,
Allocator>& m,
const basic_regex<chart,>& e,
match_flag_type flags = match_default);
but in VS2008 I get:
1>s:\libs\saigcontrols\strlib\sgstr_parse.cpp(628) : error C2780: 'bool boost::regex_search(const std::basic_string<chart,st,sa> &,const boost::basic_regex<chart,traits> &,boost::regex_constants::match_flag_type)' : expects 3 arguments - 4 provided
1> s:\libs\boost_1_33_1\boost\regex\v4\regex_search.hpp(152) : see declaration of 'boost::regex_search'
1>s:\libs\saigcontrols\strlib\sgstr_parse.cpp(628) : error C2780: 'bool boost::regex_search(const charT *,const boost::basic_regex<chart,traits> &,boost::regex_constants::match_flag_type)' : expects 3 arguments - 4 provided
1> s:\libs\boost_1_33_1\boost\regex\v4\regex_search.hpp(144) : see declaration of 'boost::regex_search'
1>s:\libs\saigcontrols\strlib\sgstr_parse.cpp(628) : error C2782: 'bool boost::regex_search(BidiIterator,BidiIterator,const boost::basic_regex<chart,traits> &,boost::regex_constants::match_flag_type)' : template parameter 'BidiIterator' is ambiguous
I would have though using:
const bool bstat = boost::regex_search( *ssource_pos, what, re, mflags );
would resolve this but it doesn't.
Boost reference is here: http://www.boost.org/doc/libs/1_33_1/libs/regex/doc/regex_search.html[^]
I am not using the latest Boost release, yet.
|
|
|
|
|
Why not bool bstat = boost::regex_search(ssource_pos.begin(), ssource_pos.end(), what, re, mflags) ?
Voici, la jeune femme est enceinte, elle va enfanter un fils et elle lui donnera le nom d'Emmanuel.
|
|
|
|
|
Andy Moore wrote: Why not bool bstat = boost::regex_search(ssource_pos.begin(), ssource_pos.end(), what, re, mflags)?
That is what I finished up doing but I was/am interested in knowing how I could resolve the original issue. ie. get a std::string from a string::const_iterator.
|
|
|
|
|
Neville Franks wrote: I was/am interested in knowing how I could resolve the original issue. ie. get a std::string from a string::const_iterator.
You can't. You can construct a copy of the string from an iterator pair, but technically, there's no way to deduce the string endpoints from a single iterator.
The reason it worked on VC6 is because VC6 std::string iterators were char pointers. Although (strictly), std::strings don't have to be stored as null-terminated strings, in practise they are, so a std::string could be constructed usng a single std::string iterator.
|
|
|
|
|
Thanks Stuart, that's what I was looking for. Head scratching can stop now.
I've just started moving a big project from VC6 to VS2008 and was expecting various issues to confront me.
|
|
|
|
|
I have aggregated IID_IInner and IID_IEnumVARIANT as follows
COM_INTERFACE_ENTRY_AGGREGATE(IID_IInner, m_pInnerUnk)
COM_INTERFACE_ENTRY_AGGREGATE(IID_IEnumVARIANT, m_pInnerUnk)
How do i call CoCreateInstance(...) in FinanConstruct() method?
|
|
|
|
|
|
IEP_SimpleObjPtr pEP_SimpleObj1;
pEP_SimpleObj1.CreateInstance(__uuidof(EP_SimpleObj));
IEP_SimpleObj1Ptr pEP_SimpleObj2;
pEP_SimpleObj1->QueryInterface(__uuidof(IEP_SimpleObj2), (void**) &pEP_SimpleObj2);
pEP_SimpleObj2->Release();
In the above code I have released pEP_SimpleObj2 pointer.
But still I can call methods using pEP_SimpleObj2 pointer. How?
|
|
|
|
|
As the object is also referenced by pEP_SimpleObj1, Releasing pEP_SimpleObj2 will probably only decrease the object's reference count to 1, so the object will still exist. If pEP_SimpleObj2 is just pointing within the object pointed at by pEP_SimpleObj1 (highly likely), then so long as the address held in pEP_SimpleObj2 hasn't changed, the pointer will still point at valid memory.
The point is that you cannot rely on this behaviour - it is NOT guaranteed. So don't do it.
Also - the whole point of managed pointers is that you don't need to bother with AddRef and Release - let the pointer objects do that for you in their constructors/destructors.
|
|
|
|