unit varkey32;
interface
Uses SysUtils, Windows, Messages;
Function varkey(Stringthing : PChar) : Boolean;
implementation
var mainwin,kidwin:Thandle;
TargetPoint:Tpoint;
stringToSend:string;
Loopint:integer;
Stringthing: String;
begin
mainwin:=Findwindow('Notepad',nil);
if mainwin<>0 then
begin
targetPoint.x:=50; {make sure it is is the "writing" area of notepad}
targetPoint.y:=50;
end;
kidWin:=ChildWindowFromPoint(mainwin,targetpoint);
if kidwin<>0 then
begin
StringToSend:=Stringthing;
For loopint:=0 to length(stringToSend)-1 do
begin
PostMessage(Kidwin,wm_char,Ord(stringToSend[loopint]),0);
end;
end;
end.
For further information see delphi help with the topic "writing units"
or something sounds like this.
Greetings,
Holger
unit varkey32;
interface
Uses SysUtils, Windows, Messages;
Function varkey(Stringthing : PChar) : Boolean;
implementation
Function varkey(Stringthing : PChar) : Boolean;
begin
.
.
.
end; {end of varkey function}
end. {end of unit}
---------------------------------------
You need the function header in both the interface and implementation
sections. This is because you may have more than one routine in a unit (in
fact, it seems like a waste to write a whole unit for only one routine). You
have to tell the complier which routine you are implementing For example:
---------------------------------------
unit Stuff;
interface
procedure DoStuff;
function TestStuff:BOOLEAN;
implementation
procedure DoStuff;
begin
{code for DoStuff}
end;
function TestStuff:BOOLEAN;
begin
{code for TestStuff}
end;
end.
---------------------------------------
Hope that clarifies things.
-------------------------------------------------------
http://members.home.net/dave.t.rudolf
http://members.home.net/stonemason
"Malgaras" <malg...@iol.ie> wrote in message
news:8lusbo$15...@bornews.borland.com...
> I'm trying to get this to work but it keeps saying Unsatisfied Forware or
> externam declaration
>
>
> unit varkey32;
>
> interface
>
> Uses SysUtils, Windows, Messages;
>
> Function varkey(Stringthing : PChar) : Boolean;
> implementation
>
> var mainwin,kidwin:Thandle;
> TargetPoint:Tpoint;
> stringToSend:string;
> Loopint:integer;
> Stringthing: String;