Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

execute the follwoing code in DELPHI program the answer should contain the screen shot of result unit UnMW; interface uses Windows, Messages, SysUtils, Variants, Classes,

execute the follwoing code in DELPHI program the answer should contain the screen shot of result

unit UnMW; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; Label1: TLabel; Label2: TLabel;

10

Edit2: TEdit; Button1: TButton; Button2: TButton; procedure Button2Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; var mSize : Cardinal; MemPtr : Pointer; implementation {$R *.dfm} procedure TForm1.Button2Click(Sender: TObject); begin mSize := Length(Edit1.Text) + 1; MemPtr := VirtualAlloc(NIL, mSize, MEM_COMMIT, PAGE_READWRITE); VirtualLock(MemPtr, mSize); CopyMemory(MemPtr, PChar(Edit1.Text), mSize); VirtualUnlock(MemPtr, mSize); end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin if MemPtr <> NIL then VirtualFree(MemPtr, MDIChildCount, MEM_RELEASE); end; procedure TForm1.Button1Click(Sender: TObject); begin if MemPtr = NIL then ShowMessage(' ') else begin VirtualLock(MemPtr, mSize); Edit2.SetTextBuf(MemPtr); VirtualUnlock(MemPtr, mSize); end; end;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

Explain the various techniques of Management Development.

Answered: 1 week ago

Question

D How will your group react to this revelation?

Answered: 1 week ago