|
Hi all,
I am wondering about using exception handling in ATL *without* the need to dinamically link to msvcrt.dll... can one do it ?
I can't use SEH due to C++ classes.
|
|
|
|
|
Sure, just link statically to the CRT (the MinDependency configs do this already when you remove the _ATL_MIN_CRT preprocessor symbol)
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Help !!
The size of my program doubles from 28 K to 56 K !
Is this the price to pay to use exception handling ???
|
|
|
|
|
This is the price to pay for using CRT.
|
|
|
|
|
So every ATL program that uses exception handling needs to link CRT...
Is this the price to pay for using exceptions ?
|
|
|
|
|
Hi,
Im developing a application in ATL..My problem is when I minimize the application,it should disappear from Taskbar and tray icon should be created..
No i dunno how to dissappear it from Task bar..So any idea....or ny links..
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
|
In my application, i use UISetCheck to check buttons in my menu. But i can't get UISetRadio() to work. It doesn't do a thing. I used
UPDATE_ELEMENT(ID_TASKBAR_SIGNIN, UPDUI_MENUPOPUP)
to make WTL handle it but do i need to do something else with it to make it handle radio buttons too?
Thanks
|
|
|
|
|
UIUpdateMenuBarElement() doesn't support radio-checking menu items, although it is possible to add the code to do it. I did it for my own work a few weeks ago, when I get home I'll see if I can find the code (I didn't end up using it after all, so I might not have kept it)
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Well did you ding it ? And if you didn't, i can't mix up API calls with this UIEnable thingy, cause then the API calls don't seem to work...
|
|
|
|
|
|
is there a way to do this:
int sum = 0;
for (myIterator it = sv.begin(); it != sv.end(); it++)
{
sum+=(*it).GetValue();
}
using for_each or accumulate, without writing extra functions? in other words, i want it all on one line...
int sum = std::accumulate(sv.begin(), sv.end(), 0, some_way_to_call_GetValue()_on_the_current_item);
?
(i should really go buy an STL book)
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
|
not exactly without extra functions, but you will need + operator. here's something similar:
class CLong
{
public:
CLong(long l) : m_val(l){;}
const long Val() const {return m_val;}
CLong operator+(const CLong& rhs)
{
return CLong(m_val + rhs.Val());
}
private:
long m_val;
};
using namespace std;
int main(int argc, char* argv[])
{
std::vector<CLong> v;
v.push_back(1L);
v.push_back(4L);
v.push_back(9L);
CLong csum(0);
csum = accumulate( v.begin(), v.end(), csum, mem_fun1_ref(&CLong::operator+));
cout << "sum: " << csum.Val();
return 0;
}
|
|
|
|
|
 There is a way to do this by writing a template for the functor. You can do something like:
<br />
#include <iostream><br />
#include <numeric><br />
#include <vector><br />
<br />
using namespace std;<br />
<br />
template<typename SumType, class D><br />
class MemFuncAdder<br />
{<br />
public:<br />
typedef SumType (D::*func) () const;<br />
<br />
MemFuncAdder( func f )<br />
{<br />
m_f = f;<br />
}<br />
<br />
SumType operator() (SumType running_sum, const D& data)<br />
{<br />
return (running_sum + (data.*m_f) () );<br />
}<br />
private:<br />
func m_f;<br />
};<br />
<br />
class Data<br />
{<br />
int value1;<br />
int value2;<br />
public:<br />
Data( int v1, int v2) : value1(v1), value2(v2) {}<br />
<br />
int V1() const { return (value1); }<br />
int V2() const { return (value2); }<br />
<br />
friend ostream& operator<< ( ostream &os, const Data &data)<br />
{<br />
os << "( " << data.value1 << ", " << data.value2 << ")";<br />
return os;<br />
}<br />
};<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
vector<Data> array;<br />
<br />
array.push_back( Data( 1,1) );<br />
array.push_back( Data( 1,2) );<br />
array.push_back( Data( 1,3) );<br />
array.push_back( Data( 1,4) );<br />
array.push_back( Data( 1,5) );<br />
<br />
copy( array.begin(), array.end(), ostream_iterator<Data>( cout, ", " ));<br />
cout << endl;<br />
<br />
cout << "Result 1 = " << accumulate( array.begin(), array.end(), 0, MemFuncAdder<int,Data>(&Data::V1) ) << endl;<br />
cout << "Result 2 = " << accumulate( array.begin(), array.end(), 0, MemFuncAdder<int,Data>(&Data::V2) ) << endl;<br />
<br />
return 0;<br />
}<br />
Once you provide the MemFuncAdder template, you can call accumulate on multiple member functions without needing to write additional code. If you need a different operation other than addition, you could provide other templated functor classes.
|
|
|
|
|
has anyone ever seen a wrapper for a list control or tree control that can act as an STL container?
i'm dealing with a CListCtrl right now, and i noticed that it would be great to be able to do something like:
foreach(m_listCtrl.begin(), m_listCtrl.end(), do_something_with_selected_items);
or, to load items:
m_listCtrl.insert(lvitem);
m_listCtrl.push_back(lvitem);
you could treat a list control as a vector. and you could treat a CTreeCtrl as a tree (duh) of some kind. maybe you could sort the list control with std::sort, etc..
i don't need this functionality, i just thought it would be a really slick bit of code.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
It would be a nice contribution (volunteers? ). Anyway, I think this should be modelled after std::list rather than std::vector .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
if i knew anything about the internals of an STL container, i would've written it myself before giving away the idea. maybe i'll take a look at your map for inspiration
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Chris Losinger wrote:
has anyone ever seen a wrapper for a list control or tree control that can act as an STL container?
How about this:
WINSTL[^].
-Nick Parker
|
|
|
|
|
|
Another way to look at this is to turn it on its head and say use a virtual list box which accessed items directly in the STL vector etc.
There are many advantages to this approach. eg. No parallel copies of the data to maintain and keep in sync, faster population of the control as it doesn't need to copy the data, more efficient memory use etc.
I've written a tree control that works like this. It uses an abstract container class to request the items it needs to display, and has absolutely no knowledge of where the data elements live or what they are. You can see this in the ClassView, Ascii Chart and Skeleton trees in ED.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
NEw custom property pages should be added to the device manager's property sheet using WTL. I used CPropertyPageImpl<> base class for this. Property page is not being displayed. IF new tab in the devicemanager prperties dialog box is clicked application is crashing.
Rajani
|
|
|
|
|
Hi there,
I am working on CStatic control of VC++. I want to load Bitmap on the CStatic control with Transparent Background. For that I have created the Object of CBitmap. But It seems that CBitmap is not having transparent property. Can anybody show me the way, how to make CBitmap object transparent? I am creating Bitmap with CretateBitmap() method and after that I am Loading Bitmap to the CBitmap Object with LoadBitmap() method. These are the basic steps required to load Bitmap to the newly created Bitmap, but I don't know how to make it Transparent? Is there anybody who knows the trick? Please, show me the way...
Thanx in Advance,
Regards,
Kav
India
|
|
|
|
|
|
Hello everybody:
I was wondering if ther is a way to use the cin.getline() function when you use string objects. With the code snipet below I get the following error:
error C2664: 'class std::basic_istream<char,struct std::char_traits<char> > &__thiscall std::basic_istream<char,struct std::char_traits<char> >::getline(char *,int,char)' : cann
ot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
hwproject.exe - 1 error(s), 0 warning(s)
I always encounter this problem and I don't know what to do to solve this. Is there a better way to do this with string objects? Can you tell me what I did wrong with the code below? Any answer is more than welcome.
#include <string><br />
#include <iostream><br />
using namespace std;<br />
<br />
void main()<br />
{<br />
int itemNum;<br />
string Desc;<br />
cout << "Enter Item Number: ";<br />
cin >> itemNum;<br />
cout << "Enter Description: ";<br />
cin.getline(Desc, sizeof(Desc), (char)"\n");<br />
}
Luis E. Cuadrado
)
|
|
|
|
|