Click here to Skip to main content
16,005,091 members
Home / Discussions / C#
   

C#

 
GeneralRe: Integrating C++ and C# code Pin
Heath Stewart24-Aug-04 16:12
protectorHeath Stewart24-Aug-04 16:12 
GeneralRe: Integrating C++ and C# code Pin
Tom Larsen24-Aug-04 11:19
Tom Larsen24-Aug-04 11:19 
GeneralSimple Reflenction Pin
afronaut24-Aug-04 6:24
afronaut24-Aug-04 6:24 
GeneralRe: Simple Reflenction Pin
Charlie Williams24-Aug-04 7:25
Charlie Williams24-Aug-04 7:25 
GeneralRe: Simple Reflenction Pin
afronaut24-Aug-04 8:33
afronaut24-Aug-04 8:33 
GeneralGetWindowText/GetForegroundWindow Pin
pat27088124-Aug-04 5:46
pat27088124-Aug-04 5:46 
GeneralRe: GetWindowText/GetForegroundWindow Pin
Charlie Williams24-Aug-04 6:18
Charlie Williams24-Aug-04 6:18 
GeneralRe: GetWindowText/GetForegroundWindow Pin
pat27088124-Aug-04 7:02
pat27088124-Aug-04 7:02 
This would be too good to be true. I thought now i functions because now with your hint the MethodMissingException does not occur again. But when i execute now my program with the emulator, nothing happens..?? But when i defined a normal empty project this code will work. The code fragment look as follows: (probably you know what went wrong here - i have to say slowly i' ll get depressed..)

using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.IO;

namespace SmartDeviceApplication1
{

class Test
{


static AutoResetEvent evt;
static int count = 5;

static void Main(string[] args)
{
if (args.Length > 0)
{
try
{
count = int.Parse(args[0]);
}
catch (Exception e)
{
e.ToString();
}
}

evt = new AutoResetEvent(false);
Timer t = new Timer(new TimerCallback(TimerCallback), null, 0, 5000);
evt.WaitOne();
}

static void TimerCallback(object state)
{
Console.WriteLine("Enumerating windows at {0:t}...", DateTime.Now);
string title = new string('\0', 260);

int ret = GetWindowText(GetForegroundWindow(), title, 260);
if (ret != 0)
System.Console.WriteLine(title.Substring(0, ret));


}

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

[DllImport("coredll.dll")]
private static extern IntPtr GetForegroundWindow();

}
}

Hopefully you can help mne?!Frown | :(

Regards

pat
GeneralRe: GetWindowText/GetForegroundWindow Pin
pat27088124-Aug-04 11:44
pat27088124-Aug-04 11:44 
GeneralCopying txt input from 1 form to the other Pin
steve_rm24-Aug-04 5:14
steve_rm24-Aug-04 5:14 
GeneralRe: Copying txt input from 1 form to the other Pin
Steve Maier24-Aug-04 5:26
professionalSteve Maier24-Aug-04 5:26 
GeneralRe: Copying txt input from 1 form to the other Pin
Heath Stewart24-Aug-04 8:57
protectorHeath Stewart24-Aug-04 8:57 
GeneralRe: Copying txt input from 1 form to the other Pin
steve_rm25-Aug-04 3:02
steve_rm25-Aug-04 3:02 
GeneralRe: Copying txt input from 1 form to the other Pin
LongRange.Shooter25-Aug-04 4:44
LongRange.Shooter25-Aug-04 4:44 
Generalproject options (advice) Pin
HudsonKane24-Aug-04 3:13
HudsonKane24-Aug-04 3:13 
GeneralRe: project options (advice) Pin
Steve Maier24-Aug-04 4:45
professionalSteve Maier24-Aug-04 4:45 
GeneralRe: project options (advice) Pin
HudsonKane24-Aug-04 5:33
HudsonKane24-Aug-04 5:33 
GeneralRe: project options (advice) Pin
HudsonKane24-Aug-04 5:36
HudsonKane24-Aug-04 5:36 
GeneralRe: project options (advice) Pin
Steve Maier24-Aug-04 7:13
professionalSteve Maier24-Aug-04 7:13 
GeneralRe: project options (advice) Pin
HudsonKane24-Aug-04 8:19
HudsonKane24-Aug-04 8:19 
GeneralWeb application config Pin
jzb24-Aug-04 3:09
jzb24-Aug-04 3:09 
GeneralRe: Web application config Pin
Steven Campbell24-Aug-04 3:51
Steven Campbell24-Aug-04 3:51 
QuestionHow can I pass byte array from C++ to c# ? Pin
neoksd24-Aug-04 2:31
neoksd24-Aug-04 2:31 
AnswerRe: How can I pass byte array from C++ to c# ? Pin
billb211224-Aug-04 3:31
billb211224-Aug-04 3:31 
GeneralRe: How can I pass byte array from C++ to c# ? Pin
neoksd24-Aug-04 4:16
neoksd24-Aug-04 4:16 

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.