|
Remove '_ATL_MIN_CRT' from the list of pre-processor defines. You've used part of the C run-time library that pulls in the initialisation part of the library. This looks for _main, which isn't defined if _ATL_MIN_CRT is defined.
HTH
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
|
Hi,
In IBM open class library,we have a class called IKeySet which has to be replaced by map in STL as per IBM migration guide.But in eh IKeySet we have a provision to add an elelemnt with key as well as an element.(this feature it inherited from ICollection class which is equivalent to list or deque in STL). I am trying in vain to have this type with map also but dint succeed.
Can you guys give some idea as how to implement this.That would pull me out of this soup..
Thanks
Sasi
|
|
|
|
|
Explain what you meant by "add an elelemnt with key as well as an element."
Kuphryn
|
|
|
|
|
Infact IKeyset inherited the feautures of ICollection( which is like list) and IAKeySet(its like map).SO we can add the elements of both with key (like in map)as well as just the element(liek in list). Hope this will suffice.Please look at the code below
#include <iostream>
#include
#include <deque>
#include <utility>
#include <string>
using namespace std;
typedef const string& CIR;
typedef enum { IEArgString, IEArgNumber, IEArgSpecial } IEArgType;
class IEArg {
public:
//* Element name and value and embedded datatype.
string name;
string value;
IEArgType dataType;
//* Default constructor given name and value.
IEArg(CIR n, CIR v) : name(n), value(v) { dataType = IEArgString; }
IEArg(CIR n, CIR v, IEArgType t) : name(n), value(v), dataType(t) { }
friend bool operator<(const IEArg& lhs, const IEArg& rhs);
};
inline bool operator<(const IEArg& lhs, const IEArg& rhs)
{
if (lhs.name == rhs.name && lhs.value == rhs.value)
return FALSE;
else
return TRUE;
}
typedef map<string,iearg> IEArgList;
inline CIR key(const IEArg& iea) { return iea.name; }
typedef deque < IEArg > IEOArgList;
typedef deque < IEOArgList > SUMMARY;
main()
{
int days=10;
IEArgList al;
string where;
string nam="1235";
string val="12";
// Maps and multimaps deal with pairs
typedef pair<string,iearg> entry;
entry p0("Time",IEArg("1100","A"));
entry p1("Time",IEArg("1234","A"));
entry p2("Transaction",IEArg("4567","D"));
entry p4("xransaction",IEArg("2345","B"));
entry p3("ResultCode",IEArg("5678","C"));
al.insert(p0);
al.insert(p1);
al.insert(p2);
al.insert(p4);
al.insert(p3);
/********
I want add just IEArgList just liek a collection with out key
********/
IEArgList::iterator iter;
for (iter = al.begin(); iter != al.end(); iter++) {
cout<<"values are:"<<(*iter).first<<":"<<(*iter).second.value<<":"<<(*iter).second.name<
|
|
|
|
|
Essentially, you want to store an into sorted container, correct? In your example, you are storing it inside a map and requires key/value. One solution is a set.
Kuphryn
|
|
|
|
|
I can't understand what your code is supposed to be doing. Why not describe your basic data structures and what this collection is supposed to be used for? You obviously cannot make a map or a set of a type and then store things that are not actually instances of that type in the map or set.
FWIW when you reply with code if you check the little box after the text box it will display the template definitions directly and not require us to 'view source' and generally mess about.
Paul
|
|
|
|
|
CPU usage increases for list view for same app under XP
-------------------------------------------------------
I've been working on an application for several years which uses MS ListView controls to display large grids of data (perhaps 50 lines by 100 columns).
background: The application displays market data, amongst other things, from electronic exchanges.
The application updates individual cells relatively rapidly.
I handled the CustomDraw events to provide formatting such as colors.
The list view is in virtual mode.
All was well on Win2000. CPU usage was reasonable. However, when I open the same window under XP, the CPU usage seems to increase dramatically.
I used the ATLControls.h list view wrapper as a thin wrapper around the control, and compiled under VC6, SP5.
Does anyone have any clues?
Thanks in advance
Dan Hill
|
|
|
|
|
PS Am also using WTL MDI wrappers
|
|
|
|
|
Hi All,
I have been going through one of my older projects and updating it from WTL 7.0 to 7.1 and am getting error which I have no idea how to fix.
I have search through the forum and have found no-one else has had this problem... or the problem is so easy that I cannot see the solution.
All I have done is changed the path to my wtl 7.0 include to now point to the 7.1 includes. I then rebuild my app and get the following error
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlapp.h(396) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlapp.h(397) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlapp.h(595) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlapp.h(599) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlapp.h(600) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlapp.h(603) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlapp.h(844) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atluser.h(39) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atluser.h(39) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atluser.h(57) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atluser.h(82) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atluser.h(205) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atluser.h(490) : see reference to class template instantiation 'WTL::CMenuT<t_bmanaged>' being compiled
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlgdi.h(78) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlgdi.h(86) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlgdi.h(88) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlgdi.h(528) : error C2872: 'ATL' : ambiguous symbol
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlgdi.h(682) : see reference to class template instantiation 'WTL::CBitmapT<t_bmanaged>' being compiled
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\WTL71\INCLUDE\atlframe.h(380) : error C2872: 'ATL' : ambiguous symbol
.... and it keeps on going
I am using visual c++ 6.0
ANy ideas on why this is happening?
cheers
Bryce
|
|
|
|
|
Hi all
I have implemented IDochostUIHandler for my HTML control hosting. The container for the HTML control is IE. now i want to handle events from top level menu such as FILE/Edit. what interfaces i need to add to acheive the same.
BTW i looked into msdn for the same, it says
////MSDN////
IDocHostUIHandler::ShowUI Method
Called by MSHTML to enable the host to replace MSHTML menus and toolbars
/////
My question is When these function is called and who calls it?
thanks in Advance
Abhishake
|
|
|
|
|
Hello,
In my application I call a dll, which contains an exported class.
The class has a member function, which passes a std::list by reference.
When using the push_back member of the list, the application just freezes after a few iterations:
In my main app:
<br />
std::list< std::basic_string<TCHAR> > m_Columns;<br />
int bReturn=pMyDllClass->doit(m_Columns);<br />
In my dll
<br />
int CMyDllClass::doit(std::list< std::basic_string<TCHAR> >& out)<br />
{<br />
...<br />
for (int n=0; n<20; n++)<br />
{<br />
out.push_back(std::basic_string<TCHAR>("test");<br />
}<br />
...<br />
return 0;
}<br />
After iteration 11 or so, the app freezes.
I I use this piece of code in my main app, so not using the dll but using a normal class, it works perfectly.
Any idea what I'm doing wrong
Thanks
Regards
Wim
|
|
|
|
|
I see two potential problems here:
1. You may be using VC6. In that case you need to either patch your STL, or use STLPort in order to pass STL objects accross DLL boundaries.
2. You are statically linking CRT and C++ Standard library. If you are doing this, than you should better delete objects in the same dll where they are created.
|
|
|
|
|
Hello,
Thanks for your reply.
1) I'm using Visual C++.NET 2003, with latest sdk's.
2) I've set the 'Minimize CRT usage in ATL' to No. I'm not using atl for the dll anyway...
If I should delete my objects in the dll I'm using, how can I do that?
After all, I'm passing the std::list reference from my main program to the dll. The dll is just stuffing the std::list with data...
Regards
Wim
|
|
|
|
|
Wim Jans wrote:
After all, I'm passing the std::list reference from my main program to the dll. The dll is just stuffing the std::list with data...
"Just stuffing" is the problem. That's because you allocate the data you "stuff" in one module (dll), and delete it in the second one (exe). Arguably the easiest way to get around this problem is to follow Michael Dunn's advice.
|
|
|
|
|
The app and the DLL must both be linking to the DLL version of the CRT for that to work. If one (or both) use the static LIB version, each will have a different heap, and one cannot alloc/free on the other's heap.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
Step1) I made a program in C which contains user defined data-types and functions.
Step2) then this file is included in a Win32 project which makes use of MFC to create a Class which is derived from CDC and contains member variables of type defined in the C file; the output of this project is a .LIB file,
Step3)I can link this LIB file to a MFC project and works fine. But When I go ahead to use this lib file to create an ATL_COM DLL where I instantiate the class , the compiler reports several errors regarding the class is unidentified, all the type definitions are undefind.
Pls suggest me a remedy to this problem.
|
|
|
|
|
Does your ATL project and LIB project have the same runtime libraries? DLL or static, single threaded or multi threaded?
I've run into that problem a couple of times, and the solution to my problem was to make the LIB, which I'm linking with, have the same runtime library settings as the ATL DLL.
--
Booohoo!
|
|
|
|
|
I've used the same project->settings i.e "Use MFC in a Static Library". for both LIB and ATL projects
##I defined the Class CMyDC derived from CDC in my LIB project.
##I copied the LIB file to the ATL COM project directory,
##then added the "myFirst.LIB" in the Project -> Settings -> Object/Library Module
## then created an object dc of type CMyDC
The error Messages are :-
1) error C2065: 'CMyDC' : undeclared identifier
(CMyDC is the name of the class I've defined in my lib file)
2) error C2146: syntax error : missing ';' before identifier 'dc'
3) error C2065: 'dc' : undeclared identifier
|
|
|
|
|
I've used the same RUNTIME options i.e /MD for both projects
PLS HELP........
|
|
|
|
|
i m working in .net ..
i took two listbox web server controls..ok
In My Listbox1 there is some data which comes from database
on client side & i added some elements from listbox1 to listbox2 i have done this by using javascript ok...
Now on some event my page is going to refresh.. so what ever the data i have add on client side in listbox2 vanishes as page get refresh..
what i think as .Net provide a view state so how it get vanishes ....
so can u tell me where i m wrong...
the reason behind to think so, is that (if we add some data in text box through javascript or we just enter through our key board) and when it do the server trip it remains there ,then why not for list box.. so please help me and tell me where i m wrong...
thanks in advance...
|
|
|
|
|
|
[EDIT2] Nevermind, I just discovered Updatelayout() and realized how stupid my question was
Hello everyone, I'm a real newbie to programing both WTL and MFC so bare with me.
I'm trying to subclass a CButton to a CWindowContainer in a framewindow derived from
CMDIChildWindowImpl. But for some reason it won't show up. Am I trying to do something that isn't possible?
Thanks in advance,
Skandal
[EDIT] I don't know if it's obvious from my post that I'm using WTL.
|
|
|
|
|
Hi,
I am facing a peculiar problem with usage of maps in the following code
#include <iostream>
#include
#include <deque>
#include <string>
using namespace std;
typedef const string& CIR;
typedef enum { IEArgString, IEArgNumber, IEArgSpecial } IEArgType;
class IEArg {
public:
//* Element name and value and embedded datatype.
string name;
string value;
IEArgType dataType;
//* Default constructor given name and value.
IEArg(CIR n, CIR v) : name(n), value(v) { dataType = IEArgString; }
IEArg(CIR n, CIR v, IEArgType t) : name(n), value(v), dataType(t) { }
};
typedef map < IEArg,string > IEArgList;
// typedef map < string,IEArg > IEArgList;
inline CIR key(const IEArg& iea) { return iea.name; }
typedef deque < IEArg > IEOArgList;
main()
{
int days=10;
IEArgList al;
string where;
string nam="1235";
string val="12";
// Maps and multimaps deal with pairs
typedef pair < IEArg,string > entry;
// typedef pair < string,IEArg > entry;
entry p1(IEArg("1234","A"),"Time");
// entry p1("Time",IEArg("1234","A"));
entry p2(IEArg("4567","B"),"Transaction");
// entry p2("Transaction",IEArg("4567","B"));
entry p3(IEArg("5678","C"),"ResultCode");
// entry p3("ResultCode",IEArg("5678","C"));
// Insert values into the phonebook
al.insert(p1);
al.insert(p2);
al.insert(p3);
where = string("Userid='") + "SASI" + string("'");
cout<<"Value of where is "<<where<<endl;
if="" (days=""> 0) {
where += string(" AND ");
where += string("Time >= (CURRENT TIMESTAMP - ");
where += string(days);
where += string(" DAY)");
}
IEArgList::iterator iter;
for (iter = al.begin(); iter != al.end(); iter++) {
cout<<"values are:"<<(*iter).first.name<<":"<<(*iter).first.value<<":"<<(*iter).second<
|
|
|
|
|
If you had spent 2 minutes on reading the documentation for std::map , you would have seen that either you must provide a less than operator (operator< ) for IEArg , or provide a binary functor/predicate type as the third template parameter to std::map which knows how to compare two IEArg s.
--
Booohoo!
|
|
|
|