|
None, I use STL quite a bit in ATL COM DLLs
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
There might be a problem if you are using VC 6.0 and you are declaring a std::map or std::set . That is because the STL implementation uses a static object in the XTREE header file. You need to update the XTREE header from the Dinkumware website. Details here[^]
Best regards,
Alexandru Savescu
|
|
|
|
|
how to include MFC in win32 Project?
hi there!
i needed to know how do i get to include MFC into a big and complex win32 application..i enabled mFC support but the linker throws a million lib files that are needed! where do i change the settings to include the lib files? I also included afxwin.h but then it said that an MFC application must not include windows.h so i removed it.. but then there are a million errors again..plz HELPPPP!
|
|
|
|
|
What exactly do you need from MFC to add to your App?
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
i want to include COleControl Class from MFC to replace a COleControl class from OLE 1.0..The thing is the files AfxCtrl.h , AfxWin.h cannot be included in the project..
hence BIGG probs..
plz do msg asap if u have a solution to this prob.
|
|
|
|
|
I suspect you are in hell. I don't see how you can easily do what you want. What you might try is create two console apps, and enable MFC in one ( I believe you can ). Do a diff of the two projects and see what has changed, and that might give you some ideas.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
welllll...
thanks a lot fellas!
ne better ideas????
|
|
|
|
|
Like I said, you are in hell.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian Graus wrote:
I suspect you are in hell. I don't see how you can easily do what you want. What you might try is create two console apps, and enable MFC in one ( I believe you can ). Do a diff of the two projects and see what has changed, and that might give you some ideas.
Playing games?
You cruel cruel man, but I like it.
|
|
|
|
|
A few hints :
- compiler options
use multithreaded run-time (/MD) (or /MDd if you are in Debug)
add the _AFXDLL compiler switch
- linker options
replace /subsystem:console with /subsystem:windows
- target type
open the .dsp file, and replace "(x86) Console Application 0x0103" with "(x86) Application 0x0101"
Back to real work : D-26.
|
|
|
|
|
|
I *was* using ostringstream as a member in a message construction class for a communication protocol. The app in question is a message format converter, that handles a few thousand messages per second on average and peaks can be in 10s of thousands per second.
The problem:
time_t t1, t2;
time(&t1);
for(unsigned long index = 0; index < 1000000; ++index)
{
ostringstream s;
}
time(&t2);
printf("%d\n", t2-t1);
takes 5 seconds to complete, ie, 5microseconds just to init the ostringstream.
Is there something that I am doing wrong?
Now, I replaced the ostringstream with a char buffer[MAX_SIZE] and is using sprintf and lstrcat instead. The CPU utilization at peak reduced from around 50% to 12 - 13%.
The times of ostringstream drops to 1 second for the above loop, if I use the Singlethreaded library instead of multithreaded.
I do not have a specific question, but I would guess that one should use stringstream very carefully in a very performance critical part of a multithreaded program.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Exactly. I have no problems using standard C string because I am VERY VERY careful. When I want to be even EXTRA careful, I use vsnprintf which is overrun safe.
I use STL a lot. But when it comes to time critical, I am always going back to code written specifically for the job.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I used sprintf, only because the largest message size is already known and anything larger than that is discarded.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
I hate to agree with Tim on this ( hi, Tim ), but it's obvious that a generic solution such as ostringstream is simply not going to be optimised for the sort of heavy use you're asking of it. If it's only initialising, you can keep an ostringstream member and use str("") to clear it, but overall, 10,000 hits a second to me is time to go as low level as possible.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Hehehe
I know I really over state my position a LOT. But most of the time that is all I am trying to say. I just want people to be open to alternative ways of doing things. Understand the problem and the available solutions and it is hard to go wrong.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
I know I really over state my position a LOT.
Yeah, not like me at all. Oh, wait.... :P
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
LOL - and I really mean it too.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
actually, LOSLISTC - Laughed out so loud I scared the cats.
I looked down and they were both looking up... "What the hell is wrong with you????"
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Christian Graus wrote:
use str("") to clear it,
reduced from 5 ms to 4 ms. Anyway, cannot compete with a char buffer. As Tim and you pointed out, my obsession with using STL in all situations caused this problem. I should have realized (as I have now) earlier that a high efficiency loop requires optimization and not generic classes.
In fact, initially I was having another thread of discussion with Tim about hash_map (because i did not suspect ostringstream, until I profiled it). Actually hash_map works great and the hash function which I copied from the CMapStringToString in MFC gives me virtually 0 collissions for my data set.
Anyway, I learned that I should not assume anything about a problem.
Thanks a lot for the insight you guys give. I have definitely become a much better programmer and designer with the interactions that I have at CP.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Can somebody show me how do I implement in my view the event on item expanding using a CTreeViewCtrl derived class.
Thanks
|
|
|
|
|
VC++ would have been a better forum for this question. More people who may know the answer to this question hang out there.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
The main reason of asking this in this forum, was because I found that the message handling of the events is handled in diferent ways. So the way is handled in MFC projects is not the same as in WTL projects.
So I rather be asking this to people of this forum because my project is an WTL/ATL project.
|
|
|
|
|
hellooo ppl.. long time since I ventured to codeproject..
anyway... I've been facing this problem..
I have an activex dll written in vb that exposes a few methods..like
public function fn1(byval x a integer, byval y as integer) as integer
fn1 = x + y
end function
I want to use this in my mfc/ atl project... I used #import to import the dll and as vb exposes a smart pointer to my interface.. I used it to call my method... but I get a runtime error when the pointer is being created...
I would like to know the low-down on using components developed in vb.. is it possible to use them without using automation ..if yes how do I go about creating a custom no automation iterface in vb!
thks guys
One more addition to the addiction of coding!
If you want a helping hand, you'll find one at the end of your arm.
|
|
|
|
|
How exactly are you creating the instance of your COM object?
Are you (error checking and handling omitted):
_MyObjectPtr pPtr("MyProject.MyObject");
pPtr->fn1(...);
or
_MyObjectPtr pPtr;
pPtr.CreateInstance(__uuidof(_MyObject));
pPtr->fn1(...);
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|