|
Try to custom-draw the control. There should be some articles about that in the listctrl section of CP.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
hi,
I’m trying to write a plugin or anything else that will do the job to allow me to put an icon onto Internet Explorer and add some functionality to this icon.
Does anybody know how this can be done?
Cheers
Dor
|
|
|
|
|
Line for line I can't help you, but there are examples of what I think you are looking for here at CP, the greatest place on earth (virtual anyways).
Do a search for IE Toolbar.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I am making a multithreaded app that connects to a serial port and already lots of people here have been a great help!
At the moment I have several threads, two in particular (which coincidentally I have put in a seperate dll) are called RxThread and TxThread, obviously controlling the transmission and receiving of data from the serial port.
What I am trying to do is have a CEvent that I can signal with the RxThread when I have received a reply from a message sent using TxThread (to serial). I know in TxThread I want to WaitForSingleObject for a little while, and if timedout check for messages to TxThread (ie WM_QUIT, not serial messages) and Retry sending (to Serial)!
The trouble is I'm not sure how to create the CEvent object so that I can set it with the RxThread each time I get a reply, and wait for it in TxThread so I can block the thread for a little while!
Thanks for any help
-Mark
|
|
|
|
|
Option 1. The RxThread and TxThread belongs to the same process:
- create unnamed CEvent object;
- create RxThread object and pass the reference to the unnamed CEvent object;
- create TxThread object and pass the reference to the unnamed CEvent object;
Option 2: The RxThread and TxThread belongs to different processes:
Both threads must create named CEvent class object with the same name.
|
|
|
|
|
How would you create and implement styles into your own custom class? Thanks for you replies in advance.
-CDuddley
|
|
|
|
|
CDuddley wrote:
styles
Styles ???
Max.
|
|
|
|
|
I'll assume you mean styles like WS_VSCROLL and such...?
Umm...well I dunno if windows reserves all 32 bits of the DWORD nStyle paramter, but you could find out pretty easy and use bit locations that weren't used or use a DOWRD StyleEx and set your own bits using bitwise OR's.
Like this overloaded version of Create
Create(CWnd* pParent, DWORD nStyle)
{
CWnd::Create(nSytle...blah);
}
For instance if bit 17 wasn't already used by CreateWindow() you could use it to specifiy SHOW/HIDE 3D borders around custom button control.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
How do you handle them I guess is what I was wondering. Say you have an enumeration.
enum { ID_STYLE1 = 0, ID_STYLE2 = 1, ID_STYLE3 = 2 };
How do you handle the those styles in a function with the bitwize OR and AND ops? Thanks for the inputs in advance.
-CDuddley
|
|
|
|
|
Hope this is what you are after.
Serge
class MyClass
{
public:
enum Style
{
Style1 = 1 << 0, // bit 0
Style2 = 1 << 1, // bit 1
Style3 = 1 << 2, // bit 2
// so on
};
MyClass() : m_styles(0) {}
void SetStyle(Style style) {m_styles |= style;}
void ClearStyle(Style style) {m_styles &= ~style;}
void Dump() {printf("Style = 0x%08X\n", m_styles);}
private:
unsigned int m_styles;
};
void main()
{
MyClass mc;
mc.SetStyle(MyClass::Style1);
mc.Dump();
mc.SetStyle(MyClass::Style2);
mc.Dump();
mc.SetStyle(MyClass::Style3);
mc.Dump();
mc.ClearStyle(MyClass::Style3);
mc.Dump();
mc.ClearStyle(MyClass::Style2);
mc.Dump();
mc.ClearStyle(MyClass::Style1);
mc.Dump();
}
|
|
|
|
|
#define CWS_3DBORDER 0x01 //First bit of DWORD style is now used by child window style (CWS)
m_wndChild.Create(this, WS_CHILD | WS_VISIBLE | CWS_3DBORDER);
CCustom::Create(CWnd* pParent, DWORD nStyle)
{
m_b3DBorder = nStyle & MASK;
}
CCustom::OnPaint()
{
CPaintDC dc(this);
if(m_b3DBorder)
}
You may have to give the and operation the once over
I dunno how accurate my attempt at masking bits is in the above...but you should figure it out easily. I did try and give a solid example of how I would use custom flags.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I have created a control from scratch derived from CWnd.
The only problem I had was deriving from this control at first I couldn't figure out why nothing was happening after the overloadded Create function was called. I quickly figured out how t fix it, but i'm not 110% sure why?
Basically in my newly derived class I had to implement(???) each function that was implemented in the base class and call the base class version in the derived class.
Is there another way around this...?
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I would be puzzled too because, generally speaking, you do not have to do this. You only need to implement functions that are overridden in derived classes or those that are pure virtual (not implemented in the base class.)
Something strange is afoot at the Circle-K.
|
|
|
|
|
I can't figure it out...i've done nothing out of the ordinary...my computer is definetly screwing up though.
default paramters in one of my member functions compiled fine, but the classwizrd wouldn't locate the function...so I had to remove one default parameter and everything worked fine again.
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Did you really have to implement every function? CWnd has an awful lot of functions.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Hockey,
This sounds *very* strange. Send me the files if you want - I'll check them.
Regards,
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
What are the best tools available for detecting memory leaks in MFC applications? I have tried boundschecker so far, wondered if anyone could recommend any others out there...
Also, if anyone has ever seen a system error box "Required Resource Was" (thats it!), I would love to know what it means...
Cheers
|
|
|
|
|
I like Rational Purify
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Here is a link to Fortify. I believe it is free.
Also, VC++ has fairly good built-in facilities. Check MSDN for articles on this topic.
|
|
|
|
|
Rick York wrote:
Here is a link to Fortify
Thanks. I was lookin for a free tool too...
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
hi there. I have a text box that holds a string, i want to have a button so that when you press it, the string in the textbox is added to the list box. Can some please help me
Greatly Appreciated.
|
|
|
|
|
See the documentation on CEdit and CListBox . There are methods to get the string from an edit control and add it to the list box. I was tempted to write the few lines of code for you, but I'd be doing you a disservice by not putting you on the right track instead.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
No you can't...
You see, another process doesn't have access to the memory you are passing to SendMessage. You are actually lucky your SendMessage isn't crashing the other application.
Now some messages such as WM_GETTEXT have code inside of GDI32 or USER32 (whatever) that handle this case for you. But, most messages don't have this. Generally, you shouldn't be sending messages to other application unless the message has been specifically designed to support inter-process sends.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi Im trying to override the equal_range method in a class
inherited from multimap so it is non case sensitive:
#include <algorithm>
#include <string>
#include <map>
typedef std::pair<std::string, void *> Range_t;
typedef std::multimap<std::string, void *> MyMap;
typedef MyMap::iterator MyMapIterator;
bool nocase_compare(Ranger a, const Ranger b) { return a.first < b.first; }
class AMap : public MyMap {
Range_t equal_range(MyMapIterator start, MyMapIterator stop, const std::string& key) {
return std::equal_range(start, stop, key, nocase_compare);
}
};
int main()
{
AMap m;
}
But I just cant get the nocase_compare to match what equal_range needs. Help someone?
help
|
|
|
|
|
Try with bool nocase_compare(const Ranger& a,const Ranger& b) .
Also, *start and *stop must be of the same type as key (which they are currently not, I think).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|