|
hi!
For example, i have a class CMyRichEditCtrl that extends CWnd . In this class, i declare a CRichEditCtrl membre.
In CMyRichEditCtrl , i've declared a function :
BOOL CEdataRichEdit::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)<br />
{<br />
if (wParam == IDC_RICH)<br />
{<br />
}<br />
return CWnd::OnNotify(wParam, lParam, pResult);<br />
}
In my dialog (MyDialogDlg ), i've some buttons, and OnNotify function too.
Question: I want to call a function (OnNotify for example) of MyDialogDlg in <big>(1)</big> ? How can i do?
thanhks for all help!
hzocm
|
|
|
|
|
Hi again,
Still rumbling on with that old problem? What you are about to do here is not such a bad idea, but I found this in msdn which might help you more: TN062[^]
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
thanks for your help!
the old problem is fixed. If fact, we must call SetEventMask .
i saw article TN062 , but i don't know how to create a ON_NOTIFY_REFLECT with ClassWizard (or manual)?
Can u give me something more? For example : how to creat ON_NOTIFY_REFLECT , how dose that means its parameter?, and how to get it (parameters)?
thanks
hzocm
|
|
|
|
|
|
I have a CString mystring defined like this:
mystring="FFFFFFFFFFFFFFFF";//16 F
How can I convert programatically that to a LONLONG ?
Thanks for any help.
|
|
|
|
|
Good morning fardak. I've got some code for you here. Hopefully it will be less messed up than yesterday's effort:
LONGLONG result = 0;
int cursor = 0;
int length = _tcslen(mystring);
for(int i = 0; i < length; i++)
{
result <<= 4;
if(mystring[i] >= _T('0') && mystring[i] <= _T('9'))
result |= (mystring[i] - _T('0')) & 0x0F;
else if(mystring[i] >= _T('a') && mystring[i] <= _T('f'))
result |= (mystring[i] - _T('a') + 10) & 0x0F;
else if(mystring[i] >= _T('A') && mystring[i] <= _T('F'))
result |= (mystring[i] - _T('A') + 10) & 0x0F;
else if(mystring[i] != _T(' ') &&
mystring[i] != _T('\t'))
break;
cursor++;
if(cursor >= sizeof(result) * 2)
break;
} Hope this helps you.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
Good morning Joel,and thanks for your prompt answer.
My God I am not that fast programming!
I'll study your code try it and get back to you as soon as I can.
Have a nice day.
|
|
|
|
|
Just noticed one minor bug. The code should be like this:
LONGLONG result = 0;
int cursor = 0;
int length = _tcslen(mystring);
for(int i = 0; i < length; i++)
{
result <<= 4;
if(mystring[i] >= _T('0') && mystring[i] <= _T('9'))
result |= (mystring[i] - _T('0'));
else if(mystring[i] >= _T('a') && mystring[i] <= _T('f'))
result |= (mystring[i] - _T('a') + 10);
else if(mystring[i] >= _T('A') && mystring[i] <= _T('F'))
result |= (mystring[i] - _T('A') + 10);
else if(mystring[i] == _T(' ') ||
mystring[i] == _T('\t'))
continue;
else break;
cursor++;
if(cursor >= sizeof(result) * 2)
break;
} The reason I'm making all these mistakes, is that i've got no compiler to test this stuff on right now!
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
Thanks.
I did not study the code yet,but both codes compile without error and both give the same result.
I put the code in a function and added these three lines to se the result.
///////////////////////
CString message;
message.Format("%16x",result);
SetDlgItemText(IDC_MYRESULT,message);//Edit trol
///////////////////////////////////
The string I gave is "fffffffffffffff" //16 f
The answer I've got is :
ffffffff //8f !!
So it is as if the high "ffffffff" are ignored !
Maybe the loop should be extended ??
|
|
|
|
|
Yeah, that's what you'd expect. As this article[^] explains putting %x will only cause an int (32 bits) to be printed not your LONGLONG (64 bits). You could try something like this instead:
message.Format("%8x%8x", (int)(result>>32), (int)(result & 0xFFFFFFFF)); I've simply split the upper and lower dwords out, and then printed them one after another!
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
I changed the "message.Format(..)" as you suggested,and the code compiles,runs and gives the result expected(i.e both dwords are dislpayed in the edit control).
Thank you so much for your time and effort.
I am sure your skill will be soon appreciated by someone.
Good luck.
|
|
|
|
|
What about using:
message.Format("%I64x", ...);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Thank for your time.
It works perfectly well.
|
|
|
|
|
|
Thank you.
I have difficulty formatting a string to display the result.
Here is what I wrote:
//////////////////////////////////
CString message;
_int64 myNb;
myNb=_atoi64("FFFFFFFFFFFFFFFF");
message.Format("%16X",myNb);//WRONG
How the formating should be written ?
Thanks for any help.
|
|
|
|
|
|
Thank you.
I am trying to find the value of a LONLONG
and display it in decimal.
This is what I wrote
//////Convert LONGLONG to binary ///////////
TCHAR mystring[sizeof(LONGLONG)*8+1]
for(int i = 0; i < sizeof(LONGLONG)*8; i++)
mystring[i] = ((theNb >> (sizeof(LONGLONG)*8 - i - 1)) & 1) ?
_T('1') : _T('0');
mystring[sizeof(LONGLONG)*8] = 0; //mystring[64]=0:
//////////
_int64 result,partResult;
for( int n=0; n<=63; n++)
{ partResult =( mystring[63-n]*(int)pow(2,(63-n) ) );
result =result+partResult;
}
//////////// Format to display result
CString strResult;
strResult.Format("%16I64d",result);
GetDlgItem(IDC_MYRESULT)->SetWindowText(strResult);
|
|
|
|
|
(Sorry I don't know how to call back the thread to edit it )
The result should be:(if i'm not mistaking)
184 467 440 737 095 516 15
which I am not getting.
Is my formatting wrong ?
|
|
|
|
|
hi
i need some help to find the library QuartzTypeLib.dll. and from where can i get this library.plz reply me soon.
best regards.
shumyla
|
|
|
|
|
|
anybody plz tell me how to do double to char conversion in vc++?
|
|
|
|
|
You mean converting a double into a string (char*) ? You can use sprintf function like that:
char szString[255];<br />
double Value = 0.521;<br />
sprintf(szString,"%.3f",Value);
Take a look at the doc to see how to play on each parameters (for example the '.3' part above is for telling the function it has to print 3 digits after the floating point).
Hope this helps
|
|
|
|
|
Check this article .....it will help you .
www.codeproject.com/cpp/data_conversions.asp
Cheers .
|
|
|
|
|
Well, the simpilist way is to use the C-languages sprintf function:
char szBuf[512]; // assumes: number of digits (+ '\0') is < 512
sprintf(szBuf,"%f",double_value);
There are other ways to do the convertion in VC++, so explore and find them (some of them are safer, but not portable).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|