|
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
|
|
|
|
|
KevinSheedy wrote: The simpler the solution the better.
what about CFileFind MFC Class
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
Could someone help me modify the following code in order to dispaly in hex format the received bytes from a serial port.
<br />
CCom *pCom=(CCom*)ch;<br />
char *szReceive;<br />
int nr;<br />
szReceive = new char [(nr=(pCom->SizeUsedInRXBuf()+1))]; <br />
memset(szReceive,0,nr); <br />
pCom->ReadBuffer(szReceive,nr-1);<br />
CString str,toto;<br />
m_Edit.GetWindowText(str);<br />
str+=szReceive;<br />
delete [] szReceive; <br />
m_Edit.SetWindowText(str+"\r\n");
|
|
|
|
|
this is a function i use to convert BYTE arrays to hex strings. maybe it will help...
CString HexDump(BYTE *pData, DWORD dwSize, int imax)
{
CString out;
for (DWORD i=0; i < dwSize; i++)
{
CString f;
if (pData[i]<16)
f.Format("0%x", pData[i]);
else
f.Format("%x", pData[i]);
out+=f;
}
if (imax > 0 && imax < out.GetLength())
{
out = out.Left(imax);
out+="...";
}
return out;
}
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Looking at the formatting of the code reinforces my belief that using tabs for indenting should be banned. Use spaces only. No matter how careful you are to try and use tabs, somewhere in the code you are going to press the space bar 4 times rather than the tab key once. Now when the code is viewed with a different tab spacing it looks all screwy.
"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!
|
|
|
|