|
Having problems about right clicking on an item in a tree control. The item
that is clicked on is not the right one.
If I have three items in a tree.
Here is my problem. I click on the first item with normal click. I click on
the third item with the right click mouse. In this event I had a messagebox
telling me which item is selected, and this one comes out with the first
item no mather what. I also tried to get into the OnSelchangedItemfieldtree
function - but with no luck.
How can I right click on the third one and get its name out of it? Does
anyone know?
More relaxed the person,high is his status.
|
|
|
|
|
For handling right click override Tree control's OnRButtonDown.
In this function HitTest with the point so that u will get the selected item and then use GetItemText to get name of the item.
void CExplorerView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// To get selected item
HTREEITEM hTreeItem = GetTreeCtrl().HitTest(point);
GetTreeCtrl().SelectItem(hTreeItem);
CString cstrItemText = GetTreeCtrl().GetItemText(hTreeItem);
CTreeView::OnRButtonDown(nFlags, point);
}
Regards
Amar
|
|
|
|
|
I am unable to read .PST files using VC++. I am developing an application like Outlook.
In that I have to read the outlook mails into my application. Please give any suggesstions.
knarasimharao
|
|
|
|
|
K. narasimharao wrote: I am unable to read .PST files using VC++. I am developing an application like Outlook.
In that I have to read the outlook mails into my application. Please give any suggesstions.
Use MAPI to access the PST file.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
how to show a button which will create in seprate dll ,
in detail:
i am calling a DLL in which a button is created but i want to show this button on my main dialog please tell me what i have to do for this.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Didn't you just ask this very same question barely an hour before this one? CodeProject is seen by folks from all over the world. You must give them all a chance to read, and digest, your question. Posting the same question over and over is a sure-fire recipe to irritate folks to the point they do not want to help, even if they knew how.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
And are you thankful in this case ?
(Sorry, I just couldn't resist)
Software Zen: delete this;
|
|
|
|
|
Gary R. Wheeler wrote: And are you thankful in this case ?
Well, I am successful.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
seems that he didn't like your answer... see here[^]
|
|
|
|
|
Sorry, I do not waste my time looking at votes. They only mean anything to those that did the voting.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
i was showing that he asked in COM and ATL forums after your answer...
|
|
|
|
|
Hello everyone,
I need to work with C and C++ together in one application, for example, I need to call C++ methods from C method. And I have also used some namespace and other C++ features in my C++ method. So, is it possible to invoke C++ methods containing namespace (or other C++ specific features) from C?
I am using Visual Studio .Net. I am wondering how to make C and C++ work together. Are there any existing tutorials?
thanks in advance,
George
|
|
|
|
|
George_George wrote: So, is it possible to invoke C++ methods containing namespace (or other C++ specific features) from C?
not simply. you can put C++ inside a DLL or a COM object and let C call it that way. but otherwise, no. they are two different languages and you need some kind of language-neutral interface (ie. DLL/COM) for them to be able to interact.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks man,
I think even if I put C++ inside a DLL I have to make a .h file for C code to compile. Then, I can link with the DLL. Is that correct?
So, the further question is that, I have to define a .h file for C++ methods for C, I am wondering how to do that? Do you have any samples?
regards,
George
|
|
|
|
|
George_George wrote: I have to define a .h file for C++ methods for C
you won't be defining C++ methods, you'll be defining C functions, and exporting only C functions. the DLL can use C++ internally, but the external interfaces need to be all C. if you need to pass objects out of the C++ code, you'll need to do it using "void *" or some other trick.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks for your reply!
I have two more points,
1. I think to utilize C++ methods from C, I can also build C++ files into object files and then make C modules link with those object files. Is that method ok? Why do you say I have to build C++ methods into DLL?
2. Are there any existing samples to illustrate your methods/tricks?
regards,
George
|
|
|
|
|
1a. i don't know i've never tried.
1b. again, C and C++ are different languages and you need a language-neutral interface between them.
2. i don't have any small ones handy
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks!
My last question is that, if I want to use C++ functions from C. Do I have to build C++ functions into DLL then invoking functions from DLL? Can I just make a single project to include both C++ functions and C functions, and then build them altogether?
regards,
George
|
|
|
|
|
George_George wrote: So, is it possible to invoke C++ methods containing namespace (or other C++ specific features) from C?
Sure, as long as the C code is in a .cpp file. Just create an instance of the C++ object and use its methods just like you would from anyplace else.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks DavidCrow,
You mentioned "Just create an instance of the C++ object and use its methods just like you would from anyplace else.". Could you show me your points by a simple sample please? I do not quite understand what you said I can create an instance of a C++ class in a C file, since I can not imagine that C compiler can recognize C++ class.
Another question is that, why should I define C code in a .cpp file? I need to define it in .c file in my application.
regards,
George
|
|
|
|
|
George_George wrote: You mentioned "Just create an instance of the C++ object and use its methods just like you would from anyplace else.". Could you show me your points by a simple sample please?
If you have a class named MyClass , the following will create an instance of that class called mc :
MyClass mc; George_George wrote: I do not quite understand what you said I can create an instance of a C++ class in a C file...
The file will have to have a .cpp extension. Otherwise, the compiler will not recognize any of the C++ code contained within.
George_George wrote: ...since I can not imagine that C compiler can recognize C++ class.
Of course.
George_George wrote: Another question is that, why should I define C code in a .cpp file? I need to define it in .c file in my application.
You seem to have a bit of confusion between the two. C++ is everything that C is plus classes. So, I could put the following in a .cpp file:
void main( void )
{
int x = 5;
printf("%d\n", x);
return;
} Is that C or C++ code?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks,
DavidCrow wrote: You seem to have a bit of confusion between the two. C++ is everything that C is plus classes. So, I could put the following in a .cpp file:
void main( void ){ int x = 5; printf("%d\n", x); return;}
Is that C or C++ code?
My current situation is that, I am writing a C application to invoke C++ functions inside a DLL file. I do not have the source codes of the DLL file so that I can not add main method into C++ functions. As you mentioned that, I have to add main method to C++ modules. Do you have any ideas or comments to my situation?
Another point is that, if you think C and C++ are the same (or C is C++), then I think you can add main method to anywhere since C is C++. Why do you mean that I have to add main method to C++ module?
DavidCrow wrote: If you have a class named MyClass, the following will create an instance of that class called mc:
MyClass mc;
You mean if there is a public class in C++ and I can use the members/functions of this class in C directly by creating an instance of this class?
regards,
George
|
|
|
|
|
what is the diffrence between
return (SUCCESS) and return SUCCESS. And
Delete (this) and Delete this;
is it Only syntactic diffrence or any significent difference in it?
Guide me ?
krishna
|
|
|
|
|
It is just syntaxic difference. It is like in calculation:
1 + 1 is the same as
(1) + (1) and the same as
(1 + 1)
Sometimes it is needed to put '( )' but when it is not needed, there is no difference.
Or at least, no of what I'm aware of
|
|
|
|
|