Jump to content

David Heffernan

Members
  • Content Count

    3480
  • Joined

  • Last visited

  • Days Won

    171

Posts posted by David Heffernan


  1. Very hard to see anything useful coming from this. Can't imagine any way for Delphi to directly consume a managed assembly other than COM. 

     

    I'd consider making your own COM wrapper of the assembly, using C#, or writing a Delphi wrapper around the C interface. 


  2. You are working with Unicode strings so you will always get varUString. I don't know what you have against varUString. Surely you don't want to go back to ANSI strings which is what varString represents. 

     

    VarAsType returns a variant. That's why you need a typecast to obtain other types. 

     

    The entire question seems massively over complicated. In fact this is a common theme of the questions you ask. Don't take that the wrong way. But my most important advice to you is to try to simplify. You seem regularly to get tied in knots because you don't reduce the complexity in your thinking. 

     

    In this instance, surely, you should be working with the user input as text. No need at all for variants in my opinion. Simply use TryStrToInt to check if a string value can be treated as an integer. 

     

    And if there really is some need for variants due to motivations we cannot see then take care to understand what types they can hold. Make sure that you only ever add Unicode strings and integers and therefore only need to deal with those two var types. Raise assertion exceptions if you encounter other types. Make sure that you have good testing in place. 

     

    Now, you probably think that you haven't got time for testing but what many people don't realise is that testing saves you time. Testing is what allows you to make changes to code without fear of breaking it. 

     

     

    • Like 2

  3. 4 hours ago, Neutral General said:

    I've got an application (windows service) that (in the best case) shouldn't be shutdown ever. But there are going to be updates to the application. So in order to not have to shut down the whole service, the service is modular and can just temporary unload a DLL, update and then reload it. That's not really doable with a monolithic application.

    It will be shutdown when the OS updates. Also, if you want to make it hot upgradeable, make a monlotihic DLL hosted in a thin executable. 


  4. 1 hour ago, dummzeuch said:

    You won't notice if the text gets too small to read.

    No. But then the user with such a monitor will notice and increase the DPI. Such a problem will affect all programs. 

     

    You certainly don't need a 4k monitor to test DPI scaling but you do need multiple monitors to test per monitor DPI scaling. 


  5. 2 hours ago, dummzeuch said:

     

    The option I was talking about is called "Notify on language exceptions".

    I know, but if you want to break on an exception, why would you disable that? Writing naff code instead of using the tools of the debugger is pointless.

     

    My question was rhetorical. If you disable debugging, it would be odd to then jump through hoops to debug your program. 

×