|
You need to manual declare message handles on your code
|
|
|
|
|
Hi,
Thanks for your reply.
I have solved the issue by providing an ID in a specific range for every dynamically created menu (ID_BASE + n), then I override the OnCommand message handler to determine what menu was clicked.
Thanks again friend, and for all of those who try to help
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Glad you found it
|
|
|
|
|
Hi
I want to add tooltips to listctrl and also different different text to each column and each items.So how can i do this ? Can any one help me please?
Thanks
nirmal
|
|
|
|
|
|
Do you need to tooltip for each items
|
|
|
|
|
I need to add username, password etc to an MS Exchange server, so that i can send mail using the account from my VC++ program
Pls share your valuable idea/suggestion/codes
Anil
|
|
|
|
|
anilFirst wrote: I need to add username, password etc to an MS Exchange server...
Do you have access to said server?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes, I did have all previlages in the machine, I just need to control Exchange Server from VC++
Anil
|
|
|
|
|
|
«▒ Programm3r ▒ » wrote: Hope this might help:
http://support.microsoft.com/?kbid=297393[^]
How is moving an Exchange mailbox helpful?
«▒ Programm3r ▒ » wrote: -- OR --
http://www.samspublishing.com/library/content.asp?b=Visual_C_PlusPlus&seqNum=62&rl=1[^]
Exactly how is dialog DDX helpful?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks
The second link you provided is different, It relate to Dynamic Data Exchange and Controls
|
|
|
|
|
Hi I am a bit puzzled over why this code works.
<br />
#include <iostream.h><br />
int* create( )<br />
{<br />
<br />
int marks = 5;<br />
int *pt=&marks;<br />
<br />
return pt;<br />
}<br />
<br />
int main( )<br />
{<br />
<br />
int *p;<br />
p=create();<br />
cout<<endl<<"The marks are : "<<*(p);<br />
return 0;<br />
<br />
} <br />
I would have thought that as you leave create(), marks goes out of scope therefore you destroy the object and *p would be pointing to an empty region of memory in main().
Thanks for any explanation.
|
|
|
|
|
not really an "empty" region, but a region that could potentially be overwritten by something else...
|
|
|
|
|
But the area of memory which holds '5' should'nt exist anymore. Isnt that right? So the pointer points to null.
|
|
|
|
|
That's not correct.
Deleting something (or letting it go out of scope) doesn't erase the memory it was using, it just marks it as unused, so the memory manager is free to reuse that memory at any point.
Basically the same as happens when you delete a file from your HDD - undelete tools can recover it, because whilst the file entry is removed from the file table on the disk, the actual data is still there, until it gets overwritten by something else.
In the case of your example, nothing is happening between your creation of the pointer, and the access of the "deleted" memory, but in a bigger example it is less likely to survive intact.
|
|
|
|
|
Hi,
minkowski wrote: I would have thought that as you leave create(), marks goes out of scope
This is correct.
minkowski wrote: therefore you destroy the object
marks is just an integer, there is not much to destroy.
minkowski wrote: and *p would be pointing to an empty region of memory in main().
*p is still pointing to the same address in memory, that now is invalid but just by chance still contains some meaningfull data. If you do some additional tasks between the call to create() and the output operation, the data at the address may change.
Regards,
Tim
|
|
|
|
|
So its dangerous to do something like I did in that example as p may access a piece of memory that does not exist?
|
|
|
|
|
minkowski wrote: So its dangerous to do something like I did in that example
Yes it is. The behaviour is undefined.
minkowski wrote: as p may access a piece of memory that does not exist?
The memory do still exist. However, the content may have change.
Regards,
Tim
|
|
|
|
|
In addition to what already been said, I would present the safe way of doing it: declare the variables as static, like this:
<code>
int* create( )
{
static int marks = 5;
static int *pt=&marks;
return pt;
}
</code>
If you declare variables static, they will be stored in the heap instead of the stack.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
That could be equally dangerous, if you ever plan on calling the create function multiple times
|
|
|
|
|
Correct me if I'm wrong, but as far as I remember, a static variable gets a fixed position on the heap.
If I'm right, what's the danger with calling the function more than once?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
int *p;
int *q;
p=create();
q=create();
(*q)++;
cout<<endl<<"The marks are : "<<*(p);
return 0;
p and q will both point to the same location, so modifying one will modify the other, which might not be the expected behaviour
|
|
|
|
|
here is an example of where your code would not work :
::printf("%d %d", *(create()), *(create()));
|
|
|
|
|
Correct me if I'm wrong, but as far as I remember, a static variable gets a fixed position on the heap.
If I'm right, what's the danger with calling the function more than once?
-- modified at 7:59 Wednesday 25th October, 2006
Now I've checked your code. It returns 5 both times.
BTW, you mean
::printf("%d %d", *(create()), *(create()));
don't you?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|