class Program
{
public static void Main()
{
DebugManage nm = new DebugManage();
nm.running();
}
}
public struct COPYDATASTRUCT
{
public IntPtr dwData {get; ste;}
public int cbData {get; ste;}
public IntPtr lpData {get; ste;}
}
public class RcvDefaultResult
{
public string code { get; set; }
public string text { get; set; }
public List<List<string>> data { get; set; }
}
public class PWInterface
{
private RcvDefaultResult _result;
public string id { get; set; }
public string sender { get; set; }
public string proto { get; set; }
public RcvDefaultResult result
{
get { return _result; }
set { _result = value; }
}
}
class DebugManage
{
class dataInterface
{
public List<List<string>> data {get; set;}
}
public void running()
{
int ii,kk;
string formatText="";
COPYDATASTRUCT cds = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT));
byte[] recvData = new byte[cds.cbData];
Marshal.Copy(cds.lpData, recvData, 0, cds.cbData);
FormatText = Encoding.UTF8.GetString(recvData);
try
{
PWInterface ifRecieve = JsonConvert.DeserializeObject<PWInterface>(formatText);
//ifRecieve.result.code
//ifRecieve.result.text
//ifRecieve.result.data.Count
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
try
{
JObject jobject = JObject.Parse(formatText);
string screen = jobject["id"].ToString().Substring(0+1+5+1, 10);
string mmm = jobject["result"].ToString();
dataInterface data;
data = JsonConvert.DeserializeObject<dataInterface>(mmm);
for(kk=0; kk<data.data.Count; kk++)
{
List<string> mmm_mmm = data.data[kk];
for(ii=0; ii<mmm_mmm.Count; ii++)
{
Console.WriteLine(mmm_mmm[ii].ToString());
}
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
}
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
switch (m.Msg)
{
case WM_COPYDATA:
break;
default:
break;
}
}
'c# 언어 > 중급과정' 카테고리의 다른 글
MSI와 EXE의 차이점(1) (0) | 2023.03.07 |
---|---|
IntPtr _result = SendMessage(tailHandle, APMApiPublic.WM_COPYDATA, (IntPtr)index, sendData); (0) | 2022.12.08 |
JsonConvert.DeserializeObject, JsonConvert.SerializeObject (0) | 2022.11.16 |
WM_COPYDATA를 이용한 데이타 주고받기 (0) | 2022.11.09 |
Singletone Pattern sample (0) | 2022.05.31 |