|
Just subclass the menu and handle your own painting.
|
|
|
|
|
subclass as in inherite a class from CMenu and implement DrawItem?
if this is what you suggest, i've already done that, and still the problem remains, because after draw item, windows draw the arrows itself....
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
No, subclass and implement a handler for WM_PAINT.
Steve S
Developer for hire
|
|
|
|
|
I used the following trick:
At the end of your DrawItem(), just before returning, set an empty clipping region. This will effectively prevent Windows from drawing over your arrow.
At the beginning, reset the clipping region to ensure you can draw back.
Code:
void CMyMenu::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
pDC->SelectClipRgn(NULL);
pDC->IntersectClipRect(0,0,0,0);
}
|
|
|
|
|
Sounds interesting, will try it
thanks a lot man
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
I wrote a DLL that should serve as interface to an usb-device so that it could handle different requests from different applications. The idea was that the DLL could synchronise all requests and the device should be opened only once.
The problem with this is that although i can use some shared memory between all instances using the DLL, I can't find the good solution for the single HANDLE to my file/device.
I tried starting a thread from the first instance that would hold the handle and all instances would talk with this thread, but then the problem comes when this first instance dies it takes the thread down with it ...
I also tried using two dll's. I thought I could load the 2nd dll from within the first one so that all instances of the first dll would communicate with only one instance of the second dll, but that ain't working either.
At this moment I only can get it to work if every instance/request opens and closes the handle of the file/device over and over again, but that doesn't seem the nice way to me.
So basically my question is this: How can I keep one handle of a file in a dll so that every call made to this dll can use this handle ?
Any help would be welcome thanks
|
|
|
|
|
HANDLE s are only valid within one process, unless you explicitly make a copy with DuplicateHandle() and pass the resulting handle value to another process.
|
|
|
|
|
Thx for the help ...
I don't see how I can get it to work as GetCurrentProcess() (which i need to retrieve the process handle) returns 0xffffffff from within my dll.
Any suggestions ?
|
|
|
|
|
That's the correct vaule, GetCurrentProcess() returns a pseudo-handle that other functions interpret to mean "the current process"
|
|
|
|
|
Hi All,
I have a application, say A.exe. It launches another application, say B.exe. In B.exe i need to know the identity (pid, process name) of calling application.
Is there any way by which I can do it?
Thanks,
Suraj
Suraj Gupta
|
|
|
|
|
|
Hi,
Thanks for the reply but the link did not help.
-Suraj
Suraj Gupta
|
|
|
|
|
When you run B.exe what happen for A.exe its close?
|
|
|
|
|
You can read detaily from a.exe and use WM_COPYDATA for send this data to B.exe
|
|
|
|
|
If you have handle two A.exe window, you can use GetWindowThreadProcessId .
|
|
|
|
|
Hi,
I don't have the handle of A.exe window.
-Suraj
Suraj Gupta
|
|
|
|
|
Gupta Suraj wrote: I don't have the handle of A.exe window
What do you mean by this. Is that process is windowless ?
|
|
|
|
|
No, Exe is not windowless. Exactly the problem is that "A.exe" which is parent process, it can change mean 'A'can take any name. So i have to identify the name of the application. On that basis logic of my application will be based.
Suraj Gupta
|
|
|
|
|
Gupta Suraj wrote: Exactly the problem is that "A.exe" which is parent process, it can change mean 'A'can take any name. So i have to identify the name of the application
You need some information of process, i.e. name etc. to get its PID.
See if this[^] example helps you?
|
|
|
|
|
Couldn't you just provide them as command line arguments to B, or do you not have any control over how A invokes B?
|
|
|
|
|
I don't have the control, how A invokes B.
Suraj Gupta
|
|
|
|
|
Not sure if you still need help with this... being that I am 12 hours late.
Here is how I would do it using toolhelp32
PROCESSENTRY32 pe32 = {0};<br />
pe32.dwSize = sizeof(PROCESSENTRY32);<br />
DWORD dwMYPID=GetCurrentProcessId();<br />
DWORD PID_parent =0;<br />
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<br />
if (Process32First(hSnapshot, &pe32))<br />
{<br />
while (Process32Next(hSnapshot, &pe32))<br />
{<br />
if(pe32.th32ProcessID==dwMYPID)<br />
{<br />
PID_parent=pe32.th32ParentProcessID;<br />
}<br />
}<br />
}
At this point PID_parent contains the PID of the parent process.
You could get the filename of the parent process in another loop by doing something like:
GetFileNameFromPath(pe32.szExeFile);
Best Regards,
-Randor (Dave)
|
|
|
|
|
Thanks for the help..It helped..
Suraj Gupta
|
|
|
|
|
hi all,
i want to give the facility for my users to undo redo multiple times
in a cricheditctrl.
when user opens some project and starts editing the files and if saves the changes then also he should be able to undo the changes untill when he opened the project.
is there any any sample code for multilevel undo redo??
and how much big this task is??
and what will be the right strategy to tackle this problem??
please help me
thanks and regards
Harshal
|
|
|
|
|
Where do i look for webbrowser control to add it to my application?
Thanks in Advance
Z.A
|
|
|
|