|
I want to set items' color individually in listview. Then I declare my listview as CContainedWindowT<clistviewctrl>, and receive NM_CUSTOMDRAW. On CDDS_PREPAINT draw stage, I return CDRF_NOTIFYITEMDRAW. On CDDS_ITEMPREPAINT draw stage, I return CDRF_NOTIFYSUBITEMDRAW. But I cannot receive CDDS_ITEMPREPAINT|CDDS_SUBITEM draw stage! Some one help me.
|
|
|
|
|
|
See Exporting from a DLL Using __declspec(dllexport) for your DLL and Importing into an Application Using __declspec(dllimport) for your client applications.
You will have to use the same header defining the class so that both sides can utilize the class. Note, you don't have to share the class implementation, just the structure, i.e., your class implementation is in a .cpp source file not as inline bodies in the .h header file.
The alternative is to use COM or .NET, which you said you couldn't do, but both preclude having to distribute a header file with your dll for consumption.
|
|
|
|
|
hi
i have an STL string object, which has a NULL char in the MIDDLE. For ex:
#include<string>
using namespace std;
....
string str = "abcdefghijklmnopqrstuvwxyz";
str[11] = 0; // str.size() still equals 26
Now i want to convert this string to _bstr_t object, retaining the NULL char and the chars after that. I tried this:
_bstr_t bstr = str.c_str();
But only first 11 chars are being copied(till NULL char). Pls help
TIA
|
|
|
|
|
Just replace all '\0' characters in your std::string with some token character which you can convert back once it's a BSTR. Remember BSTRings are 2 bytes wide in Unicode, so NULL is 0x0000.
|
|
|
|
|
basic_string , by definition, does not allow embedded 0 characters. When you stick a 0 in yourself, you're breaking the semantics of basic_string , so anything after that is not guaranteed to work.
You'll need to copy the string manually.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
Michael Dunn wrote:
basic_string, by definition, does not allow embedded 0 characters.
Where did you find this information? AFAIK, the C++ standard does not mention this, and the only function that would be affected by embedded 0 characters is c_str()
|
|
|
|
|
hmm... That was just one of those things I saw in passing and it happened to stick in my memory. Of course, I can't find it now. So I could be wrong, don't quote me (well, you already did... don't quote me elsewhere )
The closest I can find is this:basic_string::c_str
const E *c_str() const;
The member function returns a pointer to a nonmodifiable C string constructed by adding a terminating null element (E(0)) to the controlled sequence. Calling any non-const member function for *this can invalidate the pointer. That's one aspect that treats E(0) as special, E(0) being '\0' for character strings. Since the caller of c_str() can look for E(0) to mark the end of the returned string, an E(0) in the middle of the string also looks like the end.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
Yep, embedded zeros can screw c_str . However, I made this little experiment:
char buffer[] = {'h','e','l','l','o', 0, 'w', 'o', 'r', 'l', 'd'};
string s (buffer, sizeof(buffer));
cout << s << " length = " << s.length()<< endl;
And the output (VC 7.1) is:
hello world length = 11
|
|
|
|
|
The tidiest way would be to use ATL's CComBSTR rather than _bstr_t.
using namespace std;
....
string str = "abcdefghijklmnopqrstuvwxyz";
str[11] = 0; // str.size() still equals 26
CComBSTR bstr ( str.data (), str.size ()) ;
Paul
|
|
|
|
|
Iam currently developing a activeX control for my dissertation and am having problems accessing the properties of the control via VBscript.
I have added some properties via 'add properties' in the class view on VC 6.0 as in the ATL tutorial on MSDN. When I try to access the properties via VBscript, i just get a pop-up error telling me that what iam trying to access isnt a member method or property of that class...... help ne 1?
[] /\ () X
|
|
|
|
|
IIRC, I got such errors if I forgot to use the IDL directives [in] and [out, retval] where appropriate on the property IDL definitions.
--
Ich bin der böse Mann von Schweden.
|
|
|
|
|
[propget, id(3), helpstring("property yAngle")] HRESULT yAngle([out, retval] short *pVal);
[propput, id(3), helpstring("property yAngle")] HRESULT yAngle([in] short newVal);
I have this code in the IDL file that was generated by the add property wizard, I think this looks correct to what your saying?
WHat do you think?
[] /\ () X
|
|
|
|
|
They look fine to me.
--
Ich bin der böse Mann von Schweden.
|
|
|
|
|
Hi,
I'm very new to ATL and need your help. I am trying to create a com dll using ATL which should contain a tabbed control and each tab page should be able to contain many other controls (or a composite control). Please let me know how I can create a control like that. Also how do I interact with individual controls in each pages (how to initialize, modify, store etc).
Please give me some pointers or, a link to page which explains it in detail.
Thanks in advance
|
|
|
|
|
How to close ATL Dialog?
dadsadasd
|
|
|
|
|
EndDialog
--
Futue te et ipsum caballum.
|
|
|
|
|
(Sorry Chris)
Is it just me, or is the Yahoo group setup becoming more and more unreliable?
I've been trying to read the WTL group messages, and more specifically, the files area, and I keep being told it's not available.
If only it was as reliable as CP!!
Steve S
|
|
|
|
|
Hi ALL,
I am using stl list. (TCHAR*) pointers inside it. Now I want to erase the whole list along with deleteing pointers..Help me..
VikramS
|
|
|
|
|
Iterate through all the entries in the list deleting the data, then call clear on the list to empty it.
std::list<TCHAR*>::iterator i;<br />
for (i=myList.begin();i!=myList.end();++i)<br />
{<br />
delete *i;<br />
}<br />
mTests.clear();
Mike
|
|
|
|
|
|
Excellent technique
However, he'll probably need to write his own specialized functor for dealing freeing arrays. I doubt he's storing pointers to single TCHARs.
--
Futue te et ipsum caballum.
|
|
|
|
|
My TCHAR ptr's are like this
TCHAR *ptr=new TCHAR[256];
|
|
|
|
|
<br />
struct STLDeleteObject<br />
{<br />
template<typename T><br />
void operator()(const T* ptr) const<br />
{<br />
delete ptr;<br />
}<br />
};<br />
<br />
std::for_each(mylist.begin(), mylist.end(), STLDeleteObject());<br />
Type is determined automagically.
Todd Smith
|
|
|
|
|
No, delete[] should be called, since it's an array of TCHAR.
--
Futue te et ipsum caballum.
|
|
|
|