hey guys,
i found out the solution
in app1
In app2
I got it Properly. try it out :-). Thank you very much for the help and concern.
i found out the solution
in app1
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace buttons
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//**********Using event in user32 for sending button value****************//
[DllImport("user32")]
public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int
dwExtraInfo);
private const byte VK_MENU = 0x12;
private const byte VK_TAB = 0x09;
private const int KEYEVENTF_EXTENDEDKEY = 0x01;
private const int KEYEVENTF_KEYUP = 0x02;
//************************************************************************//
private void button1_Click(object sender, EventArgs e)
{
prevwin();//function to go to previously active window
keybd_event(0x60, 0, 0, 0);// key press event
keybd_event(0x60, 0, KEYEVENTF_KEYUP, 0);// key release event
}
private void button2_Click(object sender, EventArgs e)
{
prevwin();
keybd_event(0x61, 0, 0, 0);
keybd_event(0x61, 0, KEYEVENTF_KEYUP, 0);
}
private void prevwin()
{
// using ALT TAB to go to previously active window
keybd_event(VK_MENU, 0xb8, 0, 0); //Alt Press
keybd_event(VK_TAB, 0x8f, 0, 0); // Tab Press
keybd_event(VK_TAB, 0x8f, KEYEVENTF_KEYUP, 0); // Tab Release
keybd_event(VK_MENU, 0xb8, KEYEVENTF_KEYUP, 0); // Alt Release
}
}
}
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace textboxs
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Shown(object sender, EventArgs e)
{
textBox1.Focus();
}
}
}
I got it Properly. try it out :-). Thank you very much for the help and concern.
Comment