|
|
Hello,
I get the handle of a window on a other process with the function FindWindowEx. How i can get the ThreadId of this handle on Windows XP.
I have tried to use "NtQueryInformationThread" but I will get Access Denied. Then i have tried to change the access restriction of the handle with API "SetSecurityInfo(handle, ...)" but I get the error "The handle is invalid". But the handle is valid. I' getting crazy now , nothing will work.
If you have a solution to get the handle I'm very happy.
I need the TreadID to setup "SetWindowsHookEx()" and capture (hook) then Messages to this window.
May you know a simpler solution to capture messages of a window.
Thank you very very much.
regards
michi
|
|
|
|
|
Have you tried GetWindowThreadProcessId() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you,
this is a easy and nice solution
Regards
Manfred
|
|
|
|
|
hi,
I have an mfc app which creates menus dynamically as needed, I use InserMenu for this purpose, but I dont know where/how to write message handlers for these dynamic menus.
Any Ideas??
Thanks,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
If you're using TrackPopupMenu to open the dynamic menu, just provide the pointer to your dialog in it's 4th parameter, then write message handlers in your dialog as you would for a regular menu
(the MSDN page for TrackPopupMenu gives an example)
|
|
|
|
|
maybe this[^] can help...
|
|
|
|
|
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?
|
|
|
|