Click here to Skip to main content
15,889,527 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# GDI+ simulation of inclined plane Pin
Gerry Schmitz16-Aug-16 6:30
mveGerry Schmitz16-Aug-16 6:30 
GeneralRe: C# GDI+ simulation of inclined plane Pin
Member 1268837716-Aug-16 6:40
Member 1268837716-Aug-16 6:40 
AnswerRe: C# GDI+ simulation of inclined plane Pin
patbob18-Aug-16 11:35
patbob18-Aug-16 11:35 
QuestionC#: what is the usage of virtual keyword in Entity Framework Pin
Tridip Bhattacharjee16-Aug-16 2:32
professionalTridip Bhattacharjee16-Aug-16 2:32 
AnswerRe: C#: what is the usage of virtual keyword in Entity Framework Pin
Richard MacCutchan16-Aug-16 3:02
mveRichard MacCutchan16-Aug-16 3:02 
AnswerRe: C#: what is the usage of virtual keyword in Entity Framework Pin
Richard Deeming16-Aug-16 4:57
mveRichard Deeming16-Aug-16 4:57 
AnswerRe: C#: what is the usage of virtual keyword in Entity Framework Pin
Gerry Schmitz16-Aug-16 6:01
mveGerry Schmitz16-Aug-16 6:01 
QuestionHow to get Windows explorer’s position using C#? Pin
srikrishnathanthri15-Aug-16 22:10
srikrishnathanthri15-Aug-16 22:10 
Hello,
I am developing an application which triggers when there is a windows explorer window in foreground. My application triggers a window (form) which will be placed on screen near the opened windows explorer (Planning to keep it just below the search option).
I am not opening the windows explorer in my code, instead user will open windows explorer and I will trigger my application whenever there is a windows explorer in foreground.
Here is my code,
C#
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;

public class Form1
{

	private void Form1_Load(System.Object sender, System.EventArgs e)
	{
		Timer1.Interval = 100;
		// timer to watch for foreground windows
		Timer1.Start();
	}

	private void Timer1_Tick(System.Object sender, System.EventArgs e)
	{
		dynamic hWnd = GetForegroundWindow();
		// get window handle of foreground window
		// a Win7 explorer window is in foreground.
		if (ClassName(hWnd) == "CabinetWClass") {
			Timer1.Stop();
			// stop this timer!
			using (Form2 f2 = new Form2()) {
				// show a popup window 
				f2.ShowDialog();
			}
		}
	}

	#region "API"
	[DllImport("user32.dll", CharSet = CharSet.Auto)]
	private static extern Int32 GetClassName(System.IntPtr hWnd, System.Text.StringBuilder lpClassName, Int32 nMaxCount);

	[DllImport("user32.dll", CharSet = CharSet.Auto)]
	private static extern IntPtr GetForegroundWindow();

	private string ClassName(IntPtr hWnd)
	{
		StringBuilder sb = new StringBuilder(256);
		GetClassName(hWnd, sb, 256);
		return sb.ToString;
	}
	public Form1()
	{
		Load += Form1_Load;
	}
	#endregion

}

But I am not getting anything to get the window position of foreground "windows explorer" window.

Is there any way to read the position of current foreground “Windows Explorer” window using .net?

modified 16-Aug-16 4:58am.

AnswerRe: How to get Windows explorer’s position using C#? Pin
OriginalGriff15-Aug-16 22:27
mveOriginalGriff15-Aug-16 22:27 
GeneralRe: How to get Windows explorer’s position using C#? Pin
srikrishnathanthri15-Aug-16 23:00
srikrishnathanthri15-Aug-16 23:00 
AnswerRe: How to get Windows explorer’s position using C#? Pin
Richard Deeming16-Aug-16 2:06
mveRichard Deeming16-Aug-16 2:06 
QuestionAutocomplete with any character in TextBox C# Pin
ThabetMicrosoft14-Aug-16 23:21
ThabetMicrosoft14-Aug-16 23:21 
AnswerRe: Autocomplete with any character in TextBox C# Pin
Pete O'Hanlon14-Aug-16 23:23
mvePete O'Hanlon14-Aug-16 23:23 
GeneralRe: Autocomplete with any character in TextBox C# Pin
ThabetMicrosoft14-Aug-16 23:35
ThabetMicrosoft14-Aug-16 23:35 
GeneralRe: Autocomplete with any character in TextBox C# Pin
Pete O'Hanlon14-Aug-16 23:38
mvePete O'Hanlon14-Aug-16 23:38 
Questionform java to c# Pin
Sikandar Javid14-Aug-16 19:52
Sikandar Javid14-Aug-16 19:52 
AnswerRe: form java to c# Pin
Simon_Whale15-Aug-16 0:34
Simon_Whale15-Aug-16 0:34 
QuestionAccounting software Pin
cupidanish14-Aug-16 17:25
cupidanish14-Aug-16 17:25 
AnswerRe: Accounting software Pin
Mycroft Holmes14-Aug-16 17:38
professionalMycroft Holmes14-Aug-16 17:38 
AnswerRe: Accounting software Pin
Richard MacCutchan14-Aug-16 21:17
mveRichard MacCutchan14-Aug-16 21:17 
AnswerRe: Accounting software Pin
Emmanuel Medina15-Aug-16 9:07
professionalEmmanuel Medina15-Aug-16 9:07 
QuestionFile comparison (byte, hash and meta) in C# Pin
Frank R. Haugen11-Aug-16 11:54
professionalFrank R. Haugen11-Aug-16 11:54 
AnswerRe: File comparison (byte, hash and meta) in C# Pin
Pete O'Hanlon11-Aug-16 22:05
mvePete O'Hanlon11-Aug-16 22:05 
AnswerRe: File comparison (byte, hash and meta) in C# Pin
Nathan Minier12-Aug-16 1:31
professionalNathan Minier12-Aug-16 1:31 
QuestionWindows Control Library Project in WinForms ... rant Pin
BillWoodruff11-Aug-16 1:13
professionalBillWoodruff11-Aug-16 1:13 

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.