|
Oh.. duh.. the vsprintf is integrating the args into the string, which isn't exactly what I was trying to do... I was TRYING to pass them streight through... but the overall goal was to have the cScreenWindow.cswPrintf print a formatted string called from the main program, so THAT is done.... overall, does what I want it to do, but doesn't answer how to pass the args along (should that ever become necessary)
But that's why it's failing on cScreen.csPrintf (which is where it is trying to integrate the bad token) and not in my routine (where I thought it was)
=->Mocs<-=
|
|
|
|
|
Hello,
On selection(Hignlighted, selected) a word in CEdit, does WINDOWS OS return any message? like Onselect or somethingelse?. How do we know which message WINDOWS OS return on any control? is there a tool to know them?
thanks
|
|
|
|
|
Have a look at Spy++, it's a tool that should be installed with Visual Studio; it's used to spy messages (and other things) in an application.
|
|
|
|
|
The Spy tool does not show what messages windows return on any control on a dialog,
it shows only window's messages,
is there a tool that i can see window's controls messages?
|
|
|
|
|
Gofur Halmurat wrote: How do we know which message WINDOWS OS return on any control?
I always keep a handy link to the control library documentation[^] (in
my online docs).
For each common control, there's a list of the messages and notifications.
For most controls, there's descriptions of how the control handles windows
messages as well.
For example, here's Edit Controls[^]
I wish I had them all memorized
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
can i use like this?
<br />
BOOL CGetSelectedIETextDlg::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if (pMsg->hwnd == GetDlgItem(IDC_EDIT1)->GetSafeHwnd() && pMsg->message == EN_CHANGE )<br />
{<br />
}<br />
return CDialog::PreTranslateMessage(pMsg);<br />
}<br />
or pMsg->message must be windows message, like WM_something?
|
|
|
|
|
Gofur Halmurat wrote: or pMsg->message must be windows message, like WM_something?
Yes. Edit control notifications are sent in WM_COMMAND messages.
When using MFC, I recommend using MFC event handling whenever possible.
That's a big benefit of MFC You should generally only need to override
PreTranslateMessage() in special circumstances, when you absolutely have to
catch a message before it gets dispatched through MFC's message handling.
ON_EN_CHANGE(IDC_EDIT1, OnEditCtrlChange)
...
void CGetSelectedIETextDlg::OnEditCtrlChange()
{
} I don't think EN_CHANGE is going to get sent when text is selected.
I could be wrong.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello, I found out that it must be like this,
thanks for everyone
if (pMsg->hwnd == GetDlgItem(IDC_EDIT1)->GetSafeHwnd() && pMsg->message == EN_KILLFOCUS )<br />
{<br />
<br />
<br />
int mm,nn;<br />
CEdit *myedit;<br />
CString sBuff;<br />
myedit = (CEdit*)GetDlgItem(IDC_EDIT1);<br />
myedit->GetSel(mm, nn); <br />
myedit->GetWindowText(sBuff);<br />
sBuff = sBuff.Mid(mm, nn - mm);<br />
AfxMessage(sBuff)<br />
}<br />
|
|
|
|
|
I guess as long as you get the desired result...
I just thought I'd mention...
EN_KILLFOCUS == WM_MOUSEMOVE == 0x0200
That means you're actually doing your processing (shown) on every
WM_MOUSEMOVE message.
Again, EN_xxx notifications come wrapped in WM_COMMAND messages.
They aren't messages themselves.
I also still wonder why bother using MFC if you're processing all messages
in PreTranslateMessage()...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am currently writing a downloading application and I was wondering if anyone had come accross a simple example of monitoring the user apps connection to the network.
I am looking to show something like the bandwidth monitor in limewire in the bottom left corner of their download window.
Any help would be fantastic, I am writing my app in Visual C++.
Kind Regards.
Alisdair Piercy
|
|
|
|
|
I have no idea what the limewire thing is or does, but if it's your application and you want to know what download rate you are getting and you have the number of bytes you received and the length of time to receive them then..... or am I missing something?
|
|
|
|
|
Yeah I am already doing this calculation to see the download rate, the question I am looking into is to see what the actuall bandwidth connection is like.
E.G.
If the network is 10 Mbps connection how much of that does the app actually have etc to show current network connection strength.
Alisdair
|
|
|
|
|
Alisdair Piercy wrote: If the network is 10 Mbps connection
Well I am still not sure I understand what you want but may this[^] will be a lucky guess
|
|
|
|
|
I'm adding exception handling to a C++ application and I get this error when I link.
What do I need to link with to resolve this external?
- BC
|
|
|
|
|
bruccutler wrote: What do I need to link with to resolve this external?
I don't know, but if I was in your situation the first thing I would do is read the documentation for CInvalidArgException
|
|
|
|
|
Is it an MFC application?
|
|
|
|
|
Yes, it is a C++/MFC application. There used to be an option to turn on Exception handling in the project file, but I can't find it.
|
|
|
|
|
last time,one administrator of this forum tell me study C++ need to work by myself.i know.....and i can taste your angry gas.but some problem need to be solved,although it is a little problem.also i can't find a answer in the MSDN.
if you don't have time,please don't be care at me.if someone have love and time,please help me.the question is :
((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8)) how do i understand it?
|
|
|
|
|
putting the byte b in msb and a in lsb of a word.
is not it?
|
|
|
|
|
The best way to understand code is usually to break it into smaller parts until they're simple enough to understand.
Let's see
<br />
( (WORD) ( <br />
( (BYTE)(a) ) | ( (WORD) ( (BYTE)(b) ) ) << 8 <br />
) ) <br />
which is like ((WORD)( x )) meaning cast x to a WORD (usually 2 byte integer type, check with sizeof(WORD); )
where x is
y | z << 8
where y is (a) cast to a BYTE (usually 8 bit unsigned) and z is b cast to a BYTE and then cast to a WORD.
Basically pair up the brakets and break down the expression into its parts, good luck
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
thanks for your chariness
|
|
|
|
|
youbo wrote: chariness
I don't even want to know what that could mean.
|
|
|
|
|
It's the opposite of "angry gas"
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I think 'Chairness' would be the measurement unit used to find out your ability to sit in a chair.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|