|
Hi,
Your popup should handle WM_ACTIVATE with:
if (wParam != WA_INACTIVE)
::SetActiveWindow(::GetParent(GetSafeHwnd()));
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Thank you!
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
Hi all,
I have created one application,where i am incrmenting and decrementing values using CSpinControl.
It is incrementing and decrmenting.
Now i want to increment and decement the same using keyboard up and event press using keyboard.
void CTestDlg::OnDeltaposSpinTest(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
if (pNMUpDown->iDelta == 1)
{
m_strvalue--;
UpdateData(FALSE);
}
else
{
m_strvalue++;
UpdateData(FALSE);
}
*pResult = 0;
}
void CTestDlg::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
m_strvalue--;
UpdateData(FALSE);
CDialog::OnKeyUp(nChar, nRepCnt, nFlags);
}
void CTestDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
m_strvalue++;
UpdateData(FALSE);
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}
but it is not doing it.
can anyone help me.
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
You do not need to write a single line of code.
Just set the Arrow Keys property of the spin control to True .
|
|
|
|
|
...and it is probably not working because the dialog doesn't have keyboard focus....a control on the dialog probably does.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How to edit text in CListCtrl?
I am using InsertItem() but every time its adding new item in list control.I need to modify existing item.
I am using report style.
|
|
|
|
|
Maybe CListCtrl::SetItemText()?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
john5632 wrote: How to edit text in CListCtrl?
The answer is here[^].
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Hi All,
I am trying to create a application,where,
when i click the button and hold the mouse the value should be incrementing until i release the mouse button.
How can i do it.
I am tying with below code:
void CTestDlg::OnButtonUp()
{
UpdateData(TRUE);
m_strvalue++;
UpdateData(FALSE);
}
void CTestDlg::OnTimer(UINT nIDEvent)
{
if(flag_value==1)
{
m_strvalue++;
UpdateData(FALSE);
}
}
void CTestDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
flag_value=0;
CDialog::OnLButtonUp(nFlags, point);
}
void CTestDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
flag_value=1;
CDialog::OnLButtonDown(nFlags, point);
}
I am calling this OnLButtonUp event,but it is for whole dialog.i.e wherever i click and hold mouse on dialog the value is incrementing.
I want the same action on OnButtonUp(i.e when i click and hold the Button)
Thanks in advance
Sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
The usual way to do a repeating button is by writing a custom button control. For example, see here: http://www.codeproject.com/script/Articles/ListVersions.aspx?aid=1104[^]
You can approximate the action of an auto-repeat button by using a timer: when the timer event occurs, check if the left mouse button is down; if it is, and if the mouse is in the button rect, then increment your counter. Note that you will also have to check if the mouse leaves the button, at which point you should kill the timer.
|
|
|
|
|
How to add sub item in menu?
|
|
|
|
|
MFC? Win32?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Start by searching in MSDN[^].
The best things in life are not things.
|
|
|
|
|
john5632 wrote: How to add sub item in menu?
The answer is here[^].
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Hello,
I am C,C++/VC++ developer. I wanted to know, as in every C/C++ program there is startup function main(), who calls this function. I know OS, but I want some in detail answer. Also I wanted to know how my program actually starts, means how it is loaded in memory, who loads it and etc..
Thanks in advance.
Regards
|
|
|
|
|
This question can only be answered by looking at a specific OS. In general the OS starts the respective runtime which in turn calls into main after doing some initialization work. If you want to know the exact call stack for YOUR system, just hold on in the properly configured debugger at some point of the program and trace back to the roots... Use breakpoints on visible global objects with non-trivial constructors to see what's happening before the program enters main . At least on Windows you will be able to trace back the runtime-code as well.
Cheers,
Paul
|
|
|
|
|
The operating system takes care of loading an executable file into memory, and then starts executing it at a specific point in the code, known as the "entry point". It has a special field in the EXE file format, which obviously gets filled by the linker from the information it got from the compiler. The entry point's name may vary, in C it normally is called main, and sometimes WinMain. In other languages it may be called differently, it is basically a convention between the programmer and the compiler.
For Windows, you can get the EXE file format specification here[^]. That will keep you busy for a while!
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: The entry point's name may vary, in C it normally is called main, and sometimes WinMain.
Not quite; these are the start points for the user part of the application, and are called by the initialisation routine, which is why (Win)main() has to have a specific signature. The actual entry point of the exe is much earlier and is part of the framework library that is automatically added by the linker.
The best things in life are not things.
|
|
|
|
|
You're quite right.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
The book "Linkers & Loaders" by John R. Levine is a good resource for questions involving this and similar subject matter.
|
|
|
|
|
hello guys... I have this piece of code. Lets say my name contains 'u' one time, my code will reduce the string size by 1, exludes the 'u' from string and displays it on screen.
if (chr[i] == 'u'){
count++;
}
else{
cout<<chr[i];
}
cout<<"\nIt has "<<strlen(chr) - count<<" characters.";
Now I am using if - else here...can these two tasks be done in just if ? Like incrementing count and displaying name in if without using else.
|
|
|
|
|
Yes:
if(chr[i] != 'u' || !++count) {
cout << chr[i];
}
Whether you should do this or not is another question - it's a lot harder to understand.
|
|
|
|
|
Ummmm, definitely not advisable:
1. Whether this works or not is compiler dependend - a compiler is free to evaluate the left or right side of an || operator in whatever order it likes!
2. Like you said, hardly anyone will understand, and even those that do will doubt what it does was actially intended, and might decide to 'fix' it wrongly.
Apart from that - interesting thought; I was about to answer 'no'
|
|
|
|
|
Stefan63 wrote: 1. Whether this works or not is compiler dependend - a compiler is free to evaluate the left or right side of an || operator in whatever order it likes!
Erm... hold on a sec here... Short-circuiting IS mandated, and can only work if it's evaluated in order. It's always true for PODs.
The only caveat is, if it is a class, and that class has an overloaded && or || operator. Then, both sides will be evaluated, so that the compiler can pass the element on the right hand side as a parameter.
One (very) good reason to never, ever overload them.
At least, this is the way I understand it, and I can't imagine anything undoing that, as tons of code that did this:
if( pszString != NULL && *pszString != '\0' )
would randomly crash if *pszString was evaluated first. Course, in this example the actual comparisons can be removed, but I was trying to be explicit.
N'est pas?
-- CraigL
|
|
|
|