Click here to Skip to main content
15,893,381 members
Home / Discussions / C#
   

C#

 
GeneralRe: Muslim Holiday in Georgian Calendar Pin
Luc Pattyn19-May-10 9:32
sitebuilderLuc Pattyn19-May-10 9:32 
AnswerRe: Muslim Holiday in Georgian Calendar Pin
The Man from U.N.C.L.E.19-May-10 2:41
The Man from U.N.C.L.E.19-May-10 2:41 
AnswerRe: Muslim Holiday in Georgian Calendar Pin
riced19-May-10 3:41
riced19-May-10 3:41 
QuestionUse event from C++ library in C# application Pin
Programm3r19-May-10 1:39
Programm3r19-May-10 1:39 
AnswerRe: Use event from C++ library in C# application Pin
Luc Pattyn19-May-10 1:45
sitebuilderLuc Pattyn19-May-10 1:45 
GeneralRe: Use event from C++ library in C# application Pin
Programm3r19-May-10 1:50
Programm3r19-May-10 1:50 
GeneralRe: Use event from C++ library in C# application Pin
Luc Pattyn19-May-10 2:03
sitebuilderLuc Pattyn19-May-10 2:03 
QuestionRe: Use event from C++ library in C# application Pin
Programm3r19-May-10 2:55
Programm3r19-May-10 2:55 
Hi Luc,

After some testing, I found myself back at square one, reason being that the example does not illustrate what happens within the c++ section of the code. The author makes use of standard windows methods and I have no idea what they are doing in the method. More specifically, the EnumWindows method. I must create my own method so that I can receive the X and Y coordinates (and that is what the CALLBACK is for ... i guess), thus what parameters must I send to the c++ method? I apologize for my ignorance but I'm in the dark here D'Oh! | :doh: Confused | :confused:

C++ Section
BOOL EnumWindows(
    WNDENUMPROC lpEnumFunc,
    LPARAM lParam
);

BOOL CALLBACK EnumWindowsProc(
    HWND hwnd,
    LPARAM lParam
);

BOOL IsWindowVisible( 
    HWND hWnd
);


C# Section
class DelegateExample {
    private List<IntPtr> windowList;

    public List<IntPtr> GetVisibleWindowHandles() {
        windowList=new List<IntPtr>();
        EnumWindows(new EnumWindowsProc(CollectVisibleWindows), IntPtr.Zero);
        Console.WriteLine("There are {0} visible windows", windowList.Count);
        return windowList;
    }

    private bool CollectVisibleWindows(IntPtr hWnd, IntPtr lParam) {
        if(IsWindowVisible(hWnd)) windowList.Add(hWnd);
        return true;  // please continue enumeration !
    }

    [DllImport("user32.dll")]
    private static extern int EnumWindows(LP_EnumWindowsProc ewp, IntPtr lParam); 

    private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);

    [DllImport("user32.dll")]
    private static extern bool IsWindowVisible(IntPtr hWnd);
}


Many thanks in advance.
Kind regards,
AnswerRe: Use event from C++ library in C# application Pin
Luc Pattyn19-May-10 3:10
sitebuilderLuc Pattyn19-May-10 3:10 
GeneralRe: Use event from C++ library in C# application Pin
Programm3r19-May-10 3:29
Programm3r19-May-10 3:29 
GeneralRe: Use event from C++ library in C# application Pin
Luc Pattyn19-May-10 3:57
sitebuilderLuc Pattyn19-May-10 3:57 
AnswerRe: Use event from C++ library in C# application Pin
KarstenK19-May-10 2:06
mveKarstenK19-May-10 2:06 
QuestionRe: Use event from C++ library in C# application Pin
Programm3r19-May-10 2:59
Programm3r19-May-10 2:59 
QuestionIcon.ToBitmap() bug? Pin
Tsuda Kageyu19-May-10 0:45
Tsuda Kageyu19-May-10 0:45 
AnswerRe: Icon.ToBitmap() bug? Pin
#realJSOP19-May-10 1:23
mve#realJSOP19-May-10 1:23 
GeneralRe: Icon.ToBitmap() bug? Pin
Tsuda Kageyu19-May-10 1:48
Tsuda Kageyu19-May-10 1:48 
GeneralRe: Icon.ToBitmap() bug? Pin
Henry Minute19-May-10 1:59
Henry Minute19-May-10 1:59 
GeneralRe: Icon.ToBitmap() bug? Pin
Tsuda Kageyu19-May-10 2:37
Tsuda Kageyu19-May-10 2:37 
GeneralRe: Icon.ToBitmap() bug? Pin
Henry Minute19-May-10 2:48
Henry Minute19-May-10 2:48 
AnswerRe: Icon.ToBitmap() bug? Pin
KarstenK19-May-10 2:08
mveKarstenK19-May-10 2:08 
AnswerRe: Icon.ToBitmap() bug? Pin
The Man from U.N.C.L.E.19-May-10 3:12
The Man from U.N.C.L.E.19-May-10 3:12 
GeneralRe: Icon.ToBitmap() bug? Pin
Henry Minute19-May-10 3:26
Henry Minute19-May-10 3:26 
GeneralRe: Icon.ToBitmap() bug? Pin
Tsuda Kageyu19-May-10 3:57
Tsuda Kageyu19-May-10 3:57 
GeneralRe: Icon.ToBitmap() bug? Pin
The Man from U.N.C.L.E.19-May-10 4:03
The Man from U.N.C.L.E.19-May-10 4:03 
QuestionSorted collection Pin
Chiman119-May-10 0:42
Chiman119-May-10 0:42 

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.