I am still not sure I understand why you need that but anyway... There're a few simple API's that you can call: GetForegroundWindow should return you a window handle of the currently active window:
Oh, so you just wanted an active window caption... I wonder how it would help you out Why don't you just put out a notification using Microsoft.WindowsCE.Forms.Notification class
#include <winuser.h> char caption[1024]; HWND win; int length;
win = GetForegroundWindow(); // hwnd length = GetWindowTextLength(win); // strlen of the caption GetWindowText(win, caption, length+1); caption[length+1] = '\0'; // set end of the string
Say, I have opened another application
like Internet explorer or Today screen. Then I want to get that that
screen name.
In my project I have to put a notification ballon when message arrives.
It has to be happened when I am not in my application and operating
other than my application. I am able to retrieve active Form name but
only with in my application. Even though I am with another
application like Today screen or with another, I am getting Form name
which is belongs to my application.
Can you please tell me is there any method to retrieve the current screen name.
like GetUIApplication and GetActive Screen from UIObject class in Java.
Get Current Screen Name?
Kelly R. Martin
Hope you can help
Thanks
donbox5
Hope you can help
Thanks
Johnny Ashcan
I am still not sure I understand why you need that but anyway... There're a few simple API's that you can call: GetForegroundWindow should return you a window handle of the currently active window:
[DllImport("coredll.dll")]
static extern IntPtr GetForegroundWindow();
and GetWindowText that will get you the window caption:
[DllImport("coredll.dll", SetLastError=true)]
static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
[DllImport("coredll.dll", SetLastError=true)]
static extern int GetWindowTextLength(IntPtr hWnd);
public string GetText(IntPtr hWnd)
{
// Allocate correct string length first
int length = GetWindowTextLength(hWnd);
StringBuilder sb = new StringBuilder(length + 1);
GetWindowText(hWnd, sb, sb.Capacity);
return sb.ToString();
}
Ice_
Oh, so you just wanted an active window caption... I wonder how it would help you out
Why don't you just put out a notification using Microsoft.WindowsCE.Forms.Notification class
WXS123
Please do not cross post. Merging...
You should be more specific. What exactly do you mean by the "current active screen"
Jagdeep Sihota
cmcharly
#include <winuser.h>
char caption[1024];
HWND win;
int length;
win = GetForegroundWindow(); // hwnd
length = GetWindowTextLength(win); // strlen of the caption
GetWindowText(win, caption, length+1);
caption[length+1] = '\0'; // set end of the string
Pretpal
Say, I have opened another application like Internet explorer or Today screen. Then I want to get that that screen name.
In my project I have to put a notification ballon when message arrives. It has to be happened when I am not in my application and operating other than my application. I am able to retrieve active Form name but only with in my application. Even though I am with another application like Today screen or with another, I am getting Form name which is belongs to my application.
Can you please tell me is there any method to retrieve the current screen name.
like GetUIApplication and GetActive Screen from UIObject class in Java.