Windows Form 실행시에 Message 순서출력
Windows Form 실행시에 Message 순서출력, Windows Form 실행시에 Message 순서출력
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
private IntPtr tailHandle = IntPtr.Zero;
int index = 0;
public Form1()
{
InitializeComponent();
//this.Visible=false;
}
private void SendToTail(int index, string data)
{
tailHandle = APMApiPublic.FindWindow(null, "DEBUGDEBUGDEBUG");
if (tailHandle != IntPtr.Zero && data.Length > 0 && APMApiPublic.IsWindow(tailHandle))
{
try
{
byte[] dataByte = Encoding.UTF8.GetBytes(data);
APMApiPublic.COPYDATASTRUCT copyData = new APMApiPublic.COPYDATASTRUCT();
copyData.dwData = (IntPtr)0;
copyData.cbData = dataByte.Length;
copyData.lpData = Marshal.AllocHGlobal(dataByte.Length);
Marshal.Copy(dataByte, 0, copyData.lpData, dataByte.Length);
IntPtr sendData = Marshal.AllocHGlobal(Marshal.SizeOf(copyData));
Marshal.StructureToPtr(copyData, sendData, true);
IntPtr _result = APMApiPublic.SendMessage(tailHandle, APMApiPublic.WM_COPYDATA, (IntPtr)index, sendData);
Marshal.FreeHGlobal(copyData.lpData);
Marshal.FreeHGlobal(sendData);
}
catch (Exception exp)
{
//MessageBox.Show(exp.Message);
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
SendToTail(1, "(Form1_Load)()()()()()[INDEX]:" + index.ToString("0000000"));
index++;
}
private void Form1_Shown(object sender, EventArgs e)
{
SendToTail(1, "(Form1_Shown)()()()()()[INDEX]:" + index.ToString("0000000"));
index++;
}
private void Form1_Enter(object sender, EventArgs e)
{
SendToTail(1, "(Form1_Enter)()()()()()[INDEX]:" + index.ToString("0000000"));
index++;
}
private void Form1_ForeColorChanged(object sender, EventArgs e)
{
SendToTail(1, "(Form1_ForeColorChanged)()()()()()[INDEX]:" + index.ToString("0000000"));
index++;
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
SendToTail(1, "(Form1_FormClosed)()()()()()[INDEX]:" + index.ToString("0000000"));
index++;
}
private void Form1_Activated(object sender, EventArgs e)
{
SendToTail(1, "(Form1_Activated)()()()()()[INDEX]:" + index.ToString("0000000"));
index++;
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
SendToTail(1, "(Form1_Paint)()()()()()[INDEX]:" + index.ToString("0000000"));
index++;
}
}
}
'c# 언어 > 초급과정' 카테고리의 다른 글
(Schedule)CHK.cs (0) | 2024.02.28 |
---|---|
SetWindowLong 함수란 무엇인가 (0) | 2024.01.30 |
공백여러개를 하나로 정리하기 (0) | 2023.12.13 |
중도금이자::DateTime.ParseExact(manualDT, "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture); (0) | 2023.11.21 |
List<string> AuthorList = new List<string>();/control_datagridview.Rows.AddItem(AuthorList.ToArray()); (0) | 2023.10.11 |