Click here to Skip to main content
15,922,533 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL or MySQL with c# Pin
Abdul Rahman Hamidy3-Jan-09 2:35
Abdul Rahman Hamidy3-Jan-09 2:35 
AnswerRe: SQL or MySQL with c# Pin
Aman Bhullar3-Jan-09 5:21
Aman Bhullar3-Jan-09 5:21 
AnswerRe: SQL or MySQL with c# Pin
N a v a n e e t h3-Jan-09 16:14
N a v a n e e t h3-Jan-09 16:14 
GeneralRe: SQL or MySQL with c# Pin
Abdul Rahman Hamidy4-Jan-09 0:30
Abdul Rahman Hamidy4-Jan-09 0:30 
AnswerRe: SQL or MySQL with c# Pin
Wendelius4-Jan-09 1:20
mentorWendelius4-Jan-09 1:20 
GeneralRe: SQL or MySQL with c# Pin
Abdul Rahman Hamidy4-Jan-09 22:57
Abdul Rahman Hamidy4-Jan-09 22:57 
GeneralRe: SQL or MySQL with c# Pin
Wendelius5-Jan-09 6:06
mentorWendelius5-Jan-09 6:06 
QuestionAbout PostMessage() API Pin
tr_thorn3-Jan-09 1:01
tr_thorn3-Jan-09 1:01 
Hi i wanna do a bot program for a game.This program send key strokes to Game Application.But i got a problem.I only wanna send key to Game Application Window Handle not another active window.I write a class for this but i havent get worked it.Its sending keys only notepad not to game or any other window.Can ya help me for this ? Iam sending ya codes below ; and tell me where is my problem. thanx for ur help.

class SendKeySample
{
private static Int32 WM_KEYDOWN = 0x100;
private static Int32 WM_KEYUP = 0x101;

[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = true)]
static extern bool PostMessage(IntPtr hWnd, int Msg, System.Windows.Forms.Keys wParam, int lParam);

[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

public static IntPtr FindWindow(string windowName)
{
foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses())
{
if (p.MainWindowHandle != IntPtr.Zero && p.MainWindowTitle.ToLower() == windowName.ToLower())
return p.MainWindowHandle;
}

return IntPtr.Zero;
}

public static IntPtr FindWindow(IntPtr parent, string childClassName)
{
return FindWindowEx(parent, IntPtr.Zero, childClassName, string.Empty);
}

public static void SendKey(IntPtr hWnd, System.Windows.Forms.Keys key)
{
PostMessage(hWnd, WM_KEYDOWN, key, 0);

}
}


Calling Code ;

var hWnd = SendKeySample.FindWindow("Untitled - Notepad");
var editBox = SendKeySample.FindWindow(hWnd, "edit");

SendKeySample.SendKey(editBox, Keys.A);
QuestionWindows Users Pin
yogesh_kumar_agarwal3-Jan-09 0:32
yogesh_kumar_agarwal3-Jan-09 0:32 
AnswerRe: Windows Users Pin
pikmindoctor3-Jan-09 4:25
pikmindoctor3-Jan-09 4:25 
GeneralRe: Windows Users Pin
EliottA3-Jan-09 10:50
EliottA3-Jan-09 10:50 
GeneralRe: Windows Users Pin
yogesh_kumar_agarwal5-Jan-09 23:33
yogesh_kumar_agarwal5-Jan-09 23:33 
AnswerRe: Windows Users Pin
Eddy Vluggen3-Jan-09 23:10
professionalEddy Vluggen3-Jan-09 23:10 
Questionadd control Pin
hamidhakimi2-Jan-09 18:52
hamidhakimi2-Jan-09 18:52 
AnswerRe: add control Pin
Giorgi Dalakishvili2-Jan-09 20:53
mentorGiorgi Dalakishvili2-Jan-09 20:53 
Questionconvert pdf to doc Pin
inzibharti2-Jan-09 18:15
inzibharti2-Jan-09 18:15 
AnswerRe: convert pdf to doc Pin
Dave Kreskowiak2-Jan-09 19:55
mveDave Kreskowiak2-Jan-09 19:55 
QuestionHow To Install .net Framework Without Wizard Pin
Joe Rozario2-Jan-09 17:23
Joe Rozario2-Jan-09 17:23 
AnswerRe: How To Install .net Framework Without Wizard Pin
N a v a n e e t h2-Jan-09 17:35
N a v a n e e t h2-Jan-09 17:35 
AnswerRe: How To Install .net Framework Without Wizard Pin
Dave Kreskowiak2-Jan-09 19:54
mveDave Kreskowiak2-Jan-09 19:54 
GeneralRe: How To Install .net Framework Without Wizard Pin
N a v a n e e t h3-Jan-09 1:05
N a v a n e e t h3-Jan-09 1:05 
AnswerRe: How To Install .net Framework Without Wizard Pin
#realJSOP2-Jan-09 23:56
professional#realJSOP2-Jan-09 23:56 
QuestionGetting ToolStrip button's CheckState to reflect text formatting Pin
Member 26305032-Jan-09 13:54
Member 26305032-Jan-09 13:54 
AnswerRe: Getting ToolStrip button's CheckState to reflect text formatting Pin
Eddy Vluggen2-Jan-09 23:03
professionalEddy Vluggen2-Jan-09 23:03 
AnswerRe: Getting ToolStrip button's CheckState to reflect text formatting Pin
Member 26305035-Jan-09 7:36
Member 26305035-Jan-09 7:36 

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.