Advertisement
Advertisement
| 03.07.2008 at 04:05PM PST, ID: 23224457 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 03.07.2008 at 04:38PM PST, ID: 21075281 |
| 03.07.2008 at 04:41PM PST, ID: 21075290 |
| 03.07.2008 at 04:50PM PST, ID: 21075331 |
| 03.07.2008 at 05:22PM PST, ID: 21075434 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: |
// EnumWin
//
// Enumerate all windows in the current desktop into a log file when
// a tray icon is clicked.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace EnumWin
{
public class fmEnumWin : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
NotifyIcon TrayIcon;
ContextMenu IconMenu;
private TextBox tbInfo;
private Label label1;
private Button cbCancel;
private Button cbTakeSnapshot;
bool HideIt=true;
public delegate bool EnumWinProc(int hwnd, int lParam);
[DllImport("user32.Dll")]
public static extern int EnumDesktopWindows(IntPtr DeskTopHandle,EnumWinProc x, int y);
[DllImport("User32.Dll")]
public static extern void GetWindowText(int h, StringBuilder s, int nMaxCount);
[DllImport("user32.dll")]
public static extern int GetWindowThreadProcessId(IntPtr hwnd,ref IntPtr pid);
[DllImport("user32.dll")]
public static extern int GetWindowModuleFileName(int hWnd, StringBuilder title, int size);
[DllImport("user32")]
public static extern int EnumChildWindows(int hwndParent,EnumWinProc x, int lParam);
public fmEnumWin()
{
InitializeComponent();
// Keep our window hidden until they ask for it
HideIt=true;
// Make the tray icon
IconMenu=new ContextMenu();
IconMenu.MenuItems.Add(0,new MenuItem("Enumerate",new System.EventHandler(Enum_Click)));
IconMenu.MenuItems.Add(1,new MenuItem("Ignore" ,new System.EventHandler(Dont_Click)));
IconMenu.MenuItems.Add(2,new MenuItem("Quit" ,new System.EventHandler(Quit_Click)));
TrayIcon=new NotifyIcon();
TrayIcon.Text="EnumWin";
TrayIcon.Icon=new Icon(GetType(),"EnumWin.ico");
TrayIcon.ContextMenu=IconMenu;
TrayIcon.Visible=true;
}
// //////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////// Dispose
// //////////////////////////////////////////////////////////////////
protected override void Dispose( bool disposing )
{
if (disposing)
{
if (components!=null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
// //////////////////////////////////////////////
// ////////////////////////////////////////////// InitializeComponent
// //////////////////////////////////////////////////////////////////
private void InitializeComponent()
{
this.tbInfo = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.cbCancel = new System.Windows.Forms.Button();
this.cbTakeSnapshot = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// tbInfo
//
this.tbInfo.Font = new System.Drawing.Font("Arial",12F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((byte)(0)));
this.tbInfo.Location = new System.Drawing.Point(21,44);
this.tbInfo.Multiline = true;
this.tbInfo.Name = "tbInfo";
this.tbInfo.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.tbInfo.Size = new System.Drawing.Size(362,111);
this.tbInfo.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Arial",12F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((byte)(0)));
this.label1.Location = new System.Drawing.Point(18,14);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(365,18);
this.label1.TabIndex = 1;
this.label1.Text = "If you like, you can attach some text to this snapshot.";
//
// cbCancel
//
this.cbCancel.Font = new System.Drawing.Font("Arial",12F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((byte)(0)));
this.cbCancel.Location = new System.Drawing.Point(412,94);
this.cbCancel.Name = "cbCancel";
this.cbCancel.Size = new System.Drawing.Size(120,61);
this.cbCancel.TabIndex = 2;
this.cbCancel.Text = "Cancel the snapshot";
this.cbCancel.UseVisualStyleBackColor = true;
this.cbCancel.Click += new System.EventHandler(this.CancelSnapshot);
//
// cbTakeSnapshot
//
this.cbTakeSnapshot.Location = new System.Drawing.Point(412,14);
this.cbTakeSnapshot.Name = "cbTakeSnapshot";
this.cbTakeSnapshot.Size = new System.Drawing.Size(120,61);
this.cbTakeSnapshot.TabIndex = 3;
this.cbTakeSnapshot.Text = "Take the snapshot";
this.cbTakeSnapshot.UseVisualStyleBackColor = true;
this.cbTakeSnapshot.Click += new System.EventHandler(this.TakeSnapshot);
//
// fmEnumWin
//
this.ClientSize = new System.Drawing.Size(544,172);
this.Controls.Add(this.cbTakeSnapshot);
this.Controls.Add(this.cbCancel);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbInfo);
this.Font = new System.Drawing.Font("Arial",12F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((byte)(0)));
this.Name = "fmEnumWin";
this.Text = "EnumWin";
this.ResumeLayout(false);
this.PerformLayout();
}
// /////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////// Main
// //////////////////////////////////////////////////////////////////
[STAThread]
static void Main()
{
Application.Run(new fmEnumWin());
}
// ///////////////////////////////////////////////////////
// /////////////////////////////////////////////////////// Enum_Click
// //////////////////////////////////////////////////////////////////
protected void Enum_Click(Object sender, System.EventArgs e)
{
HideIt=false;
this.Show();
this.tbInfo.Text="";
this.tbInfo.Refresh();
this.tbInfo.Focus();
return;
}
// ///////////////////////////////////////////////////////
// /////////////////////////////////////////////////////// Dont_Click
// //////////////////////////////////////////////////////////////////
protected void Dont_Click(Object sender, System.EventArgs e)
{
HideIt=true;
this.Hide();
}
// ///////////////////////////////////////////////////////
// /////////////////////////////////////////////////////// Quit_Click
// //////////////////////////////////////////////////////////////////
protected void Quit_Click(Object sender, System.EventArgs e)
{
TrayIcon.Dispose();
Application.Exit();
}
// /////////////////////////////////////////////////////
// ///////////////////////////////////////////////////// TakeSnapshot
// //////////////////////////////////////////////////////////////////
protected void TakeSnapshot(Object sender, System.EventArgs e)
{
if (this.tbInfo.Text.Length>0) PutMsg(this.tbInfo.Text);
EnumDesktopWindows(IntPtr.Zero,new EnumWinProc(EnumWindowCallBack),0);
HideIt=true;
this.Hide();
}
// ///////////////////////////////////////////////////
// /////////////////////////////////////////////////// CancelSnapshot
// //////////////////////////////////////////////////////////////////
protected void CancelSnapshot(Object sender, System.EventArgs e)
{
HideIt=true;
this.Hide();
}
// //////////////////////////////////////////////
// ////////////////////////////////////////////// EnumWindowsCallBack
// //////////////////////////////////////////////////////////////////
bool EnumWindowCallBack(int hwnd,int lParam)
{
StringBuilder WinTitle =new StringBuilder(256);
StringBuilder WinMod =new StringBuilder(256);
GetWindowModuleFileName(hwnd,WinMod,256);
GetWindowText(hwnd,WinTitle,256);
PutMsg("Window: <"+WinTitle+"> Module: <"+WinMod+">");
EnumChildWindows(hwnd,new EnumWinProc(EnumChildCallBack),0);
return true;
}
// ////////////////////////////////////////////////
// //////////////////////////////////////////////// EnumChildCallBack
// //////////////////////////////////////////////////////////////////
bool EnumChildCallBack(int hwnd,int lParam)
{
StringBuilder WinTitle=new StringBuilder(256);
GetWindowText(hwnd,WinTitle,256);
PutMsg(" Child: <"+WinTitle+">");
return true;
}
// //////////////////////////////////////////////////////
// ////////////////////////////////////////////////////// OnActivated
// //////////////////////////////////////////////////////////////////
protected override void OnActivated(EventArgs e)
{
if (HideIt) this.Hide();
}
// ////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////// OnClosing
// //////////////////////////////////////////////////////////////////
protected override void OnClosing(CancelEventArgs e)
{
TrayIcon.Dispose();
}
// /////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////// PutMsg
// ////////////////////////////////////////////////////////////////////////////
void PutMsg(string msg)
{
StreamWriter log;
DateTime now=new DateTime();
now=DateTime.Now;
log=new StreamWriter("c:\\EnumWin.log",true);
log.WriteLine(now.ToString("yyyy-MM-dd HH:mm:ss.fff ")+msg);
log.Close();
}
}
}
|
| 03.08.2008 at 02:27AM PST, ID: 21076527 |
| 03.10.2008 at 12:17AM PDT, ID: 21084529 |