|
Hey Ahz,
Thanks for clearing tht up!!!!. Now assuming I use GetForegroundWindow, I get the handle to the foreground window. In my case I get the handle to the VC IDE becuase thats the window I am currently interacting.I want to have a standalone application that will run in the background and give me the handle to the foreground window.. how do i do that?. Or can I launch this exe from another program. The issue is something like this...anytime a user is interacting with a window, I need to get a handle to that window and then selectively capture some graphics from that window. How do i proceed in this case? THanks!!!
|
|
|
|
|
just run your program from the Run key or place it in all-users startup directory.
Look into using SetWindowsHookEx
|
|
|
|
|
Hey Ahz, I will try using SetWindowsHookEx and see. Thanks. Can you give me a high level idea how my program should look like..I mean how do I implement it. For ex should I have a seperate application for letting me know which is the active window and should my main prog run this exe, get the handle from it (is this possible?) use the handle to grab some image from the window and then do some processing on the image...Yeah m a confused newbie so pls bear with my inane questions! THanks again!
|
|
|
|
|
wilbur_logan wrote: I want to have a standalone application that will run in the background and give me the handle to the foreground window.. how do i do that?.
Clearly, you need to write a system wide hook. Depending on your need, it may be a keyboard hook, a mouse hook, or etc etc.
Regards,
Rajesh R. Subramanian.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
-- modified at 23:23 Wednesday 21st December, 2005
|
|
|
|
|
Thanks for all the suggestions guys!
|
|
|
|
|
|
std::vector<MyClass> foo;
int someIndex = 10;
foo.erase(foo.begin() + someIndex);
-- modified at 15:40 Wednesday 21st December, 2005
|
|
|
|
|
|
|
|
Helo!
What should i do to notify an envent to de Frame when y click left mouse on a view
thanks!
|
|
|
|
|
handle WM_LBUTTONDOWN
if using MFC: add an OnLButtonDown handler
|
|
|
|
|
thanks!
but wat i need is to resize the windowframe when i click on the client area
|
|
|
|
|
Look into the CFrameWnd::RecalcLayout function.
No shirt, no shoes, no brains, no service.
|
|
|
|
|
|
For MFC, use CListBox::InsertString() . Otherwise, send the control a LB_INSERTSTRING message.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
|
DeleteString() and InsertString()
"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!
|
|
|
|
|
|
Strings are numbered from zero to count_of_strings minus one, so to replace a string at a certain index, first delete the existing string, then insert the replacement
int SwapString(CListBox &Box, int Index, LPCTSTR NewString)
{
ASSERT (Index < Box.GetCount());
Box.DeleteString(Index);
return Box.InsertString(Index, NewString);
} If you insert the replacement string first, you then have to increase the index value before you delete the old string or else you will just end up deleting the string you just inserted.
"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!
|
|
|
|
|
be careful that your listbox is not set to "auto sort";
also, when deleting/inserting an item, the indexes will shift.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
According to MSDN[^]
[quote]
An application sends an LB_INSERTSTRING message to insert a string into a list box. Unlike the LB_ADDSTRING message, the LB_INSERTSTRING message does not cause a list with the LBS_SORT style to be sorted.
[/quote]
"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!
|
|
|
|
|
|
Crap... I tried everything, nothing worked... How do I do that "auto sort" thing? Here's my code:
void CMazzeeMapGrouperDlg::OnBnClickedMoveUp()<br />
{<br />
int initialCurSel = this->maps.GetCurSel();<br />
if (this->maps.GetCurSel() > 0)<br />
{<br />
mapGroup.MoveDown(maps.GetCurSel());<br />
<br />
CString str;<br />
this->maps.GetText(this->maps.GetCurSel() - 1, str);<br />
<br />
this->maps.DeleteString(this->maps.GetCurSel() - 1);<br />
this->maps.InsertString(this->maps.GetCurSel() - 1, str);<br />
<br />
this->maps.SetCurSel(initialCurSel + 1);<br />
}<br />
}<br />
<br />
void CMazzeeMapGrouperDlg::OnBnClickedMoveDown()<br />
{<br />
int initialCurSel = this->maps.GetCurSel();<br />
if (this->maps.GetCurSel() < this->maps.GetCount() - 1)<br />
{<br />
mapGroup.MoveDown(maps.GetCurSel());<br />
<br />
CString str;<br />
this->maps.GetText(this->maps.GetCurSel(), str);<br />
<br />
this->maps.DeleteString(this->maps.GetCurSel());<br />
this->maps.InsertString(this->maps.GetCurSel(), str);<br />
<br />
this->maps.SetCurSel(initialCurSel + 1);<br />
}<br />
}
Am I doing something wrong? Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
By "auto sort" I think he may have meant "alpha sort". If you are using a ComboBox, there is a checkbox on the Styles tab called 'Sort'. If you check this, the ComboBox will automatically AlphaSort the contents ( unchecked it Index Sorts)
|
|
|
|