Jump to content

Lindawb

Members
  • Content Count

    31
  • Joined

  • Last visited

Everything posted by Lindawb

  1. Lindawb

    mouse move on screen

    Hello, I'm playing around to have small program with timer to change cursor with square, works but keeps old squares behind till I press F5. this was part of screen saver, but now trying to make it for kids play with it. procedure TForm1.Timer3Timer(Sender: TObject); var dc: HDC; canvas : TCanvas; P: TPoint; begin Windows.GetCursorPos(P); dc := GetWindowDC(0); canvas := Tcanvas.Create; try Canvas.Lock; Canvas.Handle := dc; Canvas.Pen.Width:=1; Canvas.Pen.Color := clYellow; Canvas.Brush.Color := clRed; Canvas.FillRect(Rect(p.X, p.Y,p.X+50,p.Y+50)); Canvas.Refresh; Canvas.UnLock; ReleaseDC(Handle, DC); finally ShowWindow(dc,SW_RESTORE); FreeAndNil(canvas); end; end; All I need is just keep the square where the mouse stops and clear previous canvas. if not possible, is there a way to load mouse cursor with small picture for kids ? I mean when kid moves the mouse shows animal image or any image. ! Thank you
  2. Lindawb

    mouse move on screen

    Thank you
  3. Lindawb

    mouse move on screen

    Thank you, No that is not what I meant, if you see the code, the mouse outside the program,. in fact the program not visible. just desktop with slider. see attached image, what I want is to clear 1,2,3,4 boxes and keep last box. right now works, but keeps old boxes behind. Thank you
  4. I have this function, i can't convert the vtString and vtChar from Delphi 2006 to Delphi XE10.1 Berlin also as you know vtString not supported after Delphi 2009, what will be alternative to it In Delphi XE 10.1 and how get it working in this function. function checkval(const Values:array of const):boolean; var I:integer; P:byte; S:ShortString; v,d:double; OldPos:integer; ls:boolean; FISize,FISize2:byte; FRecNo:integer; begin SetLength(s,FISize); P:=1; ls:=False; SetLength(s,FISize); P:=1; ls:=False; for I := 0 to High(Values) do with Values do case VType of vtString: // Short string (only the last field in index can be of ShortString type) begin S[P]:=AnsiChar (Length(VString^)); System.Move(VString^[1],S[P+1],Length(VString^)); Inc(P,Length(VString^)+1); ls:=I=High(Values); end; vtChar: begin System.Move(VChar,S[P],SizeOf(VChar)); Inc(P,SizeOf(VChar)); end; end; if P<=FISize then begin if ls then FillChar(S[P],FISize-P+1,#0) else MessageDlg('not valid size.', mtError, [mbOK], 0); end else if P>FISize+1 then raise Exception.Create('Too many Find parameters.'); end; Thank you for any help, I appreciate your time and knowledge , I don't understand explanation , if you can help please reply with complete code .
  5. Hello, please I need to understand how pointer works in this example if for I := 0 to High(Values) do with Values do case VType of vtString: //works fine begin S[P]:=ansiChar(Length(VString^)); System.Move(VString^[1],S[P+1],Length(VString^)); Inc(P,Length(VString^)+1); ls:=I=High(Values); end; vtAnsiString: // not working , something wrong begin S[P]:=ansiChar(sizeof(VAnsiString)); System.Move(AnsiString(Values.VAnsiString),S[P+1],sizeof(VAnsiString)); Inc(P,sizeof(VAnsiString)+1); ls:=I=High(Values); end; Thank you
  6. Lindawb

    vtString and vtWideString & vtAnsiString

    Thank you so much for your time and knowledge , as I posted in my other question this is part of the zip file All I needed to Delphi XE10 new vType vtUnicodeString , vtAnsiString, vtWideString but looks I need vtUnicodeString more than anything else. I added your vtUnicodeString size error.. Thanks again
  7. Lindawb

    Delphi 2006 to Delphi XE 10.1 VType help

    Hello, Thank you all for all your help and valuable time, I gave up :( I worked on the project for months and end up with dropping it, beyond my knowledge, BTW: I did download the memSortList.pas and compared with that zipped with files, looks same, there is no UnicodeString in them means very old code. Thank you all again, I will edit that my post and remove it .
  8. Lindawb

    Delphi 2006 to Delphi XE 10.1 VType help

    Thank you, the read me txt says downloaded from http://delphi.icm.edu.pl/newl/midxd30f.htm ( [ sortlist.zip ] [ 5,976 bytes ] ) and modified the code used tor chat program only with ICS tools and I'm converting to Delphi XE 10, I done with most part.
  9. Lindawb

    Delphi 2006 to Delphi XE 10.1 VType help

    Thank you, I tried that one too, I appreciate you and Remy for helping , I'm trying to post someone else's complete code, but looks no way till post complete unit, the code posted on the internet log time ago , now I'm trying to convert to Delphi XE10. here Delphi 2006 code,
  10. Hello, Is it possible to send/receive compressed tmemorystream with WSocket ? if yes how please. piece of code will help Thank you
  11. Lindawb

    vtString and vtWideString & vtAnsiString

    Hello , sorry , the S is shortstring; var I:integer; P:byte; S:ShortString; v,d:double; OldPos:integer; ls:boolean; all worked except the vtUnicodeString:, looks the length of P more than expected . any idea ? Thank you so much
  12. Hello, If I have 3 connections (sockets) with different name connected to WSocketThrdServer ConnectionA ConnectionB ConnectionC each connection send different messages and muss receive related response, means ConnectionA if A then response from the server send to ConnectionA 'You connection A' ConnectionB if B response from the server send to ConnectionB 'You connection B' ConnectionC if C response from the server send to ConnectionC 'You connection C' all connections are tcp protocol and all 3 connections from same IP address, same host Basically reply to associated connection only. Thank you
  13. Hello, Is this code works with ICS Wsocket ? WSocket1.SendStr('<|START|>' + MemoryStreamToString(MyStream) + '<|END|>'); the sends without error, but on the server OnDataAvailable( Sender : TObject; Error : Word); Cli := Sender as TMyClient; Cli.LineMode := False; Cli.LineEdit := False; Cli.LineLimit := 99999999; sentstream:=Cli.ReceiveStr(); not working , not getting complete stream length. any help appreciated Thank you
  14. Lindawb

    ICS and MemoryStreamToString

    Thank you for your kind words, I appreciate your time and knowledge. No this is completely different task, I'm trying many ways, I'm asking question , if you know how to do it please help, otherwise please do not insult. what is the wrong with different questions and different ways to do things? also MemoryStreamToString(MyStream) one line code, other way too many lines , I'm trying to find better way Thank you
  15. sorry, I use tcp if that is what you asking. I wasn't clear, all 3 connection from same computer or IP, Thanks
  16. Thank you, You mean first compress the stream with Zlib on Client side, then send it , on the server side read compressed stream , then decompress it and use it. are those steps correct ? I tried it yesterday but for some reason didn't work. Thanks again
  17. Lindawb

    vtString and vtWideString & vtAnsiString

    Thank you so much
  18. Hello, I'm sending 2 types of data, one as data and other one as simple text message, now with help of good people I was able to get data as memorystream, but I can't get any string text Client.Send(aBuff,Length(aBuff)); // works on OnDataAvailable but Client.SendStr('This is a string'); // doesn't work, like bad header My question: is it possible to check the sent data(tbyes) or string, if winsocketdata process as data, if string just read it as string on same OnDataAvailable ? Thank you
  19. Thanks a trillion, worked like a charm!
  20. Thank you so much, I tried to use as below, but looks going nowhere. procedure TForm1.Button3Click(Sender: TObject); var defaultRec : TMyRec; result, mystr: string; aHdr:tPacketHdr; begin FillPacketIdent(aHdr.Ident); aHdr.Command:=CMD_STR; //CMD_STR added to uPacketDefs mystr:= 'Hello Delphi Developers'; aHdr.DataSize:=SizeOf(mystr[1]); // SetString(mystr, PAnsiChar(@defaultRec.FirstName[0]), Length(defaultRec.FirstName)); //write to record SetLength(mystr, length(defaultRec.FirstName)); Move(defaultRec.FirstName[0], mystr[1], Length(defaultRec.FirstName)); ShowMessage(PwideChar(defaultRec.FirstName[0])); // SetLength(result, Length(defaultRec.FirstName)); // Move(defaultRec.FirstName[0], result[1], Length(result) * SizeOf(result[1])); // SetLength(S, Length(A)); // Move(A[0], S[1], Length(S) * SizeOf(S[1])); //read the record SetString(result, pwidechar(@defaultRec.FirstName[0]), Length(defaultRec.FirstName)); ShowMessage(result); end; Thank you
  21. Thank you all of you, Previously I did look all sockets demo, but I will check all demos to see how is done. I assume you are saying to do something like this: type TMyRec = record HeaderType: string; FirstName: string[40]; LastName: string[40]; Message: string; end; Thanks again for your time
  22. Hello, I just started using ICS, is there any way to use WSocket and send image as memory stream , if yes I really appreciate any help I get, I found few answers but I have no idea how to buffer and chunk or like that not a professional developer in this matter. I tried this var fstream: TMemoryStream; MyFormJpeg, MyJpegImage: TJPEGImage; begin MyFormJpeg := TJPEGImage.Create; MyFormJpeg.CompressionQuality := 75; MyFormJpeg.LoadFromFile('C:\temp\mycat.jpg'); fstream := TMemoryStream.Create; try MyFormJpeg.SaveToStream(fstream); fstream.Position:= 0; //WSocket1.BufSize:=fstream.Size; WSocket1.Send(fstream, fstream.Size); // wsocket1.Send(MemStream.Memory, MemStream.Size); not working //WSocket1.Send(PChar(fstream), fstream.Size * SizeOf(Char)); finally fstream.Free; MyJpegImage.Free; end; also I can't find way to read on the server side, if possible to help Thank you
  23. You guys are awesome, thanks to all of you , especially qubits posting the complete code, I found latest ICS, installed and your example worked like charm :) Thank you all again.
  24. Thank you so much, I really appreciate your time and help, Thank you again
×