测试01

Posted DebugSkill

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了测试01相关的知识,希望对你有一定的参考价值。

1、

unit formMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Memo1: TMemo;
    edtDestHWnd: TEdit;
    Label1: TLabel;
    Button4: TButton;
    Button5: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private

  public
    procedure TestParam(_i :integer; _f :single; _d :double; _pc :PChar; _pi :PInteger);stdcall;
    procedure Test(_i, _j :integer);stdcall;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var hWnd1 :HWND;
begin
  hWnd1 := strtoint($+trim(edtDestHWnd.Text));
  PostMessage(hWnd1, WM_USER+1000, 0, 0);
end;

procedure TForm1.Button2Click(Sender: TObject);
var hWnd1 :HWND;
begin
  hWnd1 := strtoint($+trim(edtDestHWnd.Text));
  PostMessage(hWnd1, WM_USER+1001, 0, 0);
end;

procedure TForm1.Button3Click(Sender: TObject);
var hWnd1 :HWND;
begin
  hWnd1 := strtoint($+trim(edtDestHWnd.Text));
  SendMessage(hWnd1, WM_USER+1001, 0, 0);
end;

{$O-}
procedure TForm1.Button4Click(Sender: TObject);
var pc, pc1 :PChar;
    i, j :integer;
    str :string;
    iLow, iHigh :integer;
    d :double;
    f :single;
begin
pc := ABC;

  j := integer(@i);
  str := inttohex(j, 8);//str: ‘0018F574‘
  j := integer(pc);
  str := inttohex(j, 8);// str: ‘00403277‘
  j := integer(@pc);
  str := inttohex(j, 8);// str: ‘00403277‘

  d := 3.0;
  pc1 := PChar(@d);

  CopyMemory(@iLow, pc1, 4);
  CopyMemory(@iHigh, @pc1[4], 4);
  str := inttohex(iLow, 8); // 0
  str := inttohex(iHigh, 8);// str: ‘40080000‘

  f := 2.0;
  CopyMemory(@j, @f, 4);
  str := inttohex(j, 8);// str: ‘40000000‘

  TestParam(1, 2.0, 3.0, pc, @i);
end;
{$O+}
{$O-}
procedure TForm1.Test(_i, _j: integer);stdcall;
begin
  try
    _i := _i div  _j;
  finally
    _i := 3;
  end;
end;

procedure TForm1.TestParam(_i: integer; _f: single; _d: double; _pc :PChar; _pi :PInteger);stdcall;
begin

end;
{$O+}

procedure TForm1.Button5Click(Sender: TObject);
begin
//  Test(6, 3);
  Test(6, 0);
end;

end.

 

2、

#include <stdio.h>
#include <windows.h>

void __stdcall TestParam(int _i, float _f, double _d, char* _pc, int* _pi)
{
}

void __stdcall Test(int _i, int _j)
{
    //__try
    //{
        _i = _i / _j;
    //}
    //__finally
    //{
    //    _i = 3;
    //}
}

void main()
{
    __asm
    {
        mov eax,eax
        mov eax,eax
        mov eax,eax
        //int 3
    }
    Test(6, 0);
}

//void main()
//{
//    char * pc = "ABC";
//    printf("pc : %X\n", (int)pc);
//
//    char *pc1 = NULL;
//    float f = 2.0;
//    double d = 3.0;
//
//    DWORD dwLow = 0, dwHigh=0;
//
//    pc1 = (char*)&f;
//    memcpy(&dwLow, pc1, 4);
//    printf("f : %X\n", dwLow);
//
//    pc1 = (char*)&d;
//    memcpy(&dwLow, pc1, 4);
//    memcpy(&dwHigh, &pc1[4], 4);
//    printf("d[low] : %X\n", dwLow);
//    printf("d[high] : %X\n", dwHigh);
//
//    int i = 6;
//    printf("&i : %X\n", (int)&i);
//
//    TestParam(1, f, d, pc, &i);
//
//}

 

3、

4、

5、

 

以上是关于测试01的主要内容,如果未能解决你的问题,请参考以下文章

;~ 小部分AutoHotkey源代码片段测试模板2019年10月9日.ahk

19 01 11 javascript ?????????????????????(???????????????) ??????????????????????????????(代码片段

[linux][c/c++]代码片段01

typescript Angular 2测试片段。代码库https://developers.livechatinc.com/blog/category/programming/angular-2/

如何在片段着色器中进行自定义模板测试

typescript Angular最终版本的Angular 2测试片段。代码库https://developers.livechatinc.com/blog/category/programming