S
sjx79
Unregistered / Unconfirmed
GUEST, unregistred user!
{/* 过程声明(接收自定消息) */private Procedure OnStkDataOk(Var MyMsg: TMessage);
message WM_StkDataOK; /* End */ }Procedure TForm1.OnStkDataOk(Var MyMsg: TMessage);Var pHeader: PRCV_DATA;
pReport: PRCV_REPORT_STRUCTEx;
OneStock: RCV_REPORT_STRUCTEx;
size: integer;
nPacketNum, n: WORD;
s2: shortstring;
strmarket, ss: String;
begin
If MyMsg.wParam = 10 then
begin
pHeader := PRCV_DATA(MyMsg.lParam);
nPacketNum := pHeader^.m_nPacketNum;
pReport := pHeader^.m_pData;
Move(pReport^, OneStock, SizeOf(OneStock));
setlength(s2, 2);
Move(OneStock.m_wMarket, s2[1], 2);
If CheckBox1.Checked then
AddLog('接收到行情1 ' + s2 + pReport^.m_szLabel + ' 等' + IntToStr(nPacketNum) + '笔动态行情');
For n := 0 To nPacketNum - 1do
begin
size := OneStock.m_cbSize;
If (size > SizeOf(OneStock)) Or (size = 0) then
size := SizeOf(OneStock);
FillChar(OneStock, SizeOf(OneStock), 0);
Move(pReport^, OneStock, size);
With OneStockdo
begin
ss := DateTimeToStr(m_time / 86400 + Date1970) + ',' + m_szLabel + ',' + m_szName + ',' + FloatToStrF(m_fLastClose, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fOpen, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fHigh, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fLow, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fNewPrice, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fVolume, ffGeneral, 13, 2) + ',' + FloatToStrF(m_fAmount, ffGeneral, 13, 2);
Form1.Memo2.Lines.Add(ss);
end;
end;
end;
end;
如题,请各位高手帮忙将TForm1.OnStkDataOk 这个过程用线程来执行(最主要是for循环里的用线程来处理就可以了)注:搞定后重分感谢。
message WM_StkDataOK; /* End */ }Procedure TForm1.OnStkDataOk(Var MyMsg: TMessage);Var pHeader: PRCV_DATA;
pReport: PRCV_REPORT_STRUCTEx;
OneStock: RCV_REPORT_STRUCTEx;
size: integer;
nPacketNum, n: WORD;
s2: shortstring;
strmarket, ss: String;
begin
If MyMsg.wParam = 10 then
begin
pHeader := PRCV_DATA(MyMsg.lParam);
nPacketNum := pHeader^.m_nPacketNum;
pReport := pHeader^.m_pData;
Move(pReport^, OneStock, SizeOf(OneStock));
setlength(s2, 2);
Move(OneStock.m_wMarket, s2[1], 2);
If CheckBox1.Checked then
AddLog('接收到行情1 ' + s2 + pReport^.m_szLabel + ' 等' + IntToStr(nPacketNum) + '笔动态行情');
For n := 0 To nPacketNum - 1do
begin
size := OneStock.m_cbSize;
If (size > SizeOf(OneStock)) Or (size = 0) then
size := SizeOf(OneStock);
FillChar(OneStock, SizeOf(OneStock), 0);
Move(pReport^, OneStock, size);
With OneStockdo
begin
ss := DateTimeToStr(m_time / 86400 + Date1970) + ',' + m_szLabel + ',' + m_szName + ',' + FloatToStrF(m_fLastClose, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fOpen, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fHigh, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fLow, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fNewPrice, ffGeneral, 7, 2) + ',' + FloatToStrF(m_fVolume, ffGeneral, 13, 2) + ',' + FloatToStrF(m_fAmount, ffGeneral, 13, 2);
Form1.Memo2.Lines.Add(ss);
end;
end;
end;
end;
如题,请各位高手帮忙将TForm1.OnStkDataOk 这个过程用线程来执行(最主要是for循环里的用线程来处理就可以了)注:搞定后重分感谢。