Click here to Skip to main content
15,897,718 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: integrate forum Pin
Abhijit Jana24-Jul-09 0:19
professionalAbhijit Jana24-Jul-09 0:19 
GeneralRe: integrate forum Pin
Brij23-Jul-09 3:59
mentorBrij23-Jul-09 3:59 
GeneralRe: integrate forum Pin
vishal banker23-Jul-09 20:52
vishal banker23-Jul-09 20:52 
Questionshow row from database on y axis of MSchart in ASP.NET.... Pin
solo_gaurav22-Jul-09 23:39
solo_gaurav22-Jul-09 23:39 
AnswerEveryone pay attention: IT'S URGENT! Pin
leckey23-Jul-09 3:22
leckey23-Jul-09 3:22 
QuestionCommunicate between Applications using Httpcontext object. Pin
suravi22-Jul-09 23:27
suravi22-Jul-09 23:27 
AnswerRe: Communicate between Applications using Httpcontext object. Pin
Mike Ellison23-Jul-09 18:18
Mike Ellison23-Jul-09 18:18 
QuestionRead the list of all open windows in client machine Pin
Ashi77722-Jul-09 23:17
Ashi77722-Jul-09 23:17 
I need to fetch the list of open windows, which all currently open in client machine. Though i did some finding and code is working in local web server, however this does not works if this hosted in remote machine.

I am trying to access the link (application hosted in remote server) in my local machine, and while doing so this does not return me list for currently opened windows.

What should i do to make this work? Here is the code sample i am using:-

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace SIGN
{
public partial class EnumDesktopWindows : System.Web.UI.Page
{
const int MAXTITLE = 255;

private static ArrayList mTitlesList;

private delegate bool EnumDelegate(IntPtr hWnd, int lParam);

[DllImport("user32.dll", EntryPoint = "EnumDesktopWindows",
ExactSpelling = false, CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool _EnumDesktopWindows(IntPtr hDesktop,
EnumDelegate lpEnumCallbackFunction, IntPtr lParam);

[DllImport("user32.dll", EntryPoint = "GetWindowText",
ExactSpelling = false, CharSet = CharSet.Auto, SetLastError = true)]
private static extern int _GetWindowText(IntPtr hWnd,
StringBuilder lpWindowText, int nMaxCount);

protected void Page_Load(object sender, EventArgs e)
{
string[] desktopWindowsCaptions = GetDesktopWindowsCaptions();
string tmpCaption=string.Empty;
foreach (string caption in desktopWindowsCaptions)
{
tmpCaption = tmpCaption + "@@@" + caption;
}
Response.Write(tmpCaption);
}

private static bool EnumWindowsProc(IntPtr hWnd, int lParam)
{
string title = GetWindowText(hWnd);
mTitlesList.Add(title);
return true;
}

/// <summary>
/// Returns the caption of a windows by given HWND identifier.
/// </summary>
public static string GetWindowText(IntPtr hWnd)
{
StringBuilder title = new StringBuilder(MAXTITLE);
int titleLength = _GetWindowText(hWnd, title, title.Capacity + 1);
title.Length = titleLength;

return title.ToString();
}

/// <summary>
/// Returns the caption of all desktop windows.
/// </summary>
public static string[] GetDesktopWindowsCaptions()
{
mTitlesList = new ArrayList();
EnumDelegate enumfunc = new EnumDelegate(EnumWindowsProc);
IntPtr hDesktop = IntPtr.Zero; // current desktop
bool success = _EnumDesktopWindows(hDesktop, enumfunc, IntPtr.Zero);

if (success)
{
// Copy the result to string array
string[] titles = new string[mTitlesList.Count];
mTitlesList.CopyTo(titles);
return titles;
}
else
{
// Get the last Win32 error code
int errorCode = Marshal.GetLastWin32Error();

string errorMessage = String.Format(
"EnumDesktopWindows failed with code {0}.", errorCode);
throw new Exception(errorMessage);
}
}
}
}
AnswerRe: Read the list of all open windows in client machine Pin
himanshu256123-Jul-09 0:51
himanshu256123-Jul-09 0:51 
GeneralRe: Read the list of all open windows in client machine Pin
Ashi77723-Jul-09 6:10
Ashi77723-Jul-09 6:10 
AnswerRe: Read the list of all open windows in client machine Pin
DoctorMick23-Jul-09 5:16
DoctorMick23-Jul-09 5:16 
GeneralRe: Read the list of all open windows in client machine Pin
Ashi77723-Jul-09 6:10
Ashi77723-Jul-09 6:10 
Questionupdate query.. Pin
mylogics22-Jul-09 22:10
professionalmylogics22-Jul-09 22:10 
AnswerPlease Ignore : Cross Post Pin
Abhijit Jana22-Jul-09 22:52
professionalAbhijit Jana22-Jul-09 22:52 
AnswerRe: update query.. Pin
saran78923-Jul-09 1:31
saran78923-Jul-09 1:31 
GeneralRe: update query.. Pin
Abhijit Jana23-Jul-09 1:59
professionalAbhijit Jana23-Jul-09 1:59 
Questiondatatable Pin
Malik112222-Jul-09 21:58
Malik112222-Jul-09 21:58 
AnswerRe: datatable Pin
Brij22-Jul-09 22:02
mentorBrij22-Jul-09 22:02 
GeneralRe: datatable Pin
Malik112222-Jul-09 22:12
Malik112222-Jul-09 22:12 
GeneralRe: datatable Pin
Brij23-Jul-09 0:49
mentorBrij23-Jul-09 0:49 
GeneralRe: datatable Pin
Malik112222-Jul-09 22:39
Malik112222-Jul-09 22:39 
AnswerRe: datatable Pin
Vimalsoft(Pty) Ltd22-Jul-09 22:04
professionalVimalsoft(Pty) Ltd22-Jul-09 22:04 
GeneralRe: datatable Pin
Malik112222-Jul-09 22:44
Malik112222-Jul-09 22:44 
GeneralRe: datatable Pin
Vimalsoft(Pty) Ltd22-Jul-09 22:50
professionalVimalsoft(Pty) Ltd22-Jul-09 22:50 
GeneralRe: datatable Pin
Malik112222-Jul-09 23:08
Malik112222-Jul-09 23:08 

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.