|
Hi
I am having a hook DLL. I am hooking only the explorer process using the SetWindowHookEx function. Inside the dll I am creating a window. I am able to create the window and receive the messages. When I try to release the hook explorer.exe is throwing an exception.I tried sending WM_DESTROY message to the window created when i am releasing the hooks, but its not working. Any idea on how to overcome this problem. Thanks in advance.
Thanks.
|
|
|
|
|
When I assign long text to CListCtrl, it displays only a part of them (200-300 characters - not sure) and then it cut off with no clue (without dots). I still get full text from fuction GetItemText.
CListCtrl Auto ToolTip have problem too. ToolTip length is out of screen. (My text don't have any space.)
How do I fix these? I am too lazy to override CListCtrl class.
-- modified at 22:30 Tuesday 20th December, 2005
|
|
|
|
|
Hi,
I am trying to get a modeless property sheet running.
I am using the PropertySheet() function to start the property sheet + also add PSH_MODELESS to make it a modeless dialog.
I am receiving the return value of the PropertySheet() function to get the propsheet window handle.
I think this all works fine. The dialog appears and the tabs which are in look okay as well. The thing now is that it cannot be closed anymore correctly or behaves weird.
The strange thing with the property sheet is that there is no way to pass a Message Proc to the property sheet (as far as i have seen), so i had to put some message loop myself after creating the dialog. This is how it looks:
<code>
MSG Msg;
while(GetMessage(&Msg, NULL, 0, 0))
{
if(!IsDialogMessage(mainHwnd, &Msg))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
HWND pageHandle = PropSheet_GetCurrentPageHwnd(mainHwnd);
if (pageHandle == NULL || (Msg.message == WM_COMMAND && Msg.wParam == IDCANCEL))
{
for (int i=0; i<mPropertySheets.GetLength(); ++i)
PropSheet_RemovePage(mainHwnd, 0, NULL);
EndDialog(mainHwnd, 1);
break;
}
}
}
</code>
If i don't put the "if (pageHandle == NULL..." in then i am not able to close the modeless dialog And if i put that in it sometimes works and sometimes i have to press the "OK" button 10 times till it recognizes it.
I hope anyone can help me. I would appreciate it a lot!
Thanks in advance for your time.
- Benjamin
|
|
|
|
|
Hello,
I have a c++ program that must receive windows messages from a c# program. This is a console application. Here is what my code looks like for receiving the messages...
CWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == REPLY_PICTURE_READY)
...
else if(message == REPLY_PICTURE_ERROR)
...
}
This does not compile, am I on the right track for receiving messages? Since this is a console application, and it can not skip around the code like in a gui, I would need to call this function in my code right? Or would I need to use threads? I would appreciate some input on this
Very Confused
|
|
|
|
|
Can you give more information about de application that 'sends' those window messages? Give the piece of code that sends the message. Make sure both the sender and the receiver have knowledge of the windowmessage (use RegisterWindowMessage for this).
Also, I have no experience with capturing window messages in a console program. Is this really possible? Maybe this is why you can't compile the piece of code.
If you make you receiver program a window based program (using WinMain and CreateWindow to create an initial window) Your sender program will send its message to the window of the receiver program (trough the callback function)
Anyway, if you give more information about your problem, I might be able to help you further.
kind regards,
Ward
|
|
|
|
|
>>Can you give more information about de application that 'sends' those window messages?
this is where things get complicated, the other program is window based program written in c#. The c++ program can send a message to the c# program just fine, but i'm having trouble reversing this.
>>Give the piece of code that sends the message. Make sure both the sender and the receiver have
>>knowledge of the windowmessage (use RegisterWindowMessage for this).
this is the code from the c# program that sends the message...
[DllImport("user32.dll", SetLastError=true, EntryPoint="SendMessage", CharSet=CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg,IntPtr wParam,IntPtr lParam);
SendMessage( camController_Handle, REPLY_PICTURE_READY, IntPtr.Zero, IntPtr.Zero);
the messages being sent between the programs are registered in the following manner...
UINT REPLY_PICTURE_READY = RegisterWindowMessage("REPLY_PICTURE_READY");
^this is done in the c# program too, slighty modified, but it compiles fine.
>>Also, I have no experience with capturing window messages in a console program. Is this really >>possible? Maybe this is why you can't compile the piece of code.
This could be a very real possiblity, however I could not dig up anything to prove it. The console program can send the messages just fine, so why can't it receive them? Anyone know anything about this? Or specifically how a console program can receive custom messages?
mildly frustrated
|
|
|
|
|
What is that handle 'camController_Handle' you are sending the message to? Since you want to send the message to a console program, which has no windows, I think you better broadcast your message:
SendMessage(HWND_BROADCAST, REPLY_PICTURE_READY,IntPtr.Zero, IntPtr.Zero);
But then it is unsave to 'SEND' a message to another program. Your C# application could get blocked. Better use PostMessage(HWND_BROADCAST, REPLY_PICTURE_READY,IntPtr.Zero, IntPtr.Zero);
To capture window messages in a console program, try:
<br />
#include <windows.h><br />
int main()<br />
{<br />
UINT uiREPLY_PICTURE_READY = RegisterWindowMessage("REPLY_PICTURE_READY");<br />
MSG msg;<br />
while (GetMessage(&msg, NULL, 0, 0)) <br />
{<br />
if(uiREPLY_PICTURE_READY == msg)<br />
{<br />
}<br />
}<br />
}
The above might not work (I have not tested it) since GetMessage might need at least one window in the console application. You can always create a simple hidden window using CreateWindow.
I the above tips do not work, contact me again.
kind regards,
Ward
|
|
|
|
|
Roy K wrote: This does not compile...
Why? What's the error message?
Roy K wrote: ...I would need to call this function in my code right?
No. WindowProc() is never called directly. It is called by the framework.
Roy K wrote: Since this is a console application...
So why do you have a CWnd reference?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi
I have a CSliderCtrl which I have placed within a CDilaogBar. As soon as the control gets focus a dotted rectangle appear around it. How can I get rid of this? Is there some style which I can change? I don’t get the rectangle at all when its on a plain CDialog.
Cheers
Rich
|
|
|
|
|
Handle the reflected NM_CUSTOMDRAW and then clear the CDIS_FOCUS flag from theNMCUSTOMDRAW::uItemState during the CDDS_PREPAINT stage.
|
|
|
|
|
VC6
I can't use the MFC-supplied tooltip handling (on a CFormView) because it doesn't return tooltips for a static control (with an ID) or for CDateTimeCtrl, so I've come up with my own code.
I've got my tooltips showing up, but they appear to not be "on top". By that, I mean the tool tip shows up, but it's partially hidden by any controls that might occupy the same part of the screen.
I've tried BringWindowToTop() , as well as SetWindowPos(&Cwnd::moveToTop, ...) , and even SetWindowPos(Cwnd::FromHandle(HWND_TOP), ...) .
Any help?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Are you using the WS_EX_TOOLWINDOW style as well as WS_EX_TOPMOST. Also try making it a child of the desktop so that it is not a sibling of the controls on your form.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I'm calling ::GetSysColor(COLOR_INFOBK) , and it's returning white, despite the fact that my tooltip background color has been set to yellow. Does anyone have any ideas?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Does GetSysColorBrush(COLOR_INFOBK) work?
Bernie (Boom Boom) Geoffrion worked Atlanta Flames games in the 1970s with the splendid Jiggs McDonald. One night, Geoffrion said, "Jiggs, there are only three things to hockey: shooting and skating." McDonald said, "Right, Boomer. And what's the third?" The exasperated Geoffrion replied," Jiggs, that's the three. Shooting. And. Skating."
|
|
|
|
|
Well, since this particular color definition has been available since win95, i think i can be pretty sure that function will work. BTW, I'm getting the color for the text (COLOR_INFOTEXT).
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: i think i can be pretty sure that function will work.
One would think that GetSysColor would work too, but in your case it appears to not be. GetSysColorBrush will return NULL on error, where as GetSysColor does not have a reliable error check mechanism. Also if GetSysColorBrush(COLOR_INFOBK) also returns a white brush then your system settings may not be what you think they are.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Actually, it was stupid programmer tricks. My fault entirely.
Nevermind.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi guys,
How can I change the Font for an individual item of a CTreeCtrl?
Thanks in advance.
Ivan Cachicatari Blog[^]
www.latindevelopers.com
|
|
|
|
|
The easiest option would be to handle custom drawing. The mechanism is pretty straight forward. Take a look at the NM_CUSTOMDRAW message in the MSDN. I couldn't see any articles for tree controls, but this[^] article for List Controls got me first started.
I Dream of Absolute Zero
|
|
|
|
|
<br />
SetItemState(hItem, TVIS_BOLD, TVIS_BOLD);<br />
Bernie (Boom Boom) Geoffrion worked Atlanta Flames games in the 1970s with the splendid Jiggs McDonald. One night, Geoffrion said, "Jiggs, there are only three things to hockey: shooting and skating." McDonald said, "Right, Boomer. And what's the third?" The exasperated Geoffrion replied," Jiggs, that's the three. Shooting. And. Skating."
|
|
|
|
|
|
in my application i have multiple instance of Microsoft Word document and i need to close one perticular instance of Word which has no characters in it(i.e. close empty word document out of many instances). it should be a function and return value should be 1 if there is such document of Word which is empty and 0 if there is no such document on
can any one help me out with this problem ?
-anku
anku
|
|
|
|
|
Is there an easy way to do the following:
1) find out how many files there are in a particular folder
2) find out the names of the files.
The simpler the solution the better.
thanks
KevinSheedy
|
|
|
|
|
|
Use the FindFirstFile() /FindNextFile() pair for both.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|