|
josip cagalj wrote: I'm stern to go trough the series of articles here on CP by Dunn
They're good articles - Michael's (to my mind) one of the most knowledgeable WTL experts.
josip cagalj wrote: sorry if I'm a pain to you
If you were, I probably wouldn't be answering your questions
|
|
|
|
|
Thanks for previous post.
I tried to add a dialog to my app so after designing one mfc wizard showed up for adding a class for the new dialog so I followed it. When I compiled afterward i got an error saying "fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>", I deleted the dialog and corresponding *.h and *.cpp from project but the error persist?
I think I need to skip the mfc wizard and manually add an class for the new dialog I've designed class:
class CMyNewDlg : public CDialogImpl<cmaindlg>,
public CWinDataExchange<cmynewdlg>
{
public:
enum { IDD = IDD_MYNEWDLG };
CMyNewDlg();
...
If so can I add this in existing .h file like CMainDlg.h or I need to manually add CMyNewDlg.h and CMyNewDlg.cpp files?
|
|
|
|
|
It probably added one or more MFC include files (afx.h?) to your stdafx.h. Remove those.
|
|
|
|
|
What this means:
error C2039: 'SubclassWindow' : is not a member of 'WTL::CTreeViewCtrlT<tbase>'</tbase>
I've placed an treeview ctrl on my new dlg and everything is ok when I use m_wndTree.Attach(GetDlgItem(IDC_TREE));
but when I want to use DDX_CONTROL like this
BEGIN_DDX_MAP(CMyTreeDlg)
DDX_CONTROL(IDC_TREE, m_wndTree)
END_DDX_MAP()
I get above error
|
|
|
|
|
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.
|
|
|
|