Click here to Skip to main content
15,916,398 members
Home / Discussions / C#
   

C#

 
GeneralRe: logg/scan open windows Pin
Nick Parker28-Jul-04 8:33
protectorNick Parker28-Jul-04 8:33 
GeneralRe: logg/scan open windows Pin
pat27088128-Jul-04 11:25
pat27088128-Jul-04 11:25 
GeneralRe: logg/scan open windows Pin
pat27088128-Jul-04 23:01
pat27088128-Jul-04 23:01 
GeneralRe: logg/scan open windows - important question! Pin
pat27088129-Jul-04 3:04
pat27088129-Jul-04 3:04 
GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart29-Jul-04 4:30
protectorHeath Stewart29-Jul-04 4:30 
GeneralRe: logg/scan open windows - important question! Pin
pat27088129-Jul-04 4:49
pat27088129-Jul-04 4:49 
GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart29-Jul-04 5:46
protectorHeath Stewart29-Jul-04 5:46 
GeneralRe: logg/scan open windows - important question! Pin
pat27088129-Jul-04 6:46
pat27088129-Jul-04 6:46 
hello,

thanks first of all for all your information!
okay i looked in the MSDN for the Timer Class and for every method it is noted if the method is supported by the .NET Compact Framework. Unfortunately at the two events tick and dispose nothing is noted - if there are supported or not...?

If the tick-event is supported by the .NET Compact Framework i would probably write the code in that way:

public class Class1 {

static System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();


private static void TimerEventProcessor(Object myObject,
EventArgs myEventArgs) {
myTimer.Enabled = true;
[llImport("user32.dll")]
private static extern bool EnumWindows(EnumWindowsProc proc, IntPtr lParam);

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

[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr GetWindowText(IntPtr hWnd,
[Out] string title, IntPtr maxCount);

public void EnumWindows()
{
EnumWindows(new EnumWindowsProc(Callback), IntPtr.Zero);
}

private bool Callback(IntPtr hWnd, IntPtr lParam)
{
string title = new string('\0', 260);
if (GetWindowText(hWnd, title, 260)!= IntPtr.Zero)
Log(string.Format("{0:x8}: {1}", hWnd, title);

...//and here i want to save the titles of the windows in a file, do i have do consider certain things? - because when more windows are open the string title has more values one time the enumWindows-method counts the open windows?
}

}

public static int Main() {

myTimer.Tick += new EventHandler(TimerEventProcessor);

myTimer.Interval = 5000;
myTimer.Start();

Application.DoEvents();
}
return 0;
}

It would be nice if you can give me feedback to this code-fragment?

thanks in advance.

yours sincerely,

patrick

GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart29-Jul-04 6:49
protectorHeath Stewart29-Jul-04 6:49 
GeneralRe: logg/scan open windows - important question! Pin
pat27088129-Jul-04 7:45
pat27088129-Jul-04 7:45 
GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart29-Jul-04 9:09
protectorHeath Stewart29-Jul-04 9:09 
GeneralRe: logg/scan open windows - important question! Pin
pat27088129-Jul-04 10:27
pat27088129-Jul-04 10:27 
GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart29-Jul-04 10:48
protectorHeath Stewart29-Jul-04 10:48 
GeneralRe: logg/scan open windows - important question! Pin
pat27088130-Jul-04 0:39
pat27088130-Jul-04 0:39 
GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart30-Jul-04 3:43
protectorHeath Stewart30-Jul-04 3:43 
GeneralRe: logg/scan open windows - important question! Pin
pat27088130-Jul-04 4:58
pat27088130-Jul-04 4:58 
GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart30-Jul-04 5:33
protectorHeath Stewart30-Jul-04 5:33 
GeneralRe: logg/scan open windows - important question! Pin
pat27088130-Jul-04 6:21
pat27088130-Jul-04 6:21 
GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart30-Jul-04 7:30
protectorHeath Stewart30-Jul-04 7:30 
GeneralRe: logg/scan open windows - important question! Pin
pat27088130-Jul-04 7:47
pat27088130-Jul-04 7:47 
GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart30-Jul-04 8:04
protectorHeath Stewart30-Jul-04 8:04 
GeneralRe: logg/scan open windows - important question! Pin
pat27088130-Jul-04 9:17
pat27088130-Jul-04 9:17 
GeneralRe: logg/scan open windows - important question! Pin
Heath Stewart30-Jul-04 9:29
protectorHeath Stewart30-Jul-04 9:29 
GeneralRe: logg/scan open windows - important question! Pin
pat27088130-Jul-04 9:52
pat27088130-Jul-04 9:52 
GeneralRe: logg/scan open windows - important question! Pin
pat2708812-Aug-04 4:28
pat2708812-Aug-04 4:28 

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.