|
Probably
Create(UINT iD, CWnd*pWnd, const std::vector& keys)
The reason for a reference rather than not is that it prevents the creation of a temporary copy of the object in question, which might be quite expensive. The reason for const is that you're not changing it, so why not say that!
Steve S
[This signature space available for rent]
|
|
|
|
|
Okay so if I wanted to vchange "keys" I skip the const. Thats fine. My last confusion right now is this. I cant use the incoming vector in Create(), but i want to change it. SO I assign it to a member m_myClasVec, but when I make changes to m_myClasVEc they wont get transmitted through to "keys" . Whats the solution to this? It needs to be in a member vector because I want to do stuff to it outside of create....
Appreciate your help,
ns
|
|
|
|
|
In that case, you need to use pointers;
You can't use a reference as a member because you can't assign it after the constructor, so your member will have to be a pointer, and your parameter in Create will too.
Then, of course, you'll have to change all those
m_myClasVEc. into m_myClasVEc-> to make it all work again.
Steve S
[This signature space available for rent]
|
|
|
|
|
Ah....these things are so tricky..........I keep thinking I have these notions of references and pointers under control....I did see that it didnt want an unitialized reference as a member, but couldnt think of how to sidestep it...MAny thanks
Appreciate your help,
ns
|
|
|
|
|
Foe a nice read and quick reference, check out my little article[^] on the topic.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Ah ! Thanks !!! Most illuminating!
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
How to get angled brackets to show up in the forum?
Under your sig window, you have a line named "Formatting", and in this line, between code and & you have the < and >
But you can also write < or > to get them.
~RaGE();
|
|
|
|
|
thanks!!!!
Appreciate your help,
ns
|
|
|
|
|
I'm working with CTreeCtrl, and i want to add ItemDta to an item.
I do:
CString * pURL[2];<br />
pURL[0] = new CString("SITE");<br />
pURL[1] = new CString("GOOOD");<br />
m_pTree.SetItemData(hItemSite, (DWORD) pURL);<br />
It is possible to retrieve the pURL[2] with the GetItemData ?if YES , how ??
CString* pURL[2] = ??????????? m_pTree.GetItemData(hItemSite);
|
|
|
|
|
You really need something like
CString** pURL = new CString*[2];
pUrl[0] = new CString("SITE");
pUrl[1] = new CString("GOOD");
m_pTree.SetItemData(hItemSite,(DWORD)pUrl);
You can then say
CString**pRetrieved = (CString*)m_pTree.GetItemData(hItemSite);
If you need to store multiple items like this, you might consider either a class/structure, or if they are all strings, a CStringArray instead of a simple pointer, especially if you want a varying number of items.
Steve S
[This signature space available for rent]
|
|
|
|
|
Thx !
Steve S wrote:
CString**pRetrieved = (CString*)m_pTree.GetItemData(hItemSite);
i have an error here, "impossible to convert CString* to CString** "
Steve S wrote:
If you need to store multiple items like this, you might consider either a class/structure, or if they are all strings, a CStringArray instead of a simple pointer, especially if you want a varying number of items.
I just need to save 2 CString, but if you think there is a best way to do this i'm OK.
|
|
|
|
|
That should, of course, be
CString**pRetrieved = (CString**)m_pTree.GetItemData(hItemSite);
My excuse is "It's Friday"
Steve S
[This signature space available for rent]
|
|
|
|
|
Steve S wrote:
My excuse is "It's Friday"
looool you have an excuse but not me !
Thx again
|
|
|
|
|
Hi,
I would like to have some help in my project...I am making an application that takes an image from a Twain source supposing the image is in JPG format (or i can accomodate other format) and then compare it with the image already present in image database. The user enters the ID and comparison is just with one image. Kindly tell me what kinda techniques I shoud use and If you have done this kind of project then I will be glad to contact you...Leave me a message ....Urgent Please....
Clouds Drift all around bringing hope of rain but it rains only at one place. Keep your hope alive...
|
|
|
|
|
Hi, everyone!
I am a newbie of VC7.0 and I want to use
it to dDeveloping win32 console application. I
want to know whether there are some tutotrials dealing
with the following things:
1. How to develop a win32 console application
using VC7.0
2. How to debug a win32 console application using VC7.0
3. VC7.0 IDE usage related to console application
Where can I find them?
BTW: I am using VS.Net Professional Edition.
Thanks in advance,
George
|
|
|
|
|
What exactly do you want to know? There is nothing special about console programs (unless you want play with console allocation, buffers etc.). You can use Win32 App wizard to create one. You debug it same way you do any other program. The best way to try is to create one and run through VC debugger. I recommend MSDN for information and samples.
|
|
|
|
|
Thanks, AlexO buddie!
George
|
|
|
|
|
Hello,
I'm looking for Property Grid Control similar to VB6 Property Editor for my application.
Can you recommend me anything?
|
|
|
|
|
There is a pretty good one at http://www.aircom.org.
Cheers
|
|
|
|
|
I need to transmit an STL set to my Cdialog from MDIView. SO I did:
LRESULT CSTrainView::OnUDMKeywordsToView1(UINT setPtr, UINT nDummy)
{
std::set<CString>& SetSent = *setPtr;
int u = SetSent.size();
where
std::set<CString> testSet;
testSet.insert("a1");
testSet.insert("a2");
testSet.insert("a3");
POSITION pos = pDoc->GetFirstViewPosition();
while (pos!=NULL)
{
CView* pView = pDoc->GetNextView(pos);
ASSERT_VALID(pView);
;
pView->SendMessage(UDM_KEYWORDSTOVIEW1,(unsigned int)&testSet,0);
The compile error:
TrainView.cpp(1662) : error C2100: illegal indirection
TrainView.cpp(1662) : error C2440: 'type cast' : cannot convert from 'unsigned int' to 'class std::set<class CString,struct std::less<class CString>,class std::allocator<class CString> >'
What do I need to do to get this to work?
Appreciate your help,
ns
|
|
|
|
|
LRESULT CSTrainView::OnUDMKeywordsToView1(UINT setPtr, UINT nDummy)
{
std::set *SetSent = (std::set *)setPtr;
int u = SetSent->size();
rechi
|
|
|
|
|
That was the solution! Thank you so very much!!!!!
Appreciate your help,
ns
|
|
|
|
|
...your object is statically allocated. Generally, it's better to allocate it dinamically when you use PostMessage because the receiver might be some other thread.
Anyway, i'm glad to know that it worked!
rechi
|
|
|
|
|
Is a CDialog spawned from an MDI View considered a different thread? The CDialog is going to send to and receive from the parent View
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
Is a CDialog spawned from an MDI View considered a different thread?
No, this time you're safe. They are two different pictures sharing the same thread.
I think you should follow AlexO's advices now, they're highly appropriate for your job.
rechi
|
|
|
|