|
Hi.
The control class has the WM_DRAWITEM handle. It's a composite control and there is a template dialog where I put the controls, (but no dialog class), so, I want to paint with a bitmap resource the background.
Is WM_DRAWITEM the appropriate handle ?? I don't think so, because is it subclassed of what??.
WM_ERASEBKGND maybe??
I think I have a feature here, a mixed feature inside my head with all this painting stuff.
Thank you.
Demian.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Which class has the WM_DRAWITEM-handler? If it's the combobox itself, you need to reflect the WM_DRAWITEM message back to the combobox class. That is easily done with REFLECT_NOTIFICATIONS() inside the message map in the containing class/window.
If not, I bet led mike is onto something.
--
80 percent entertainment by volume
|
|
|
|
|
Hi.
The control class has the WM_DRAWITEM handle. It's a composite control and there is a template dialog where I put the controls, (but no dialog class), so, I want to paint with a bitmap resource the background.
Is WM_DRAWITEM the appropriate handle ?? I don't think so, because is it subclassed of what??.
I think I have a feature here, a mixed feature inside my head with all this painting stuff.
Thank you.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
I've created an ATL DLL that contains TCP connections inside. I use it with the Internet Explorer(HTML <object> tag+JavaScript). It runs fine. The problem arises when I open multiple instances of IE. It disturbs the previous connection. I dont know why. But when the same DLL is used with an .exe application, It doesn't care about multiple instances.It runs fine independently. How can I achieve the same with IE? btw, why is it distrubing the other instance? is it not supposed to run on its own space? Please help. I'm tired refering for this issue for long. Today I dont wanna disturb Google because he's celebrating his b'day. .
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
VuNic wrote: It disturbs the previous connection
VuNic wrote: Today I dont wanna disturb Google today
Yeah well I don't think you will find anything looking for "disturb connection" anyway. Please link to the reference that you learned that phrase from.
VuNic wrote: is it not supposed to run on its own space?
I don't know, did you develop IE to run each instance in an isolated process?
Perhaps you should have considered the "threading" model for your ATL project.
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
Disturb connection: It breaks the TCP stream. The point why I used "disturb" is that I've programmed the clients to reconnect automatically. but I really dont understand the picture when to web pages are running with the dll.
For example,I try to run another when a similar page(that loads the dll and uses it with JS) is already running,
1. Disconnects the previous connection (client1 in page1)
-------- but client1 reconnects to server again.
2. Starts a new connection (client2 in page2)
3. Now I close any one these connection.
----This closes the other connection.
But this never happens when I use the Dll with a windows application. The exes run separately without *disturbing* eachother.
led mike wrote: Perhaps you should have considered the "threading" model for your ATL project.
Can you point me to some resources that actually deals with this?
It's an appartment threaded model and I've done everything to make sure it's thread safe. Inside every worker thread I've used CoInitializeEx(NULL, COINIT_MULTITHREADED); & CoUninitialize();
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
VuNic wrote: Can you point me to some resources that actually deals with this?
With threading issues? I always liked Richter's "Advanced Windows" book.
VuNic wrote: But this never happens when I use the Dll with a windows application.
Try changing the application to use the control from two different threads, you will likely see the same behavior.
VuNic wrote: It's an appartment threaded model
That just forces the entry from the same thread.
VuNic wrote: I've done everything to make sure it's thread safe.
That does not appear to be the case.
led mike
|
|
|
|
|
Thanks mike. I'd make these changes & check it again. Btw I need to learn a lot in this department. But the time contstraint drives me to look for a magical solution immediately. I think it won't work this time until I open the book again
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
Led, I solved that one. It's not a threading issue but a design issue. I have a separate tcp class for the tcp operation and I created a global object of it for my class's use."gobal" is the culprit & me too . Now I removed it and inherited my class from the tcp class. Now the problem doesn't happen again.
|
|
|
|
|
i create a WTL program that use a COleDateTime control and i define ATLcomTime.h file in the stdafx.h when i build the project in the debug config i builded will but when i build it in the release config i have a dozen of error that fall around undeclare identifier CTime and CTimeSpan
what is the problem, i thank greatly this site and any one who give me a help in this question or previous question
samy ibraheem
|
|
|
|
|
OK, I must of missed something here, but when I use a function object in a std::for_each loop, the constructor is called once (as expected), but the destructor is called multiple times! Can someone explain why this happens, and, more importantly, how I can have the destructor called just once. For example:
#include <algorithm>
#include <vector>
#include <iostream>
struct function_object
{
function_object()
{
std::cout << "function_object : " << this << std::endl;
}
~function_object()
{
std::cout << "~function_object : " << this << std::endl;
}
void operator()(int n) const
{
std::cout << n << std::endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
std::vector<int> v;
v.push_back(1);
v.push_back(2);
std::for_each(v.begin(), v.end(), function_object());
return 0;
}
Now, when I run the above app it seems that multiple copies of the function_object struct are created, as the destructor trace code shows different pointers. However, as only one constructor is being called, I am a little confused. The output looks like this:
function_object : 0013FE4B
1
2
~function_object : 0013FE00
~function_object : 0013FE6F
~function_object : 0013FE4B
Any ideas on how to avoid this would be welcome.
Kicking squealing Gucci little piggy.
|
|
|
|
|
OK, so after digging around I realise I need to pass the function object by reference. The only syntax I can get to compile and link seems to be this:
std::vector<int> v;
v.push_back(1);
v.push_back(2);
function_object f;
std::for_each<std::vector<int>::const_iterator, function_object&>(v.begin(), v.end(), f);
Is this correct, 'cos it ain't purdy (OK, so the STL isn't pretty full stop, but...).
Man, the STL - always SO much to learn.
Kicking squealing Gucci little piggy.
|
|
|
|
|
STL passes many things by copy. Thus, while the default constructor is only called once, the copy-constructor may be called many times. To see this, modify your code slightly:
struct function_object
{
function_object()
{
std::cout << "function_object : " << this << std::endl;
}
function_object(const function_object& obj)
{
std::cout << "function_object (copy): " << this << std::endl;
}
~function_object()
{
std::cout << "~function_object : " << this << std::endl;
}
void operator()(int n) const
{
std::cout << n << std::endl;
}
};
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
I'm not sure that will even compile, but what exactly are you trying to do? That is, what is your purpose in this question?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
It compiles. And only one function object is used.
Basically, the constructor of my function object creates a new class (via a boost::smart_ptr), the operator() adds data to the class, and the destructor adds the class to a container (that is passed by reference to the function object constructor). The additional constructors/destructors in my first attempt were obviously causing problems, but passing the function object by reference seems to work. The code would look something like this:
class foo { ... };
...
struct function_object
{
boost::shared_ptr<foo> sp_;
std::vector<boost::shared_ptr<foo> >& vec_;
function_object(std::vector<boost::shared_ptr<foo> >& vec) : vec_(vec), sp_(new foo)
{
}
~function_object()
{
vec_.push_back(sp_);
}
void operator()(int n) const
{
}
};
...
std::vector<boost::shared_ptr<foo> > vec;
std::vector<int> int_vec;
int_vec.push_back(1);
int_vec.push_back(2);
function_object f(vec);
std::for_each<std::vector<int>::const_iterator, function_object&>(int_vec.begin(), int_vec.end(), f);
Kicking squealing Gucci little piggy.
|
|
|
|
|
Purely out of curiousity, what are you doing all that for? That is, what are you using sp_ for that you want 1 created to do everything in the loop?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi All,
what is WTL ? Where it is used ? How can i learn this ?
Kindly help me .
|
|
|
|
|
|
|
Samy_Ibraheem_Mo wrote: I see that WTL is more difficult than MFC in its use as it depend on templates, raw code of win32, and more advanced windows programming config
You're entitled to your opinion, but I disagree. WTL is a cleaner model than MFC, and templates don't make it any more complex than MFC. It does for developers using the UI what ATL does for developers using COM.
You can use WTL without using SDK calls, or if you wish you can use SDK calls, just like in MFC. I don't understand what you mean by 'more advanced windows programming config', so I can't really address that.
However, it is not an MFC clone, it doesn't have built-in document/view, serialization or docking window support.
The best intros to WTL are those on CodeProject, (of course).
WTL should be an essential part of a C++ developer's toolkit if they are considering developing for the Windows UI.
Steve S
Developer for hire
|
|
|
|
|
hi, all:
I've developed a bho plugin for internet explorer. It simply receive the DISPID_BEFORENAVIGATE2 event and change the address in the address bar. It's event-driven and I think it will not cost too much cpu. But to my surprise when it's loaded into IE, the cpu usage turns to be 100% and I can do nothing else.
Why it costs so much cpu and how to resolve this problem?
Thank you very much!
harald
|
|
|
|
|
Hi, guys,
do you know of any WTL code wrappers for Scintilla?
Thanks a lot,
Igor.
|
|
|
|
|
|