Click here to Skip to main content
15,910,661 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: 'for' statement can't work! Pin
hearties7-May-01 2:16
hearties7-May-01 2:16 
GeneralRe: 'for' statement can't work! Pin
#realJSOP7-May-01 2:50
professional#realJSOP7-May-01 2:50 
GeneralRe: 'for' statement can't work! Pin
hearties9-May-01 5:55
hearties9-May-01 5:55 
GeneralRe: 'for' statement can't work! Pin
Wojciech Zaremba7-May-01 2:42
Wojciech Zaremba7-May-01 2:42 
Question[q] How to control the other program's scrollbar? Pin
linugee6-May-01 22:44
linugee6-May-01 22:44 
AnswerRe: [q] How to control the other program's scrollbar? Pin
Christian Graus6-May-01 23:49
protectorChristian Graus6-May-01 23:49 
GeneralRe: [q] How to control the other program's scrollbar? Pin
Hadi Rezaee7-May-01 2:52
Hadi Rezaee7-May-01 2:52 
GeneralRe: [q] How to control the other program's scrollbar? Pin
Christian Graus7-May-01 12:38
protectorChristian Graus7-May-01 12:38 
Like this Smile | :)

BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
char* h = new char[255];
GetWindowText(hwnd,h,255);
CString text(h);

long wl = GetWindowLong(hwnd,GWL_STYLE);

CArray<cstring, cstring="">* lb = (CArray<cstring, cstring="">*)lParam;
if (text.GetLength()>0 && IsWindowVisible(hwnd) &&
text != "Program Manager" && text != "Window Popper")
lb->Add(text);
return TRUE;
}

In my code, lParam is a CArray ( nowadays I would use a vector ), and I check the title of the window to see if it's one I want to ignore and if it's visible ( not doing the visibility check gives you a gazillion hidden windows ) and then pass the title into my list. Then I do this in my main code:

CArray<cstring, cstring=""> list;
EnumWindows(EnumWindowsProc, (long)&list);

and I can do this:

CWnd *pOtherWnd = CWnd::FindWindow(NULL, name);

if I find the Window I want ( for example, I might search for the first four letters of the title to be Word, but the next three not to be Pad ), then I get the CWnd by calling FindWindow. If I know for sure something is running and it's full title, then I can just go to this step.

Christian

I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.

The early bird may get the worm, but it's the second mouse that gets the cheese.
Generalpl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
6-May-01 21:02
suss6-May-01 21:02 
GeneralRe: pl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
l a u r e n6-May-01 21:10
l a u r e n6-May-01 21:10 
GeneralRe: pl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
6-May-01 22:59
suss6-May-01 22:59 
GeneralRe: pl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
l a u r e n7-May-01 5:40
l a u r e n7-May-01 5:40 
GeneralRe: pl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
#realJSOP7-May-01 2:55
professional#realJSOP7-May-01 2:55 
GeneralRe: pl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
l a u r e n7-May-01 5:36
l a u r e n7-May-01 5:36 
GeneralRe: pl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
#realJSOP7-May-01 6:02
professional#realJSOP7-May-01 6:02 
GeneralRe: pl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
Ajit Jadhav7-May-01 7:10
Ajit Jadhav7-May-01 7:10 
GeneralRe: pl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
Ajit Jadhav7-May-01 7:26
Ajit Jadhav7-May-01 7:26 
GeneralRe: pl help me! Struggling for days. Problem with ADOs & Binary data insertion Pin
7-May-01 19:15
suss7-May-01 19:15 
GeneralTrimming spaces in a BSTR value Pin
yamini6-May-01 19:34
yamini6-May-01 19:34 
GeneralFinding coordinates of Focus rectangle Pin
6-May-01 19:33
suss6-May-01 19:33 
GeneralRe: Finding coordinates of Focus rectangle Pin
Christian Graus6-May-01 19:51
protectorChristian Graus6-May-01 19:51 
GeneralRe: Finding coordinates of Focus rectangle Pin
6-May-01 20:03
suss6-May-01 20:03 
GeneralRe: Finding coordinates of Focus rectangle Pin
6-May-01 20:38
suss6-May-01 20:38 
GeneralRe: Finding coordinates of Focus rectangle Pin
Christian Graus6-May-01 20:49
protectorChristian Graus6-May-01 20:49 
GeneralRe: Finding coordinates of Focus rectangle Pin
6-May-01 21:18
suss6-May-01 21:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.