Jump to content

aehimself

Members
  • Content Count

    1090
  • Joined

  • Last visited

  • Days Won

    23

Posts posted by aehimself


  1. 2 minutes ago, pyscripter said:

    The bug is not related to frames.

    I had a guess about it, but since at me it is on a frame... but you are right, let me rephrase it to "moving Items.Clear to the owning component's BeforeDestruction event" to be more inclusive 🙂


  2. Hello all,

     

    I was trying to get my head around this for a while but I simply can not find the solution. In my project I have a frame which I create runtime on a TTabSheet. On this frame I have 2 TTreeView components. 1 is on the frame itself, the second one is on an inner tabsheet:

     

    image.thumb.png.d780d91d9793db104c89bfdcbe213fbb.png

     

    Now, if the TreeView on the TabSheet has ANY items created if the application has a VCL style active, those items will not be freed up. I put a breakpoint in TTreeNode.Destroy and I can confirm that those are ONLY being called for nodes in the other TreeView.

     

    I even put TreeView2.Items.Clear in the frame's destructor, but as Owner.HandleAllocated is false at that stage, deleting all nodes never happen. So I put a breakpoint in the frame destructor and TTreeNode.Destroy, and the thing I quickly realized is that the nodes of the first TreeView are being freed before the destructor, because of a window message (TVN_DELETEITEMA or TVN_DELETEITEMW). This is actually deleting the nodes in Vcl.ComCtrls.pas : 11910.

     

    But, this message is sent only to the TreeView on the frame, not to the one in the PageControl. Again, only when VCL styles are active.

     

    I will try to send this message manually in the destructor (or explicitly deleting all nodes...?) to see if it solves my issue, but it bugs me to hell that I don't know what is happening.

     

    If I'd know where this message is sent, I could investigate why it is sent to / received by one TreeView only.

    Anyone has any ideas?

     

     

    Edit: Manually trying to delete nodes will fail, as TreeView.Items.Count shows 0 at the destructor already.

     

    Edit-edit: I have an event on the frame itself which is being called BEFORE the .Free is called upon the owning tabseet. If I move TreeView2.Items.Clear in that handler, the memory leak disappears. I guess it's an other quirk of the VCL styles but I'd still like to know the reason...

    • Like 1

  3. 6 hours ago, M.Joos said:

    Specifically you would not want for the components to be recreated. Have a look at the TReader events, specifically TReader.OnCreateComponent

    I already started to experiment with the TReader component, unfortunately OnCreateComponent will only let me to use a different constructor other than the default. If the component is not created in the handler it will be created anyway.

    This thing is still a mess to me though... how do I specify WHERE the new components will be created...? As it needs a stream I need to get it from the executable - I guess it will be stored as a resource...?

    I'm only at the beginning. I'll find the answers soon enough.

     

    6 hours ago, Uwe Raabe said:

    What about creating a new form instance and adjust the components and properties in question from that?

    This is actually a really neat idea. As the TReader method will create the components anyway I suppose the memory usage will be close to equal anyway. As a huge bonus, I know how to create a new form instance 🙂

     

    3 hours ago, Stano said:

    A Tag can be used for this purpose. Unless it is used for something else.

    An other good idea. Tags are - unfortunately though - already in use in said project 😞

     

     

    I'll dig into the TReader a little bit so I'll have a basic understanding of how it works / what it does. It never hurts to know something, you never know when you'll need such a thing.

     

    Thank you all for your answers!


  4. Hello,

     

    I have a method that hides, rearranges and resizes components based on some conditions runtime. All is working fine, but the question eventually arrived: is is possible to "reset" everything to it's original (design time) state?

    Instead of creating a list of all changed components (and it's properties) I'm wondering if it's possible to re-read and re-apply the .DFM settings to a number of selected components?

     

    A list would be easier, but the DFM streaming seems to be the "professional" way to do it.

     

    I guess I'll need a TReader for that but I have absolutelly no idea how that works 🙂


  5. On 2/8/2021 at 3:49 PM, Anders Melander said:

    I don't care about the minor improvement in compile speed sharing DCUs can give me. I do care about the time that is wasted when I have to track down some obscure problem caused by using out of sync DCUs.

    Let's say I have aeSuperDuperUtilities.pas and I compile it to all platforms, all configs. Then I set my library / debug DCU path to the relevant output folders, browsing path to the source.

    If I make a change in said unit, I recompile it again with all platforms / configs.

     

    At the moment I cannot imagine a way how any of the compiled DCUs would get out of sync. Then again, most probably I never worked on as many, as complex projects as you did.

    Can you please give me a theoretical scenario / direct me to an article so I can learn more about this?


  6. 3 hours ago, Anders Melander said:

    Bad idea IMO.

    Sharing DCUs among projects only leads to problems in my experience. When I do a clean build I want everything built from scratch, with the options I have enabled at that time. I don't want the compiler to link in some old DCUs that were compiled with god knows what options.

    I did not really make components up until this point - maybe that's why I never faced an issue you are talking about. But if I'm not contributing to a component the practice of "download / update -> rebuild DCUs -> ??? -> profit" always worked for me.
    It seems being the end user has it's benefits sometimes 🙂


  7. So back to the original topic I went ahead and created the two packages based on the article @dummzeuch shared. I coped everything from the original package to this, changed the platform to Win64 and moved the parts what caused the compilation to fail to the design time package (Only design time editors and registration procedures). It worked 🙂

     

    I was finally able to build 64 bit DCUs but then I realized that my design time package contains only ~4-5 of the 20 components. A quick search showed that there are still at least 40 files with RegisterComponents call in my new runtime package, but it still compiles... is this normal? 🙂


  8. 10 hours ago, David Schwartz said:

    I don't get this at all. I've got a Mac Mini and MacBook Pro from 2014 with only SSD and thousands of hours of use, and have had no problem with either one. 

    The best way to prolong the life of your equipment is to not use it. Next to that, drive it until it dies, then replace it. Fortunately or unfortunately, Apple's hardware seem to last a very long time. (I did have to get the base of my MBP replaced because the battery started bloating up; they salvaged the main board and top cover and display, but replaced the rest of the base including the keyboard.)

    * Sigh *


  9. I like to compile my components and let Delphi use the existing DCUs in my projects. Having my sources on SSD this not just saves time but prolongs the life of the data store as well.

    I recently started to experiment with a component suite which was written as a blob, runtime and design time in one, therefore I can not build 64 bit DCUs.

     

    I never really thought of creating my own component packages and therefore I have 0 experience with this. Are there any tips, tricks or resources that can help me achieving my goal? At the moment I can't even tell how to distinguish what is considered runtime and what is designtime 🙂


  10. 22 hours ago, jonnyg said:

    Mike Shkolnik at scalabium.com has a freeware dbGrid.

    As I recall, it's part of a larger freeware component package

    Today I switched my search engine and found SMComponents. I have to do some extensive testing to see what I have to add or fine tune but holy sh*t this DB grid looks promising!

    I'll play around with it for a while and then try to build 64 bit packages out of it.


  11. Hello,

     

    A while ago I started to patch up the dumb TDBGrid component shipped with Delphi. Added some things, fixed some things and now I face an issue where the bottom-right square where the two scrollbars meet flickers white for a moment in some occasions (using a dark theme). I think I know where the bug is but to be honest at this point I'm thinking on abandoning my creation and using something else what someone made, who knows more about this stuff I do.

    I am willing to spend the same amount of money on a program I earn from it but I use DBGrid in a free tool... so my budget is kinda... tight 🙂

     

    Worst case scenario I'll patch on my ocean of patches until a new one arises. I'm just curious if anyone is using a decent component (or suite) which I can experiment with?

     

    I already tried KControls and JVCL.

     

    Thanks!


  12. @Dany Marmur as far as I can see @EgonHugeist already started the development of the Zeos-based memory table.

    The latest snapshot already has the TZMemTable component - now it's time to start to play with it!

     

    Edit: Seems to be working as it should:

    procedure TForm1.FormCreate(Sender: TObject);
    begin
     ZMemTable1.FieldDefs.Add('MyField', ftWideString);
     ZMemTable1.Open;
     Try
      ShowMessage(ZMemTable1.RecordCount.ToString);
      ZMemTable1.Append;
      ZMemTable1.FieldByName('MyField').AsString := 'Hello world!';
      ZMemTable1.Post;
      ShowMessage(ZMemTable1.RecordCount.ToString + sLineBreak +
                  ZMemTable1.FieldByName('MyField').AsString);
     Finally
      ZMemTable1.Close;
     End;
    end;

    At the moment it throws a nullpointer AV if it's destroyed while it's open but I'll send a pull request with a fix in a minute.

    • Like 3

  13. There are 2 things you have to keep in mind:

    1, IV, as @Kas Ob. pointed out. You must find out what IV your PHP encryption is using (if any). Afaik, DCPCrypt will use the part of the key as an IV, if not given any but I might be wrong here.

    2, Character encoding. Delphi 7 is ANSI, and a web interface is usually UTF-8. So you take an UTF-8 string, encrypt and Base64 it. If you unbase64 and decrypt it you still have to do an encoding conversion, otherwise the result will be not a valid string for Delphi.

     

    What I advise at first: check the raw text and the encrypted binary (before Base64-ing it) with a hex viewer. Then, check the received binary (after unbase64ing it) and the uncompressed "text" with a hex viewer; that can already give you a hint.

     

    I personally abandoned the EncryptString / DecriptString a long time ago. I'm converting strings to TBytes (Array Of Byte) and performing the encryption on the binary data.

     

    Edit: I was wrong about using the key as IV. It just generates one for itself:

    procedure TDCP_blockcipher64.Init(const Key; Size: longword; InitVector: pointer);
    begin
      inherited Init(Key,Size,InitVector);
      InitKey(Key,Size);
      if InitVector= nil then
      begin
        FillChar(IV,8,{$IFDEF DCP1COMPAT}$FF{$ELSE}0{$ENDIF});
        EncryptECB(IV,IV);
        Reset;
      end
      else
      begin
        Move(InitVector^,IV,8);
        Reset;
      end;
    end;

     


  14. Hello,

     

    I know that madshi has it's own support forum, I'm mainly looking for personal experiences. We have a large Delphi application with MadExcept purchased and integrated already. When I put the line "StartLeakChecking;" in this project, random nullpointer access violations start to happen... for example at TSpeedButtom.Glyph.Assign, because TSpeedButton.Glyph is nil. Errors do not appear without StartLeakChecking, with ReportMemoryLeaksOnShutdown := True or when debugging via DeLeaker.

    I am also aware that the main purpose of MadCollection is not to detect memory leaks, it's just something added as an extra.

     

    So my question is... should I stop trying and just accept that this function is flawed? Do you guys have personal experience with MadCollection's memory leak detection in large projects? Has anyone seen these random AVs too?

     

    Thanks!


  15. I am using 10.4 and I used the built-in; and also made my own DB grid inherited from the built-in one. All works like a charm.

    Does your Delphi say it doesn't know what TDBGrid is or cannot find the Vcl.DBGrids unit?

     

    Anyway, doublecheck the library locations / just start with a fresh registry (bds -r temp) to see if the issue is with the installation or your settings.


  16. Tbh, in majority of the cases removing the HKCU Embarcadero registry tree and the general Delphi folders (C:\ProgramData\Embarcadero, %USERPROFILE%\Documents\Embarcadero) is sufficient for a clean start.

    You just have to be careful if you have multiple Delphi installations.

     

    I myself is going to have to do this at work soon as most of my toolbar buttons stopped functioning after a Windows update...


  17. 1 hour ago, mtjmohr said:

    Due to you help, dear friends, I have been successfully able to create both x86- and x64-applications under the original scheme (EXE and DLL) - I have taken the latest source code I could find, associated the files to each other which, version-wise, belonged to one another, and compiled them.

     

    There have been some string warnings so far, but none of them hindered compiling. The port is detected correctly, and data can be transferred using the "HL7Sender" test program (I will show you a screenshot in a minute).

    Congratulations! Now you can re-think, restructure and modernize your code if you wish (what I strongly advise if you'd like to run it as a service, btw).

     

    1 hour ago, mtjmohr said:

    Generating a md5 hash to identify the authenticity of my software - how can I do this? By using an external tool?

    Since you are already using DCPCrypt, you can use TDCP_MD5 for this purpose. Question is what you want to achieve? Self-diagnosis?

     

    1 hour ago, mtjmohr said:

    Does it make any sense to compress the EXE using EXE obfuscator or security tools such as UPX or ASPack?

    I don't know about ASPack, but UPX is NOT an obfuscator. It's a compressor. An executable you compress with it can be uncompressed to it's original form in a fraction of a second (to be precise - that is exactly what a packed .EXE does)

     

    1 hour ago, mtjmohr said:

    Does it make sense to have the software provided with a registration or licence key?

    That is something what you have to know. Proper licensing is really complex and a never ending cat-and-mouse game. On the other hand, you'll earn your daily bread.


  18. So the layout is somewhat like this:

     

    image.thumb.png.329f981cbd06197cd7f21f76ac22c59e.png

     

    Since I got lost somewhere, I'll start from the beginning. Do you have a FUNCTIONAL issue with the application now (meaning, not the warnings in the source but something not working / not working properly)? If yes, where?

    A bit off-topic: is there any particular reason why the packet verification resides in a DLL? If no other application is using it I feel like it only adds unnecessary complexity and points of failure (see one of my first replies about allocations).


  19. Let's take one step at a time. String conversions (AnsiString vs. String) will only matter in data transfer / storage but as far as I understand, you can not even connect with your application. Is that right?

     

    I'm a bit confused. You said that TCP port 3000 is listening by your Python script...? Shouldn't your application be listening there (that's what TServerSocket does; it listens and accepts client connections)?

    Can you share some basic layout of your application? What is running where, what should connect where, etc.

×