Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Tntman last won the day on April 1

Tntman had the most liked content!

Community Reputation

10 Good

About Tntman

  • Birthday 03/05/1870

Technical Information

  • Delphi-Version
    Delphi Community Edition

Recent Profile Visitors

159 profile views
  1. Tntman

    Mixed resources type 12

    I know but win api is too difficult for me, but i need to learn it eventually .. I did not even know that this exist, it is really interesting i will definitely take a look into it, thanks BTW, do you know why we have such a difference in size when SS is saved? Here is the code : procedure unasit3(); var DCDesk: hdc; bmpVCL, test: VCL.Graphics.TBitmap; bmpFMX: FMX.Graphics.TBitmap; // bmpVCL -> MS -> MS -> bmpFMX MS: TMemoryStream; begin bmpVCL := VCL.Graphics.TBitmap.Create; bmpVCL.PixelFormat := pf4bit; bmpFMX := FMX.Graphics.TBitmap.Create; MS := TMemoryStream.Create; bmpVCL.Height := Screen.Height; bmpVCL.Width := Screen.Width; DCDesk := GetWindowDC(GetDesktopWindow); BitBlt(bmpVCL.Canvas.Handle, 0, 0, Screen.Width, Screen.Height, DCDesk, 0, 0, SRCCOPY); bmpVCL.SaveToStream(MS); MS.Position := 0; bmpFMX.LoadFromStream(MS); bmpFMX.SaveToFile('unit3FMXBITMAP.png'); bmpVCL.SaveToFile('unit3VCLBITMAP.png'); bmpVCL.Free; bmpFMX.Free; MS.Free; end; VCL Bitmap have 1.31 MB FMX Bitmap have 79 KB Thats size on disk .. When I open images they look 100% the same , i cant see the difference in quality even if i zoom in .. is there any explanation for that strange behavior ?
  2. Tntman

    Mixed resources type 12

    I reorganized my code, im now explicitly assigning values from different units. For example bitmapVCL : vcl.graphic.bitmap... Bitmapfmx : fmx.graphic.bitmap and so on... And it is working perfectly fine.. I think i will not have errors in my program if i am not adding visual components like memo from vcl and memo from fmx But i will consider learning/remaking units..
  3. Tntman

    Mixed resources type 12

    I was thinking the same, but isn't a delphi compiler doing that behind the scenes ? ( trimming unused code ) ?
  4. Tntman

    Mixed resources type 12

    IT is too difficult for me to figure out and understand code samples that i found on the internet for accessing webcamera on windows ( VCL ) .. I am making some sort of twitch bot/streaming application where i plan to exchange data bettwen users and twitch API + Twitch IRC . In my app i want to have feature for user ( streamer ) to have a nice preview what options he have on his camera ( resolution,fps etc ), also I want to add some features like taking a screenshot of his game that he is playing or whole screen, I have 3 options, to make FMX or VCL app. If i want to make FMX app it will be tricky to take screenshot of particular window or whole screen with fmx due to fmx.bitmap nature.. I basically cannot assing bitmap.canvas.handle when i want to take a screenshot. this piece of code is impossible if using bmp from FMX.Graphics. So i have to take screenshot with VCL.Graphics.. SO that means that i am using VCL units in my FMX project ( Mixing again .... ) Other option is to make VCL app that will do screenshot as it usually do with VCL.Graphics bitmap. And to use FMX.Media for accessing webcam properties .. ( Mixing again ... ) Third option is to Make VCL app and LEARN how to access camera options in VCL <- Hardest part ( not mixing fmx and vcl ) .... I guess that third option is best way to go and I think that i should try to re-learn and figure out how code that I found online works..
  5. Tntman

    Mixed resources type 12

    Hi, I am making VCL app but I am mixing FMX units in it. Reason why I am mixing FMX units is that i wanted to detect if webCamera exist, I am using this tutorial ( official embarcadero sample ) to detect it and display useful information ( resolution and fps options ) that camera have: http://docwiki.embarcadero.com/CodeExamples/Rio/en/FMX.CameraComponent_Sample This example works fine even in VCL app, but there are some errors and warnings that i am getting when compiling application.. Again, I have to say that it compile with success and it works im just wondering is there any way to fix this issues and warning and should i do ( approach this ) differently ? I know that it is bad to mix VCL and FMX , but unit "FMX.MEDIA" is such a nice unit that gives me a lot of nice features and i cant see similar unit in VCL... I have to mention that I am actually not mixing VISUAL components on form, I am just using only VCL components with FMX.Media unit and methods from it.. Here is error pic: It basically says that it is keeping FMX resources and discarding VCL one Also I have to say that when i comment FMX.Media unit and other places where I am using its code i stop receiving warnings during compiling.. It is obvious that those warnings are because i used FMX.Media unit..
  6. If you are using third party api read the docs there.. They will maybe tell you how much requests are you allowed to send in some amount of time.. Also when you get response from server in 99% of cases they will return amount of requests that you have left to perform in some amount of seconds.. Best way is to use program called postman to simulate requests and see whats going on, it will give you detailed information about everything.. My answer is maybe not what you are looking for but i think that postman will help you to understand better what's actually happening instead of using delphi code to figure out.. After successful tests in postman you implement and write delphi code, that's how i am doing usually
  7. My application is connecting on twitch irc and reading msgs from there.. Its not from DB so it is more dynamic, admins on twitch irc can delete some message or users can delete so i have to update particular frame if message is deleted... Thats why i am using frames with name so i can figure out what to delete or edit... I think we are not talking about same frame types, i am using this type of frames :
  8. Your answer was really helpful, i almost finished my example today but i can see that i will edit it tomorrow based on your post.. This is something that i did just for demo to see what will happen if i load 'n' amount of messages ( frames) 'at the same time', basically just for testing purposes to see how fast it will perform and to simulate message received.. I did not know that I could do this, it really saves time and boost performance knowing that i will have 2k messages for example ( looping over 2k frames) i will edit that part in my code based on your advice.. In my first post i mentioned this that it looks bad way of doing things so i just abandoned this idea This looks interesting but as I said i think i dont need array of anything in this case because when i add Tframe ( message ) component dynamically on listbox i will give a new tframe component name of message ID, so basically i will never get error that component with particular name already exists because ID's are all different.. . When removing message im just grabbing component name ( tframe name) and performing a look ( looping to find that frame in listbox) and after that i am performing disposeOf. Well my gui that i made is really intensive and i decided to use frame to represent a message in chat room, so when new message arrives i am creating new tframe ( message) and attaching it to parent listbox, if i dont name it or if i name 2 components with same name im getting error so that is why i am giving unique name to every tframe component
  9. Thank you for your answers i enjoyed reading them 🙂 Looks like that I made problem without problem. I overcomplicated everything for unknown reason ... IN short, my app receive messages and user can delete them. Every message have parent listbox and every message is basically custom looking frame that i made. So simply when use receive new message I am creating new frame that will have Listbox as a parent and frame name will be message_id. That way i will not have errors because every frame will have unique name ( message_id ). When user deletes message I am just simply looping frames and if that particular frame exists i am removing it.
  10. I am using delphi fmx for windows 10. I have listbox that will have list of messages. every message is inserted in that list box as a fmx frame. I decided to use this as a frame because I can get more nicer GUI look. I am simulating creating and deleting messages ( Frames ) by clicking on buttons. So I am basically making front end of the application and I want to make it good working before i actually hook it to internet. I am trying to practice oop and good design patterns so that is why i want to share with you how i did all this so you can give me suggestions how to improve. So I have listbox, when i click button1 i am triggering this code that will add 10 messages ( 10 frames ) to a listbox. for i := 0 to 10 do begin randNumb := Random(9900); messageList[randNumb] := TListBoxItem.Create(Self); messageList[randNumb].Parent := ListBox1; messageList[randNumb].Selectable := False; TFrame1.Create(Self).Name := IntToStr(randNumb); with TFrame1(FindComponent(IntToStr(randNumb))) do begin Parent := messageList[randNumb]; //Frame ID is public int property in Frame unit, i will need it later when I am deleting message ( frame ) frameId := randNumb; Label1.Text := 'Message body'; LabelName.Text := 'John Doe'; Country.Images := ImageList1; end; MessageList represents public property -> MessageList : Array [0 .. 9900] of TListBoxItem; I set array size from 0 to 9900... randNumb presents random number ( index ) that will be given to every messsage ( frame ) Property frameId have same value as name of the frame that i am creating dynamically. When I want to delete message ( frame ) I first click on the frame. When I click on the frame I am triggering OnClick event that is located in Frame unit, after that I am deleting message ( frame ) by using "DisposeOf". I have noticed that i also have to call "DisposeOf" not just on frame, i have to call it on MessageList also. So i am also doing MessageList[frameId].DisposeOf; and frame is deleted , also item in MessageList is deleted. ********************** Everything so far that I wrote is working but it does not feel right... 1. I want to add new message ( frame ) with an ID that is incremented by 1 compared to biggest index in my array. SO if i have 10 messages , when I add next message I want that message index to be 10+1 =11.. 2.Lets say that i have 10 messages , and i delete message with index of 5. What will happen with other message indexes ? is my MessageList array going to shrink or it will just leave empty space where is index 5 ? Will message that had index 6 before deleting message 5 go and drop down for one place and have index 5 ? will message with index 7 drop on 6th place and so on... ? 3.I could possibly make MessageList array with unknown length and everytime when i want to add new message i can check length of MessageList array and resize it for +1 and add that item on the end.. but still i have feeling that this is not a way to make this ... I was reading this : https://stackoverflow.com/questions/433221/how-do-i-declare-an-array-when-i-dont-know-the-length-until-run-time Third message says " If your array is no longer static, you might want to consider using a TList, a TStringList or one of the many container classes in the Contnrs unit. They may better represent what you are doing, provide additional capabilities you might need, e.g. sorting or name/value pairs, they dynamically grow as you need them, and have been very well optimized. " So my conclusion about this is that I have to find some correlation between TList or TStringList that i have to create and MessageList : Array [0 .. 9900] of TListBoxItem that I already created because my list of messages ( Frames ) will grow and shrink dynamically and I dont want to manually figure out how to do it.. I am not sure, maybe my whole concept is wrong from beginning Thank you for your help
  11. Tntman

    WM_MOUSEMOVE message

    Maybe try to unplug your mouse to see it you are still going to trigger it ? Maybe your mouse is too sensitive and you cant notice that with your eyes I cant give you other suggestion but this is what came on my mind
  12. Tntman

    Software architecture [indy?]

    I got it now, problem is that i dont have idea how could i use http with this In my little demo that I made i was using this as a reference -> https://stackoverflow.com/questions/22838159/indy-tidtcpclient-receive-text -> first demo without thread and with timer... i just remodeled a little bit using IdThreadCommand instead of timer -> event OnRun -> if IdTCPClient.IOHandler.InputBufferIsEmpty then begin IdTCPClient.IOHandler.CheckForDataOnSource(10); if IdTCPClient.IOHandler.InputBufferIsEmpty then exit; end;
  13. Tntman

    Notification custom look

    I really like them xd , maybe I add option for user to check if he wants custom or regular windows notifications or he wants to turn them off.. Im not sure what do u mean but it is something like this -> https://subiz.com/blog/wp-content/uploads/2014/09/subiz-desktop-notification.jpg so it is custom look and feel with colors ,labels,images and all other stuff that I want to show.. I dont want to give all info about my app, top seceret 😈 lol .. JK, it is some type of chatting app .. If u need vcl or fmx demo how i did it i can make it for u , but it is not that hard
  14. Tntman

    Notification custom look

    Yes , in my app user can toggle on / off if he wants to get custom notifications.. Anyway I dont think that anybody will use my app its more for myself to learn more 😄 that is why i created design in PHotoshop and started making it
  15. Tntman

    Software architecture [indy?]

    There is indy tcp client and indy tcp server , planed to use them for message format i planned to use simple json something like this : [ command:"ListOfAllComputers" { professor: "ProfesorName", classrom: "NumberOfClassrom", socketID: "socketIDGoesHere" }, { professor: "ProfesorName", classrom: "NumberOfClassrom", socketID: "socketIDGoesHere" }, ] So in my mobile app if command = ListOfallComputers i loop over json object and display it in listview for example.. i can receive that "command" and whole data in indy tcp server onExecute event or in indy tcp client by checking if buffer is empty.. When I want to send file , I will choose file and select professor name from the list. Behind the scenes i will grab socketId from certain professor and send file to it. On professor PC i have built in events ( indy tcp server ) onExecute and on id tcp client side there is some function to check buffer is empty "IdTCPClient.IOHandler.InputBufferIsEmpty" <- im not sure if this is how it is actually called because I dont have rad studio opened now.. So if buffer is not empty and command = downloadFileFromMobile my desktop program will accept that file and save it .. Thats some logic, basically i think that in theory i could use both ( indy tcp server and indy tcp client ) because there is no actual main SERVER ( any device can be server or client ).... maybe I am wrong but I already tried to make simple text exchange with indy tcp client and indy tcp server components and it worked There will not be auth or encryption i will not use SSL , whole app is proof of concept ( in the end i could hard code some values in source code that will be used for auth <- i know what this is not the right way , just saying ) Sorry my bad Never planned to use UDP as it seems to be much harder and i actually never heard of UDP multicasting , i will try to read more about it