|
Can you please tell me with example.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
void CNumericEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
char szBuffer[100] = {0};
short int nCounter = 0;
short int iTemp = 0;
int iStartChar = 0;
int iEndChar = 0;
if(nChar == '-')
{
return;
}
if(nChar != VK_BACK && nChar != VK_TAB)
{
if(nChar != '.' && (nChar < '0' || nChar > '9'))
{
return;
}
GetWindowText(szBuffer, sizeof(szBuffer));
if(nChar == '.')
{
GetSel(iStartChar, iEndChar);
if(iStartChar != 0 || iEndChar != static_cast<int>(strlen(szBuffer)))
{
for(nCounter = 0; szBuffer[nCounter] != NULL; nCounter++)
{
if(szBuffer[nCounter] == '.')
{
return;
}
}
}
}
}
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
|
|
|
|
|
this error comes out when i use the above code.
error C2248: 'CWnd::OnChar' : cannot access protected member declared in class 'CWnd'
1> C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin.h(2631) : see declaration of 'CWnd::OnChar'
1> C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin.h(1967) : see declaration of 'CWnd'
1>
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
|
How can i do this?
I m using edit box and other controls on Dialog box,so the base class is CDialog.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Derive a new class from CEdit and override OnChar.
In dialog create a member variable of new Class derived from CEdit.
In DoDataExchange of dialog write
DDX_Control(pDX, <edit control="" id="">, <object of="" derived="" cedit="" class="">);
If you still do not get please see articals which is available in codeproject.
|
|
|
|
|
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
|
Have you considered a masked edit control?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello everyone,
Am I correct for the understanding of the following three questions about CoInitialize/CoUninitialize?
1.
For each thread which utilizes COM, we need to call CoInitialize/CoUninitialize. Not for each process.
2.
There is no harm to call CoUninitialize even if we do not call CoInitialize? And if we call CoInitialize N times on a thread, we need to call CoUninitialize the same of times (N times, not only 1 time) on a thread to release all resources?
3.
CoInitializeEx will invoke CoInitialize?
thanks in advance,
George
|
|
|
|
|
George_George wrote: For each thread which utilizes COM, we need to call CoInitialize/CoUninitialize. Not for each process.
yes
George_George wrote: And if we call CoInitialize N times on a thread, we need to call CoUninitialize the same of times (N times, not only 1 time) on a thread to release all resources?
yes
George_George wrote: CoInitializeEx will invoke CoInitialize?
No. But CoInitialize calls CoInitializeEx with concurrency model as single-thread apartment.
|
|
|
|
|
Thanks Naveen,
I have tried call CoInitialize multiple times will result in fail? Could you reproduce it?
regards,
George
|
|
|
|
|
Fail means it return E_FAIL ? I hope you have seen the below lines in MSDN
"Typically, the COM library is initialized on a thread only once. Subsequent calls to CoInitialize or CoInitializeEx on the same thread will succeed, as long as they do not attempt to change the concurrency model, but will return S_FALSE"
|
|
|
|
|
Thanks nave,
Question answered. This is what I mean.
regards,
George
|
|
|
|
|
1 and 2 are yes and 3: from th MSDN
New applications should call CoInitializeEx instead of CoInitialize.
|
|
|
|
|
Great reply, thanks Hamid!
regards,
George
|
|
|
|
|
It's said that 32 bit cpu accesses 32 bit data most efficiently.
So does 64 bit.
Is there any type that is always equal to the cpu bit size? (Maybe it should be the data bus size, I'm sure whether they are always equal).
|
|
|
|
|
followait wrote: Is there any type that is always equal to the cpu bit size?
int
modified on Monday, June 30, 2008 12:35 AM
|
|
|
|
|
No, it is 4 bytes in both 32-bit and 64-bit machines.
|
|
|
|
|
Sorry you are right....
|
|
|
|
|
Try DWORD_PTR
« Superman »
|
|
|
|
|
__int3264
LONG_PTR
DWORD_PTR
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
size_t
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Hi,
This maybe a wtl question however an mfc answer may probably help me. My question is that lets say I created a tree
<br />
son = Father.InsertItem ( _T("Main"), TVI_ROOT, TVI_LAST );<br />
son.AddTail ( _T("Sub1"), 0 );<br />
son.AddTail ( _T("Sub2"), 0 )<br />
Now this will look some thing like this
Main
-Sub1
-Sub2
What I need to do is if a user highlights a Tail how can I know which one is it? for example the user highlights Sub1 how can I know that?
Thanks,
Jayjay
|
|
|
|
|
monsieur_jj wrote: What I need to do is if a user highlights a Tail how can I know which one is it?
When ever user changes the selection in the tree control, a TVN_SELCHANGED message is send to the parent window. The lparam of this message is pointer to NMTREEVIEW strcture and the "itemNew" memeber of this structure is the newly selected item.
|
|
|
|