|
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.
|
|
|
|
|
Yes we don't need to release managed pointers.
I tried to check how released pointers will work.
Its clear now. Thanks for your explanation.
|
|
|
|
|
Hi to all. I'm trying to open some project wroted using WTL. When I try to rebuild it (using VS2008 on Win XP) I get the compile error as above. Now, "atlres.h" file is in directory which I added to my project settings properly and I don't know why error appears!?
The message states "cannot open.." which means it has no trouble locating it? but rather cant open it?
Please help!
Thanks in advance.
|
|
|
|
|
I think you need to add the WTL include directory to the include directory path for the resource compiler. Right-click on the project, select 'Properties', select Resources->General in the properties window and add the WTL include directory to Additional Include Directories.
|
|
|
|
|
Thanks for replaying to me. I already have directory path (D:\...\WTL80\include) included in Aditional Include Directories.
?
|
|
|
|
|
In the Additional Include Directories for the resource compiler? I'm NOT talking about the C++ compiler options...
|
|
|
|
|
In 'MyProgram' Property Pages under C/C++ General Additional Include Directories.
|
|
|
|
|
OK I got you.
Stop complaining about that.
Thanks big time!
Now I get:
"fatal error LNK1104: cannot open file 'C:/Program Files/Microsoft SDKs/Windows/v5.0/Lib/DnsAPI.Lib'" ?
|
|
|
|
|
That's a completely different matter - if you really need DNSAPI.lib, what I'd do is open a Command Prompt window, and execute the following commands:
CD /d "c:\Program Files"
dir /s/b dnsapi.lib
It might take a while to run, probably, but it'll likely find any DNSAPI.lib you have. On my machine, I get the following output:
C:\Program Files\Microsoft SDKs\Windows\v5.0\Lib\IA64\DnsAPI.Lib
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\DnsAPI.Lib
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\DnsAPI.Lib
C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib\DnsAPI.Lib
C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib\IA64\DnsAPI.Lib
C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib\x64\DnsAPI.Lib
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib\DnsAPI.Lib
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\DnsAPI.Lib
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\AMD64\DnsAPI.Lib
You can see that (for some reason - I don't know why!) I only have Itanium libraries under C:\Program Files\Microsoft SDKs\Windows\v5.0.
|
|
|
|
|
Is there any way you can get him to take another one, like second from v6.0A for example?
|
|
|
|
|
Yes - in the project properties, under 'Linker', you can tell the linker what directories to look in.
Alternatively, you can add them under Tools->Options, somewhere near the place where you can say what C++ include directories to use.
|
|
|
|
|
Tried it in both places but still no improvement (in tools options even when I pull it up at the top of list)!
Error:"fatal error LNK1104: cannot open file 'C:/Program Files/Microsoft SDKs/Windows/v5.0/Lib/DnsAPI.Lib'"
But big thanks for you anyway.
|
|
|
|