Re: [Dev-C++] EURICA!: Win Shell Programming
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Nexus <nne...@ya...> - 2001-12-07 15:55:34
|
Yep it works congratis
Nexus
--- dx FX <vin...@ed...> wrote:
> After many hours of programming... I've finally
> found the solution! I have experimented with many
> styles and now I have a working code, ready to be
> used in one of my programs I am currently writing.
> Below is a copy of the test program code. The new
> function, IsAppWindow(HWND) tells if the window the
> handle points to is an Application window in the
> taskbar:
>
> #include <string>
> #include <windows.h>
> #include <iostream.h>
>
> // using namespace std;
>
> BOOL IsAppWindow(HWND);
>
> int i = 0;
>
> BOOL CALLBACK AppGetWindows(HWND hwnd, LPARAM
> lParam) {
> string str2;
> LPSTR LPString;
> LPString = new(CHAR);
>
> if (IsAppWindow(hwnd))
> {
> i = i + 1;
> if (GetWindowText(hwnd, LPString ,19) > 0) {
> cout << i << ":" << LPString << endl;
> }
> }
>
> return true;
> delete LPString;
> LPString = 0;
> }
>
> BOOL IsAppWindow(HWND hWnd)
> {
> BOOL bResult = TRUE;
> LONG nStyle;
> HWND hOwner;
> HWND hParent;
>
> // if it is a WS_CHILD or not WS_VISIBLE, fail it
> nStyle = GetWindowLong(hWnd, GWL_STYLE);
> if((nStyle & WS_CHILD) || !(nStyle & WS_VISIBLE))
> bResult = FALSE;
>
> // if the window is a WS_EX_TOOLWINDOW fail it
> nStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
> if(nStyle & WS_EX_TOOLWINDOW)
> bResult = FALSE;
>
> // If this has an owner, then only accept this
> window
> // if the parent is not accepted
> hOwner = GetWindow(hWnd, GW_OWNER);
> if(hOwner && bResult)
> bResult = !IsAppWindow(hOwner);
>
> // if it has a parent, fail
> hParent = GetParent(hWnd);
> if(hParent)
> bResult = FALSE;
>
> return bResult;
> }
>
> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE
> hPrevInstance, LPSTR lpCmdLine, int cmdShow) {
>
> if (EnumWindows(*AppGetWindows, 0)) {
> cout << endl << i << " Total Windows" << endl;
> } else {
> cout << "EnumWindows Failed /n" << endl;
> }
>
> system("PAUSE");
> }
>
> At first I didn't really know where I could start
> writing the function. But thanks to some advice to
> you folks, I now have this little test code. The
> program now outputs not only the number of windows
> but also the titles of the windows.
>
> Guys! all ya Folks! Thanks!!!!
>
> __________________________________
> www.edsamail.com
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
>
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
=====
Nexus
Nanomage.com
http://www.nanomage.com
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
|