nekok
01-21-2011, 02:01 AM
:)Dear all, may you have a great day
I work on my project, the idea is remote computer/remote desktop, using indy.
I'm testing one of the features which is sending message directly into the server desktop interface [write on the desktop].
I run both the server and the client, make the connection, and try the send desktop message feature. Once I execute the command, the message shown at server desktop [it works], but then suddenly and error come up and the program need be reset. :(
here the error message project target.exe raised exception class EOleSysError with message 'CoInitialize has not been called'. here the code phrase:
//=============[9]FOR DESKTOP MESSAGE==========//
if command='desktopmessage' then
begin //condition 16
//takedata from client
//coordinate x
messages:=AThread.Connection.ReadLn;
s1:=messages;
x:=strtoint(s1);
//coordinate y
messages:=AThread.Connection.ReadLn;
s2:=messages;
y:=strtoint(s2);
//message detail
messages:=AThread.Connection.ReadLn;
s:=messages;
//desktop canvas create
DeskTopCanvas:=TCanvas.Create;
DeskTopCanvas.Handle:=GetDC(HWND_Desktop);
Handle:=GetDesktopWindow;
Dc:=GetWindowDC(Handle);
ACanvas:=TCanvas.Create;
try
//write at desktop
ACanvas.Handle:=DC;
BeginPath(ACanvas.Handle);
ACanvas.Font.Color:=clRed;
ACanvas.Font.Name:='Tahoma';
ACanvas.Font.Size:=40;
SetBkMode(ACanvas.Handle,TRANSPARENT);
EndPath(ACanvas.Handle);
ACanvas.TextOut(x,y,s);
finally
//release memory
ReleaseDC(Handle,ACanvas.Handle);
ACanvas.Free;
end;
AThread.Connection.WriteLn('lost');
command:='';
narations:='A Message Sent to Your Desktop';
NARATION(narations);
end;
plase help me, what this error mean, and what probably the solution to it.:confused:
thanks in advance
I work on my project, the idea is remote computer/remote desktop, using indy.
I'm testing one of the features which is sending message directly into the server desktop interface [write on the desktop].
I run both the server and the client, make the connection, and try the send desktop message feature. Once I execute the command, the message shown at server desktop [it works], but then suddenly and error come up and the program need be reset. :(
here the error message project target.exe raised exception class EOleSysError with message 'CoInitialize has not been called'. here the code phrase:
//=============[9]FOR DESKTOP MESSAGE==========//
if command='desktopmessage' then
begin //condition 16
//takedata from client
//coordinate x
messages:=AThread.Connection.ReadLn;
s1:=messages;
x:=strtoint(s1);
//coordinate y
messages:=AThread.Connection.ReadLn;
s2:=messages;
y:=strtoint(s2);
//message detail
messages:=AThread.Connection.ReadLn;
s:=messages;
//desktop canvas create
DeskTopCanvas:=TCanvas.Create;
DeskTopCanvas.Handle:=GetDC(HWND_Desktop);
Handle:=GetDesktopWindow;
Dc:=GetWindowDC(Handle);
ACanvas:=TCanvas.Create;
try
//write at desktop
ACanvas.Handle:=DC;
BeginPath(ACanvas.Handle);
ACanvas.Font.Color:=clRed;
ACanvas.Font.Name:='Tahoma';
ACanvas.Font.Size:=40;
SetBkMode(ACanvas.Handle,TRANSPARENT);
EndPath(ACanvas.Handle);
ACanvas.TextOut(x,y,s);
finally
//release memory
ReleaseDC(Handle,ACanvas.Handle);
ACanvas.Free;
end;
AThread.Connection.WriteLn('lost');
command:='';
narations:='A Message Sent to Your Desktop';
NARATION(narations);
end;
plase help me, what this error mean, and what probably the solution to it.:confused:
thanks in advance