procedure TMain_Frm.WndProc(var Mess: TMessage);
var
  i,k,j,h:Integer;
begin
  case Mess.LParam of
    0:
      begin
        if (mess.msg = idMsg) then begin
          if (Mess.wParam >=0) and (Mess.WParam <= 5) then begin
            if CommonData <> nil then with CommonData^ do begin
              Memo1.Text := CommonData.BufferA;
              if Memo1.Text<>'' then
              begin
                  ListView1.Clear;
                  for i:=0 to KyeStringlist.Count-1 do
                  begin
                      if Pos(KyeStringlist.Strings[i],Memo1.Text)>0 then
                      begin
                        ADOQuery1.Close;
                        ADOQuery1.SQL.Clear;
                        ADOQuery1.SQL.Add('select * from Kword where kye='+''''+kyestringlist.Strings[i]+'''') ;
                        ADOQuery1.Open;
                        for k:=1 to ADOQuery1.RecordCount do
                        begin
                             ListView1.Items.Add.Caption:=KyeStringlist.Strings[i];
                             qry1.Close;
                             qry1.SQL.Clear;
                             qry1.SQL.Add('select * from Pz where HGpm like '+'''%+'+adoquery1.FieldValues['Nme']+'%''');
                             qry1.Open;
                             if not qry1.IsEmpty then
                             begin
                                  for j:=1 to qry1.RecordCount do
                                  begin
                                      with ListView1.Items.Add do
                                      begin
                                       Caption:=KyeStringlist.Strings[i];
                                       SubItems.Add(qry1.FieldValues['HGpm']);
                                      end;
                                      qry1.Next;
                                   end;
                             end;
                            ADOQuery1.Next;
                             begin
                               for h:=1 to qry1.RecordCount do
                               begin
                                   with ListView1.Items.Add do
                                   begin
                                      Caption:=KyeStringlist.Strings[i];
                                      SubItems.Add(qry1.FieldValues['HGpm']);
                                   end;
                               end;
                             end;
                         end;
                      end;
                  end;
              end;
            end
          end else
            //
        end;
      end;
    1:
      begin
        if CommonData<>nil then with CommonData^ do
          //
      end;
    2:
      begin
        //Memo1.Text := '---';
      end;
  end;
  inherited;
end;刻苦努力學編程,勤奮學習寫代碼!
誠交CSDN上所有的編程朋友!
請加入你的MSN:[email protected]

解决方案 »

  1.   

    if not qry1.IsEmpty then
                        begin
                          for j:=1 to qry1.RecordCount do
                          begin
                            with ListView1.Items.Add do
                            begin
                              Caption:=KyeStringlist.Strings[i];
                              SubItems.Add(qry1.FieldValues['HGpm']);
                            end;
                            qry1.Next;
                          end;
                        end;
                        ADOQuery1.Next;
                        begin
                        for h:=1 to qry1.RecordCount do
                        begin
                          with ListView1.Items.Add do
                          begin
                            Caption:=KyeStringlist.Strings[i];
                            SubItems.Add(qry1.FieldValues['HGpm']);
                          end;
                        end;
    这段的功能你描述下!没看懂
      

  2.   

    此段代碼是實現屏幕取詞的過濾查詢!
    當鼠標移到相關的字段,程序會自動找到相關符合代碼的字段上並顯示!這是中國海關品名程序,欲知詳情:加入我的MSN:[email protected]   我願意以源程序交流學習!