Ajuda com programinha Delphi 5
Página 1 de 1
Ajuda com programinha Delphi 5
olá pessoal, sou iniciante em delphi 5 e estou tentando reproduzi o seguinte programa do livro delphi 5 guia do desenvolvedor:
[Hint] CIMain.pas(37): Overriding virtual method 'TForm1.WndProc' has lower visibility (private) than base class 'TForm' (protected)
[Hint] CIMain.pas(39): Overriding virtual method 'TForm1.defaultHandler' has lower visibility (private) than base class 'TForm' (public)
[Error] CIMain.pas(42): '=' expected but 'VAR' found
[Error] CIMain.pas(43): Undeclared identifier: 'TMainForm'
[Error] CIMain.pas(47): 'IMPLEMENTATION' expected but ';' found
[Error] CIMain.pas(49): '.' expected but 'IMPLEMENTATION' found
[Error] CIMain.pas(28): Unsatisfied forward or external declaration: 'TForm1.PostMessButtonClick'
[Error] CIMain.pas(29): Unsatisfied forward or external declaration: 'TForm1.SendMessButtonClick'
[Error] CIMain.pas(30): Unsatisfied forward or external declaration: 'TForm1.EatMsgCBClick'
[Error] CIMain.pas(31): Unsatisfied forward or external declaration: 'TForm1.FormCreat'
[Error] CIMain.pas(32): Unsatisfied forward or external declaration: 'TForm1.AppMsgCBClick'
[Hint] CIMain.pas(36): Private symbol 'OnAppMessage' declared but never used
[Error] CIMain.pas(37): Unsatisfied forward or external declaration: 'TForm1.WndProc'
[Error] CIMain.pas(38): Unsatisfied forward or external declaration: 'TForm1.SXMyMessage'
[Error] CIMain.pas(39): Unsatisfied forward or external declaration: 'TForm1.defaultHandler'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'CIMain.pas'
eis o formulario:
se alguém puder ajudar, agradeço imensamente.
- Código:
unit CIMain;
interface
uses
WinTypes, WinProcs, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Menus;
const
SX_MYMESSAGE = WM_USER;
MessString = '%s message now in %s.';
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
messProcCB: TCheckBox;
WndProcCB: TCheckBox;
CheckBox3: TCheckBox;
DefHandCB: TCheckBox;
PostMessButton: TButton;
SendMessButton: TButton;
GroupBox2: TGroupBox;
OnMsgRB: TRadioButton;
WndProcRB: TRadioButton;
MessageProcRB: TRadioButton;
DefHandRB: TRadioButton;
CheckBox5: TCheckBox;
procedure PostMessButtonClick(Sender: TObject);
procedure SendMessButtonClick(Sender: TObject);
procedure EatMsgCBClick(Sender: TObject);
procedure FormCreat(Sender: TObject);
procedure AppMsgCBClick(Sender: TObject);
private
{ Private declarations }
procedure OnAppMessage(var Msg: TMsg; var Handled: Boolean);
procedure WndProc(var Msg: TMessage); override;
procedure SXMyMessage(var Msg: TMessage); message SX_MYMESSAGE;
procedure defaultHandler(var Msg); override;
end;
public
var
MainForm: TMainForm;
{ Public declarations }
end;
implementation
{$R *.DFM}
const
SendPostStrings: array[0..1] of String = ('Sent', 'Posted');
procedure TmainForm.FormCreat(Sender: TObject);
begin
Application.OnMessage := OnAppMessage;
AppMsgCB.Tag :=Longint(OnMsgRB);
WinProcCB.tag := Longint (WndProcRB);
MessProcCB.Tag := (MsgProcRB);
DefHandCB.Tag := Longint (DefHandlerRB);
OnMsgRB.Tag := Longint (AppMsgCB);
WndProcRB.Tag := Longint (WndProcCB);
MsgProcRB.Tag := Longint (MssProcCB);
DefHandlerRB.Tag := Longint(DefHandCB);
end;
procedure TmainForm.OnAppMessage(var Msg: TMsg; var handler: Boolean);
begin
if Msg.message = SX_MYMESSAGE then
begin
if AppMsgCB.Checked then
begin
ShowMessage(Format (MessString, [SendPostString[Msg.WParam],
'Application.OnMessage']));
Handled := OnMsgRB.Checkd;
end;
end;
end;
procedure TMainForm.WndProc(var Msg: TMessage);
var
CallInherited: Boolean;
begin
CallInherited := True;
if Msg.Msg = SX_MYMESSAGE then
begin
if WndProcCB.Checked then
begin
ShowMessage(Format(MessString, [SendPostStrings[Msg.WParam],
'WindProc']));
CallInherited := not WndProcRB.Checked;
end;
end;
if CallInherited then inherited WndProc(Msg);
end;
procedure TMainForm.SXMyMessage(var Msg: TMessage);
var
CallInherited: Boolean;
begin
ShowMessage(Format (essString, [SendPostStrings[Msg.Wparam],
'Message Procedure']));
CllInherited := not MsgProcRB.Checked;
end
if CallInherited Then Inherited;
end;
procedure TMainForm.DefaultHandler(var Msg);
var
CallInherited: Boolean;
begin
CallInherited := True;
if TMessage(Msg).Msg = SX_MYMESSAGE then begin
ifDefHandCB.Checked then
begin
ShowMessage(Format(MessString,[SenPostStrings[TMessage(msg).WParam], 'DefaultHandler']))
CallInherited := not DefHandlerRB.Checked;
end;
end;
if CallInherited then inherited DefaultHa(msg);
end
procedure TMainForm.PostMessButtonClick (Sender: TObject);
begin
PostMessage(Handle, SX_MYMESSAGE,1,0);
end
procedure TMainForm.AppMsgCBClick (Send: TObject);
begin
if EatMsgCB.Checked then
begin
with TRadioButton((Sender as TcheckBox).Tag) do
begin
Enable := TCheckbox(Sender).Checked := False;
end;
end;
end;
procedure TMainForm.EatMsgCBClick (Sender: TObject);
var
i: integer;
DoEnable, EatEnable: Boolean;
begin
EatEnabled := EatMsgCB.Checked;
for i :=0 to EatMsgGB.Control.Count - 1 do
with EatMsgGB.Controls[i] as TRadioButton do
begin
DoEnable := EatEnabled
if DoEnable then DoEnable := TCheckBox(Tag).Checked;
if not DoEnable then Checked := False;
Enable := DoEnable;
end;
end;
end.
[Hint] CIMain.pas(37): Overriding virtual method 'TForm1.WndProc' has lower visibility (private) than base class 'TForm' (protected)
[Hint] CIMain.pas(39): Overriding virtual method 'TForm1.defaultHandler' has lower visibility (private) than base class 'TForm' (public)
[Error] CIMain.pas(42): '=' expected but 'VAR' found
[Error] CIMain.pas(43): Undeclared identifier: 'TMainForm'
[Error] CIMain.pas(47): 'IMPLEMENTATION' expected but ';' found
[Error] CIMain.pas(49): '.' expected but 'IMPLEMENTATION' found
[Error] CIMain.pas(28): Unsatisfied forward or external declaration: 'TForm1.PostMessButtonClick'
[Error] CIMain.pas(29): Unsatisfied forward or external declaration: 'TForm1.SendMessButtonClick'
[Error] CIMain.pas(30): Unsatisfied forward or external declaration: 'TForm1.EatMsgCBClick'
[Error] CIMain.pas(31): Unsatisfied forward or external declaration: 'TForm1.FormCreat'
[Error] CIMain.pas(32): Unsatisfied forward or external declaration: 'TForm1.AppMsgCBClick'
[Hint] CIMain.pas(36): Private symbol 'OnAppMessage' declared but never used
[Error] CIMain.pas(37): Unsatisfied forward or external declaration: 'TForm1.WndProc'
[Error] CIMain.pas(38): Unsatisfied forward or external declaration: 'TForm1.SXMyMessage'
[Error] CIMain.pas(39): Unsatisfied forward or external declaration: 'TForm1.defaultHandler'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'CIMain.pas'
eis o formulario:
se alguém puder ajudar, agradeço imensamente.
adrianofrt- Membro
- Mensagens : 1
Data de inscrição : 30/12/2012
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
Seg Jul 27, 2015 11:42 am por Fredyffp
» Fontes Sistema Store Protheus 7.0 - Versão completa Delphi XE7
Sáb Jul 18, 2015 10:18 am por storeprotheus
» Fontes Sistema Store Protheus 7.0 - Versão completa Delphi XE7
Sáb Jul 18, 2015 10:17 am por storeprotheus
» Como gravar um campo Blob no FireBird + Delphi de um campo tipo imagem no MS-ACCESS ?
Qui maio 14, 2015 3:41 pm por ant.carlos/sp
» Exception EBDEngineError
Sex Fev 27, 2015 6:52 am por luan_cpd
» Exception EBDEngineError
Sex Fev 27, 2015 6:49 am por luan_cpd
» Componente Delphi Brasil
Sex Jan 23, 2015 11:51 am por pedrosilva
» Erro no Delphi “A linha não pode ser localizada para atualiz
Sex Out 24, 2014 11:47 am por Edson
» Fontes Automação Comercial 8.5 - Retaguarda c/ PDV, PAF 1.10, TEF, ECF, Sintegra, SpedFiscal, Google Maps e muito mas...
Ter Out 14, 2014 9:55 am por john marcos