|
I could try this do you have any reason or explaination to why this would make a difference?
Thanks,
-Steve
|
|
|
|
|
I know why you're crashing!! It happened to me too, and before I discovered why, it was driving me crazy.
Here's the reason (seriously)!! You're trying to delete pointers to memory that have already been deleted.
I discovered that the compiler will call its own destructor on the vector, which will automatically do the cleaning up for you. But later, when you try doing the cleaning up yourself, you are in effect deleting memory that has already been deleted, and that's what causing the crash. IOW, DON'T do the deleting yourself. Just don't do it. The compiler has already done it for you. (I'm talking from experience. It happened to me also.)
William
Fortes in fide et opere!
|
|
|
|
|
William,
Thanks for the insight urr ( experience from the school of hard knocks ).
-Steve
|
|
|
|
|
Hi All,
I was wondering if anyone has done any development in WTL with the CCheckListBox? I have a ListBox but want to give the functionality (and feedback to user) that they have selected multiple items.
I have tried using the macro's described in MSDN but have had no luck.
ListView_SetExtendedListViewStyle(this->m_ipCheckList.m_hWnd, LVS_EX_CHECKBOXES);
When I mean no luck, I mean that the above call has no effect on my ListBox (no check box appears next to it).
Any thoughts on what I would have to do to get something like the above going?
thanks
Bryce
|
|
|
|
|
A listbox and listview
are two different controls. Your code will work for a list view
as long as its in report mode but will not for a listbox.
This works in some code I'm currently using for a ListView.
ClistViewControl m_listView
m_listView.Attach( GetDlgItem( IDC_LIST_STATION_DATA) );
m_listView.SetExtendedListViewStyle( LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);
Correct me if I am wrong but the CCheckListBox is a mfc construct not
wtl. The following url explains how to use it
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cchecklistbox.asp
Hope this helps
|
|
|
|
|
Hi,
Thanks for your reply.
I thought there may have been another version of the CheckListBox for WTL... oh well...
How have you defined what your ClistViewControl object is?
The supplied code will not compile as there is no definition of ClistViewControl.
I tried to convert it to CListViewControlImpl m_ListView;
with below in stdafx.h
<br />
class CListViewControlImpl : public CWindowImpl<CListViewControlImpl, ClistViewControl><br />
{ DECLARE_EMPTY_MSG_MAP(); };<br />
Can you please supply your definition on your ClistViewControl.
Thanks
Bryce
|
|
|
|
|
Hi, Im using WTL version 7. In order to use the control wrapper
just add
#include <atlctrls.h> to your stdafx.h.
then you can declare CListViewCtrl m_listView;
and use it accordingly
If your still having problems i can send you a sample app.
Hope this helps
edit:
whoops the <> were lost in html.
|
|
|
|
|
Thanks for your help.
I can get it to compile now!
I did change it a little bit so that DDX can work.
in stdafx.h define like below
<br />
class CListViewCtrlImpl : public CWindowImpl<CListViewCtrlImpl, CListViewCtrl><br />
{ DECLARE_EMPTY_MSG_MAP(); };<br />
then in your class you use CListViewCtrlImpl instead of CListViewCtrl.
What method did you use to add elements to the List?
I simple demo app would be handy. please send thanks
cheers
Bryce
|
|
|
|
|
I sent you a sample app with adding of elements. Let
me know if this is what you needed.
Thanks,
Clay
|
|
|
|
|
A list box and list view control are different things. The list view has checkbox support built-in. If you want checks in a list box, you'll need to write it yourself (CCheckListBox is an MFC class, I suppose you could take that code and port it to WTL).
WTL has CCheckListViewCtrl that wraps a list view with checkboxes. Look in atlctrlx.h for its definition.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
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.
|
|
|
|
|
hi
please guide me in my problem.
when I use then generated code in VC6 in a WTL program,
Paint event is like this:
<br />
OnPaint(UINT , WPARAM , LPARAM , BOOL& )<br />
{<br />
CPaintDC dc(m_hWnd);<br />
<br />
return 0;<br />
}<br />
but when i use dc. IDE dosen't show me AutoComplation Pop-up.
I need to know the reason.
oh, i know some ways to solve:
we can use something like this
CPaintDC dc=CPaintDC(m_hWnd);
but why the IDE have troble with first one?
|
|
|
|
|
Hi,
I'm novice in STL C++ librari, so my question will be very easy.
I have a structure, for example:
typedef struct _mystruct
{
char name[256];
bool sex;
int age;
} mystruct, *pmystruct;
I can define a class based on queue STL template:
typedef queue<mystruct, list<mystruct=""> > MEMBERS_QUEUE; // This works perfectly
But I want also define a class based on deque:
typedef deque<mystruct, list<mystruct=""> > MEMBERS_DEQUE; // This doesn't work.
I suspect that I must define allocator for mystruct... What should I do to construct own class based on deque and mystruct?
Yours sincerely,
Alex Bash
|
|
|
|
|
Did you forget to include the deque header file?
#include <queue>
#include <deque>
using namespace std ;
...
typedef deque<mystruct> MEMBERS_DEQUE;
typedef queue<mystruct> MEMBERS_QUEUE;
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
I am looking how to measure the performance of the set.h file in the Standard Template Library. This is for a homework assignment. We are required to modify the set.h file with global integer variables to do the following:
I need to know how to count the number of compares and data moves that take place when loading N number of strings into a set or multiset. I tried to open up the set.h and increment counters in a few places, but I have no idea which functions do what. The set.h file is very confusing to me.
Any help is appreciated.
|
|
|
|
|
Why not use the contained object instead?
Just overload constructors and the relevant operators.
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
As they always say "kids, dont try this at home".
Or better, dont try this with the set which shipped with VC6.
Take the STLport (stlport.org[^]), its much more readable and is still a compatible implementation.
Finally moved to Brazil
|
|
|
|
|
I wasn't modifying the original set.h file. I made a copy an placed it in my project file. I simply linked to it absolutely.
Thanks for the other resource tho! Is there a set.h (or similar header file) included in that implimentation?
If it is more readable, it will definitely help.
Thanks,
Brian
|
|
|
|
|
BrianReeve wrote:
I wasn't modifying the original set.h file
Actually I was referring to trying to understand not to modifying the file.
BrianReeve wrote:
Is there a set.h (or similar header file) included in that implimentation?
You bet there is: <set>
Finally moved to Brazil
|
|
|
|
|
You can get these estimates without modifying the source code of std::set . In order to count copying and compare operations, enrich the class you're using as element in the set like follows:
class element_set
{
public:
static unsigned no_of_copying_ops;
static unsigned no_of_compare_ops;
element_set(const element_set& x)
{
++unsigned no_of_copying_ops;
...
}
bool operator<(const element_set& x)const
{
++no_of_compare_ops;
...
}
...
};
unsigned element_set::no_of_copying_ops=0;
unsigned element_set::no_of_compare_ops=0; Hope this helps, good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello
I have an ATL object which I call in my JavaScript block on the page. I can pass values to methods of object by I don't know how to modify values.
I need to modify Number variable and String from the method:
This is a method of my object:
STDMETHODIMP CRsaSign::Test(int* pLen,BSTR* pStr)
{
*pLen = 1;
return S_OK;
}
[id(28), helpstring("method Test")] HRESULT Test([in,out]int* pLen,[out]BSTR* pStr);
Here is my script block:
function GenerateKey()
{
var Signature = new String(128);
var SignatureLen = new Number(54321);
objSign.Test(SignatureLen,Signature);
alert(SignatureLen);
}
In debugger I can see value *pLen = 54321 but after
I assign it 1 I see message box with previous 54321.
Maybe someone knows where to read about it or an answer
Thanks
Vladislav
|
|
|
|
|
Javascript doesn't support [in, out] parameters.
If you are unable to use [retval] you are out of luck...
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
Hi
Thanks for answer.
I used retval - it works.
Slava
|
|
|
|
|
Hi guys,
Ok this is the dilemma I^m facing right now:
I`ve got this template class in which I want to have a static member variable which is shared by all objects of that class no matter what the template parameters were. So I figured I need to create a dummy class with that static parameter and use that.
The way in which to use that now is the question there are 2 options (as far as I can see).
1) I derive the template class from that dummy class
2) I put a member var of that dummy class in the template class.
eg:
class CDummy
{
static int m_nAnInteger;
};
//option nr 1
template<class TParam> class CATemplate: public TParam, public CDummy
{
...
};
//option nr 2
template<class TParam> class CATemplate: public TParam
{
CDummy theDummyObj;
...
};
In the one case I can refer to m_nAnInteger dircty in the other I have to refer to it through the object. In the one case I am dealing with multiple inheretance however and in the other not. So if anybody can tell me which would be the best solution feel free.
Greetz,
Davy
|
|
|
|
|
I'm not normally a great friend of the is_a vs. has_a terminology, but here I find it works and provides good guideance:
Is CATemplate a CDummy? No, it has a CDummy. Thus, composition (your option nr 2) is the answer.
Bernd
|
|
|
|
|
I am trying to figure out a way to create a simple toolbar for IE, or MOZILLA or both..
All I am looking for is to hyperlink to 2 different websites. I am trying to get 2 Main headings for each site, and a drop down list under each for different pages on that site, can anyone help, I am a 26 y/o NEWBEE to programming.
I am hoping to get it too look like this:
Main Topics as if this was the toolbar and drop down menus
CSRA Light Flyers Trenton Flyers
Home Home
Pictures News
News Pictures
Thanks!!
Eric Marenyi
|
|
|
|