Login After,,,,,,,,
Process.Start("APMCommManager.exe");
-APMCommManager.exe
Application.Run(new APMCommManagerForm()); //APMCommManager/Program.cs
public APMCommManagerForm() //APMCommManager/APMCommManagerForm.cs
{
mainWindowHandle = (IntPtr)Convert.ToInt32( arguments[1] );
APMApiPublic.PostMessage(Handle, APMApiPublic.UWM_APP_STARTUP, (IntPtr)0, (IntPtr)0 );
}
protected override void WndProc(ref Message m) //APMCommManager/APMCommManagerForm.cs
{
switch(m.Msg)
{
case APMApiPublic.UWM_APP_STARTUP:
APMApiPublic.SendMessage(mainWindowHandle, APMApiPublic.UWM_APP_STARTUP, (intPtr)Handle,
(IntPtr)Process.GetCurrentProcess().id);
break;
}
}
-Basic Const Variables
protected override void WndProc(ref Message m) //APM/APMMain.cs
{
switch(m.Msg)
{
case APMApiPublic.UWM_APP_STARTUP:
commHandle=APMMemory.GetInstance.APMCommManager=(IntPtr)m.WParam;
//public IntPtr APMCommManager
break;
}
}
- Form Button Query Click //APM/Screen/DBM/UAPDBMQ0010.cs
string query = string.Format(@"select * from table where flag = 1");
APMPublic.GetInstance.SendQuery(currentHandle, 2, 10, MetaData.APP_TYPE.QUERY.ToString(), query);
//APM/APMPublicLib/Common/APMPublic.cs
- SendQuery(IntPtr handle, int queryindex, int columnCnt, string clientMessageTarget, string query)
{
string timestam[ = string.Format("{0:D10}.{1:D3}", Convert.ToInt64(handle.ToString()), queryindex);
IntPtr result = APMapiPublic.send((IntPtr)MetaData.APP_TYPE_QUERY, APMMemory.GetInstance.APMCommManager, jsonstring);
return result;
}
//APM/APMPublicLib/Common/APMPublic.cs
- public static IntPtr send(IntPtr wParam, IntPtr hWnd, byte[] data)
- public static IntPtr send(IntPtr wParam, IntPtr hWnd, string data)
{
IntPtr result = SendMessage(hWnd, WM_COPYDATA, wParam, sendData);
return result;
}
protected override void WndProc(ref Message m)//APM/APMCommManager/APMCommManagerForm.cs
{
switch(m.Msg)
{
case APMApiPublic.WM_COPYDATA:
if(m.WParam==(IntPtr)MetaData.APP_TYPE.QUERY) brea;
}
SendToTail() //SendMessage Log Record!!
byte[] jsonByte = Encoding.UTF8.GetBytes(jsonstring);
sendQueue.Enqueue(jsonByte); //입력한다.
if( ! ____sendWorker.IsBusy) ____sendWorker.RunWorkerAsync();
}
void ____sendWorker_DoWork(object sender, DoWorkEventArgs e)//APM/APMCommManager/APMCommManagerForm.cs
{
byte[] jsonByte=sendQueue.Dequeue(); //꺼낸다.
resultcode=____sendRedis.RPush("QCS", jsonByte); //통신시에는 byte단위를 사용
}
//APM/APMCommManager/APMCommManagerForm.cs
void ____sendWorker_Completed(object sender, CompletedEventArgs e)
{
if(____sendQuquq.Count > 0)
if(! ____sendWorker.IsBusy) ____sendWorker.RunWorkerAsync();
}