Jump to content

CyberPeter

Members
  • Content Count

    79
  • Joined

  • Last visited

Posts posted by CyberPeter


  1. 2 hours ago, CyberPeter said:

    Oh .. I notice he has something recent as well:
    https://github.com/zhugecaomao/BCHexEditor

    Will have a look

    It compiles fine but for whatever strange reason I can't instantiate the TBCHexEditor class ?  The error suggests pure virtual functions ? In a component class ?  I don't think so.
    That one has got me puzzled.

    There is also a TBCHexEditorEx class that I haven't tried yet.

    The total absence of any documentation is annoying.  No idea what the difference between the two versions is ?
    Meanwhile my day (and concentration) is almost at an end.


  2. 1 hour ago, Bill Meyer said:

    Yes, understood. As far as I know, C++ Builder supports a subset of Delphi

    I'm convinced Delphi would run into the same problems.  The code is simply too old (2007) and hence dates back from before proper Unicode implementation etc.  For a Delphi developer it's probably not that difficult to update the code.


  3. 14 hours ago, aehimself said:

    TStyleManager.Engine.RegisterStyleHook(TATBinHEX, TScrollingStyleHook);

    This is going to be harder for me, not being versed in Delphi.

    I looked it up and it appears TATBinHex needs to inherit from TStyleHook

    https://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.Themes.TStyleHook

    I'm already glad I managed to 'fix' the *.pas files enough so that I could build them into a lib/a file 🙂

     

    Could you share the changed *.pas file where this change is made ?

     

    Things are looking better with the suggested color changes.  I just wish the binary selection was contiguous, not be per byte/cell.


  4. 10 hours ago, David Champion said:

     

    While very impressive, it seems a bit excessive for my needs (assuming I'd be allowed to integrate that in another app)


  5. 5 hours ago, KodeZwerg said:

    Does ATBinHex fit your needs?

    Well, I can get it to work !

     

    image.thumb.png.6c27e2994639674ac192bdb34a2c4e73.png

     

    Of course with Styles it's going to stick out like a sore thumb

     

    image.thumb.png.0a533799affa2225fe0de230e1a38767.png

     

    And I'm not wild about the selection functionality:

     

    image.thumb.png.53161140bccd09691e64e181979709a8.png

     

    But it's certainly a candidate.  I'd have to inherit from TStream then to integrate it in a project where data is read into a buffer.

     

    If there are other candidates, I'd like to know, I'm not 'in love' (yet) with this one 😉


  6. 1 minute ago, dummzeuch said:

    Isn't C++ Builder also capable of compiling and using Delphi code?

    Yes, it looks that way.  Playing with it now.  I thought it only supported it in components that need to be installed.


  7. Thank you for the suggestion KodeZwerg.  I actually did run into this one, a long time ago, so I didn't really consider it this time, during my search.  But I should.  I'll look into it shortly.

    I also found a conversion of this particular component into c++ via an automated tool.  I tried it in CB2009 and while it compiled, it did not work properly.

    I will look into it again however.  It's dated, so I hope it compiles, not being very Delphi savvy (if at all) and hence clumsy at trying to 'fix' it.

    I do seem to recall the hex view selection not being smooth across bytes, rather one (or more) individual bytes (cells) are selected with space in between.


  8. Is anybody aware of a (relatively) simple Hex View 'component' based on VCL ?

     

    I don't need much.  Just a fancy view of a block of data that my application provides (Buffer).

    The typical hex edit look.  Select something in the data block and the corresponding text block on the right gets highlighted as well.

    Perhaps some tweaking, colors, font etc.

    No file IO, no editing, no search functionality etc.

    Mapping a structure against the data is a wet dream for later.

     

    At the moment I simply display text in a TMemo but if there's something out there that I can use without reinventing the wheel, that would be nice.

     

    I don't like to install a component per se, I much rather prefer to instantiate a class, but I use C++ Builder (11.3) so that would rule out Delphi then (?)

    Or better, perhaps I can build a Lib/a from pas files and include that in my project (assuming that works - no experience with Delphi really).

    I realize most people here use Delphi, not C++ Builder, but there is enough synergy I think to wager this question ?

     

    I have been searching without much success.  This is a last sanity check before I give up and move on to something else 🙂


  9. 6 minutes ago, Der schöne Günther said:

    you should be able to commit just parts of your changes / revert parts of the changes.

    Of course, and indeed I do that all the time as well.

     

    What I meant was I may want to edit a form and leave the rest unchanged.

    Then I have one form saved with dpi 150% and the other ones still with 100% .. I think

    Then I'd need to query the form to know with what dpi setting it was saved during design


  10. 2 hours ago, Lajos Juhász said:

    bought a 2k monitor in order not to have to change scaling

     

    Me too but it turns out I'm more comfortable with 150%.

    Not the youngest anymore, reading glasses and all that ..

     

    58 minutes ago, dummzeuch said:

    Or simply revert those changes in the SCM?

     

    Sure, but what about the main form in an opened project ?  Perhaps no changes were saved to file, but already changed in memory.

     

    Also, what if a form needs to be edited, yet all the other forms are still OK and should remain unchanged.

    I have some code that relies on the design dpi, currently hard coded, because I found no way to check the design time dpi per form.


  11. Hi,

     

    I have a C++ Builder 11.2 project that is compiled on a machine with 100% scale setting. 

    I put in considerable work to make sure that dynamically resized objects (based on content, text etc) all scale properly between different dpi monitors etc.

     

    I'm now moving my project to a new main system with a bigger screen and I want to use the default 150% scale setting on this machine

     

    I'm still not 100% on the whole scaling thing.  PixelsPerInch return confusing values sometimes and I'm also not fully sure what is stored during design etc.

     

    My question, if/when I rebuild this project 'as is' on the new system, will it still look the same when deployed on a 100% scaled system etc ?
    Do I need to make changes ?  Re-save all the forms ?

    Any input before I start messing things up is greatly appreciated.

     

    Peter

     


  12. 7 minutes ago, Angus Robertson said:

    We are aware of a problem building ICS packages for Win64 with Delphi 11 Update 2, aka 11.2

    Thanks for the heads-up

    I'm still on 11.1

    I simply link in ics .lib and .a files, built with 11.1

    Any idea if I should rebuild these libraries with 11.2 when I update my main project to 11.2 ?
     


  13. And the morning brings clarity .. 🙂
    Turns out I still had the form's 'TransparentColor' property set to 'true' (Left over from my first attempt, see start of conversation).

    I reset it to 'false' and now above code works beautifully.

     

    This window cannot be moved with the mouse.

    Frankly, I'm not sure what code or setting is responsible for this difference in behavior


  14. On 3/18/2022 at 8:05 PM, Anders Melander said:

     

    Source attached.

    I built and played a bit with your code Anders and it works nicely.

     

    Stubborn as I am I created a smaller class with only a splash, highly inspired by your code (also my old code so it seems, there is certainly overlap - but now I'm able to ignore a lot of old crap and rely on PNG).  Sadly my today's implementation doesn't work fully.  I must be missing something, but I cannot spot it.  Perhaps it's obvious ?

    Anybody any idea as to why UpdateLayeredWindow() always fails with error 87 ( ERROR_INVALID_PARAMETER ). I can't seem to find where the problem lies
     

    //---------------------------------------------------------------------------
    void __fastcall TForm1::Button3Click(TObject *Sender)
    {
    String ResourceName(L"SPLASH2") ;
    
    TSplashScreen *Splash = new TSplashScreen(3000, 100, ResourceName) ;
    
    Splash->Show() ;
    
    }
    //---------------------------------------------------------------------------


     

    //---------------------------------------------------------------------------
    __fastcall TSplashScreen::TSplashScreen(int TimeToDisplay, int Alpha, const String &ResourceName)
        : TForm((TComponent*)NULL), FBitmap(NULL), Alpha(Alpha)
    {
    
        Timer->Interval = TimeToDisplay ;
        Timer->Enabled  = false ;
    
        // Set Layered
        if (SetWindowLong(Handle, GWL_EXSTYLE, (GetWindowLong(Handle, GWL_EXSTYLE) | WS_EX_LAYERED)))
            {
    
            // Background covers whole form
            ControlStyle << csOpaque ;
    
            // Create BitMap
            FBitmap = new TBitmap ;
    
            // Load the PNG from resource
            LoadPNG(ResourceName) ;
    
            // Resize form to fit bitmap
            ClientWidth  = FBitmap->Width ;
            ClientHeight = FBitmap->Height ;
            }
    }
    //---------------------------------------------------------------------------
    __fastcall TSplashScreen::~TSplashScreen()
    {
    delete FBitmap ;
    }
    //---------------------------------------------------------------------------
    void __fastcall TSplashScreen::TimerTimer(TObject *Sender)
    {
    Timer->Enabled = false ; // This event only once
    
    Hide() ;
    
    Application->ProcessMessages() ;
    
    delete this ; // Self destruct when time is up
    }
    //---------------------------------------------------------------------------
    void __fastcall TSplashScreen::FormShow(TObject *Sender)
    {
    Display(Alpha) ;
    
    if (Timer->Interval)
        Timer->Enabled = true ;
    }
    //---------------------------------------------------------------------------
    void TSplashScreen::LoadPNG(const String &ResourceName)
    {
    TStream *Stream = NULL ;
    
    __try // Load PNG from resource (which must be added to the project)
        {
        wchar_t Type[] = L"PNG" ;
        Stream = new TResourceStream((NativeUInt)HInstance, ResourceName, Type) ;
    
        TPngImage *PNG = NULL ;
        __try
            {
            PNG = new TPngImage ;
            PNG->LoadFromStream(Stream) ;
            FBitmap->Assign(PNG) ;
            FBitmap->PixelFormat = pf32bit ;
            FBitmap->AlphaFormat = afPremultiplied ;
            }
        __finally
            {
            delete PNG ;
            }
        }
    __finally
        {
        delete Stream ;
        }
    }
    //---------------------------------------------------------------------------
    void TSplashScreen::Display(int Alpha)
    {
    // Position bitmap on form
    POINT BitmapPos = {0, 0} ;
    SIZE BitmapSize = {FBitmap->Width, FBitmap->Height} ;
    
    // Setup alpha blending parameters
    BLENDFUNCTION BlendFunction ;
    BlendFunction.BlendOp = AC_SRC_OVER ;
    BlendFunction.BlendFlags = 0 ;
    BlendFunction.SourceConstantAlpha = Alpha ; // Transparency Value (255 is not transparent, 0 is fully transparent)
    BlendFunction.AlphaFormat = AC_SRC_ALPHA ;
    
    // Display
    if (!UpdateLayeredWindow(Handle, 0, NULL, &BitmapSize, FBitmap->Canvas->Handle, &BitmapPos, 0, &BlendFunction, ULW_ALPHA))
        {
        DWORD Error = GetLastError() ;
        }
    
    Application->ProcessMessages() ;
    }
    //---------------------------------------------------------------------------

     


  15. 16 hours ago, Lajos Juhász said:

    You would have to make several version of the picture in order to have good results in every possible combination of DPI settings.

    Oh cr@p, good point.  Not doing that though 😉

     

    15 hours ago, Anders Melander said:

    Source attached.

    Oh wow, thank you very much Anders.

    I'm not good with Delphi (at all), so I will need some time to digest this.


  16. My app has a splash screen, but it was created at least 16 years ago (BCB5 I think) and I'm really ready for something else.

    It's based on two BMP's.  One is used as a mask to tell the code what should be transparent.

     

    Instead of hurting my (currently covid impaired) head trying to figure out the old code and ancient methods of then, surely VCL Forms and graphic support has evolved to something where this is a lot easier to do ?

    I recently upgraded to C++ Builder 11 (coming from Builder 2009)

     

    I was thinking of finding a graphical artist who can make me a nice *.png that I then use as splash screen.  It's far easier to ask someone to make a nice PNG than to describe the need for two BMPs, one of which acts purely as a mask etc.

     

    I tried a few things with a free test.png found on the net (artist unknown), but I'm not having the easy success I hoped I'd have.

     

    Are there good and easy ways to do this using Builder / Delphi 11 ?

    I looked around but wasn't very successful in finding documentation.  I see Anders has a couple blog posts about it, but that too seems outdated (correct me if I'm wrong).

     

    The easy:

     

    - I created a Windows VCL test app

    - Set Form BorderStyle = bsNone

    - Plonked a TImage on the form (Align = allClient)

    - Loaded the test.png in Image1's Picture at design time

    - Compiled.   Works nicely but of course the form color shows where the PNG is transparent

    - I then set the Form background to MoneyGreen, TransparentColor = true, TransparentColorValue = clMoneyGreen

    - Compiled.  Nice result but the PNG half transparent regions blend with the green color, and are hence not blending with the background.

    - The net result is sadly not perfect.  It was simply too easy 😉  I made this screenshot on a white background.

     

    image.png.2488a5f90495fff2e14a7b71c71e7450.png

     

    If I set AlphaBlend = true and give it an AlphaBlendValue = 100 (for instance) there are certainly very nice additional features to play with:

     

    image.png.e15276685f98953883a4cdafc2838265.png

     

    Now, this doesn't need to be total failure. 

    - I could experiment with different Form background colors and see how they interact with the half transparent fields of the PNG.  Perhaps the net result is pleasing.

    - I could ask the artist to make me a transparent PNG but with well defined edges that don't blend, that are not half transparent.

     

    In conclusion, as far as super easy methods go, this certainly is not a bad start if a good color compromise can be found for the blending issues and/or depending on the PNG.

     

    But ... perhaps I'm missing quite a few things that can be done to achieve a perfect result ?

    Please let me know.

     

    Thanks.

    The test.png also attached:

     

    test.png

    • Thanks 1

  17. 12 hours ago, M.Joos said:

    AFAIK, they have outsourced at least some parts of their development to a huge center in Ukraine - maybe that's an explanation.

    It would explain a lot.  But they owe us transparency.  It should be part of the 'contract' we entered when we paid the license fee.  We're not a knitting group, we're all professionals trying to get our work done.  We need to know what is happening (to some extent) and what is being done about it (to some extent) so that we can properly plan and communicate to our 'dependants' (customers, management, ..)


  18. I recently upgraded my old C++ Builder 2009 to C++ Builder 11.  It was time .. and I wanted to make use of the new GUI improvements (Styles, Scaling, High DPI etc).  GUI stuff in other words.

    To that end I spent a lot of money to get a license.  Everything is relative, but to me this is the biggest investment in quite some time and the biggest software investment ever.

     

    I have always been happy with Builder 2009 and yes, there were some issues that I had to work around, but not too many.

    Since I have upgraded I have already reported close to 20 bugs.  Never ever did I have to ..

    It's also making me nervous as to when these things will get fixed, if at all, as it impacts my work.

     

    The silver lining at least was that my bugs triggered interaction.  I saw them being escalated to development or they were assigned to me again to provide more information.

    All that has stopped in the last few weeks.  For all the last bugs there has been zero interaction.  Nothing, as if nobody cares.

     

    The GUI work involves custom controls for which I need the help files, to be able to apply the Styles properly etc.  In itself already poorly documented but for 3 weeks now docwiki has predominantly been unavailable.  There are already other posts about that, so I won't get into the specifics of that, but it adds to what looks like a systemic failure.

     

    - Many bugs in the very features they're touting about and that convinced me to upgrade

    - Nothing appears to be done about it, nobody seems to care

    - Docwiki offline, nothing seems to be done about it, nobody (at embarcadero) seems to care

     

    The person most responsive in QA before and who has not responded anymore has a Ukrainian name.  Perhaps coincidence, perhaps my paranoia but how exposed is Embarcadero development and support to Ukraine.  Is this the reason for all the recent issues ? If so, communicating about it would at least renew confidence.

     

    All this nonsense would not be necessary if they would just COMMUNICATE about the issues (docwiki for instance).  The silence only feeds the idea of a failing company or at least a failing product and I feel bad for having invested my time and money in this at this stage.

     

    My 'happy life' with Builder 2009, the type of work I'm doing with it and the low exposure to issues may have made me blind to something that is well known and has been happening for years ?  I don't know ?  Maybe I shouldn't worry because this is business as usual ?  In which case I wish I had done my homework though.

    • Like 4
    • Thanks 1
    • Sad 2

  19. Thank you Angus.

    I downloaded the overnight zip and built the run-time packages again.  I did not bother with the design time packages this time as I don't need them anyway.

    All built OK and I could use the *.hpp files together with the *.obj / *.o files to get HttpCli to work in a 32 and 64 bit test app.

    I saw the exact same result as with previous overnight zip that I tried.

×