Jump to content

PeterBelow

Members
  • Content Count

    99
  • Joined

  • Last visited

  • Days Won

    6

PeterBelow last won the day on August 11

PeterBelow had the most liked content!

Community Reputation

64 Excellent

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Timer messages have low priority. If your DoProcessMessages call takes longer than the message interval then a timer tick will not add a new wm_timer message to the queue but increment an internal count for the message already in the queue. Use a waitable timer and one of the MsgWait API functions instead of SetTimer,
  2. PeterBelow

    Resolve a uses clause unit path?

    Well, there is a FileSearch function in Sysutils that will search for a file in semicolon-separated list of directory names, but of course you still have to extract the library path from the IDE settings (= registry key, specific for an IDE version), the search path from the current project, if relevant, replace any macros ($(name)) in the pathes etc. to get the list of folders. I'm not aware of a ready-made function for this exposed in the RTL or Open Tools API.
  3. PeterBelow

    The Embarcadero GetIt server could not be reached...

    https://community.idera.com/developer-tools/b/blog/posts/temporary-10-3-2-getit-server-for-installing-10-3-2-add-on-packages?fbclid=IwAR1bV79CCoutmAyH6slVbima_F9QMX29QX1nnwuCl5COCdmXU86BJJNhN9Y
  4. Yes, it is far from easy to switch processing to a specific secondary thread. Basically it is only possible savely if that thread has been written for this. So i can only concur with your previous reply: the responsibility of handling the synchronizing should fall to the code providing the callback.
  5. PeterBelow

    handling predicate conditions

    Yes, but the error you get then will not immediately indicate what the problem is. The way I do it its clear that the problem is a contract violation, and one can write unit tests that check whether the method correctly detects a contract violation.
  6. PeterBelow

    handling predicate conditions

    I usually test for pre and postconditions like this: procedure TBlobDB.CreateNewDatabase(aDBStream, aIndexStream: TStream; aTakeStreamOwnership: boolean); const Procname = 'TBlobDB.CreateNewDatabase'; begin if not Assigned(aDBStream) then raise EParameterCannotBeNil.Create(Procname,'aDBStream'); if not Assigned(aIndexStream) then raise EParameterCannotBeNil.Create(Procname,'aIndexStream'); This is for errors that are supposed to be found and fixed during the testing phase or (for library code) in unit tests. For user input the input is validated before it is used by the program, if this is at all feasable. The end user should never see an exception coming from parameter validation at a lower level, in my opinion, since the UI context may not be evident at that point and it may be unclear to the user what he did wrong.
  7. PeterBelow

    Debugging Inline Variables in 10.3.2

    Well, the cure is simple: do not use inline variables 😉. They are alien to the language anyway and serve no real purpose IMNSHO...
  8. Did you just open the old D7 project in Rio to start the migration? That is not a good idea for such a massive version jump. After you have extracted the complete old project from version control, close all files and the RIO IDE and go to the project folder on disk and move all files not having one of the following extensions to a zip folder: dpr, pas, res, rc, ico If the project contains other resources you may keep them as well. The important part is to delete the old project file (do not remember what extension it used in D7, perhaps bdsproj, and the old cfg file as well. Then open the IDE and open the project's dpr file. This will create a new project file. The project will show up in the project manager view and should have the Win32 target assigned automatically. It will also have a default build configuration assigned, but the settings used for that will not all be suitable for your project. So the next step is to open the project options dialog (from the Project menu or the project manager view's context menu) and adjust the settings, especially the search and output pathes. Beware! The settings dialog is completely different from the one you may know from D7! Since you can have multiple build configurations for multiple target platforms the settings are organized as a kind of hierarchy, and you have to first select the correct hierarchy level for the settings you want to modify. You do this using the combo box at the top of the right-side pane, pick "32 bit windows platform" under "all configurations". In the left-hand treeview you should have the top node (Delphi compiler) selected, that shows the page with the project-specific path settings on the right. The most important things here to get your project to compile are the unit scope names and the search path. Delphi uses namespace-like scope names on the run-time and framework units and has done so since many versions. But D7 did not use unit scope names. To make migration easier the IDE and the compiler will automatically search for units named in Uses clauses within the scopes listed in the unit scope names field if the unit is not found by the given name (the System scope is always searched, though). The default list contains the most frequently used scopes, but you have to make sure that VCL and VCL.Win are in the list as well. The search path becomes important if your project uses custom units not located in the project folder (where the dpr file and the generated dproj file reside). You have to add all pathes for units there that are not found on the IDE library path (as dcu or pas). I don't know how you organize your project files on disk. I usually use something like projectname (dpr, dproj, cfg) source (pas, inc) bin (dcus) exe (exe) doc (documentation) resources (rc and res files, files embedded in them) test (unit tests and other test programs) So the output folder path set in the dialog would be (without the quotes, of course) ".\exe". The unit output path would be ".\bin\$(platform)\$(config)" The search path would be ".\bin\$(platform)\$(config);.\source;$(common);$(include)" "common" and "include" are environment variables defined in the IDE Options dialog that contain the pathes to my code library (not project specific units). The resource compiler node on the left also has a search path setting, these are for rc and res files, but in my experience this has been a bit unreliable in recent versions; i often have to add rc files explicitely to a project to get them compiled and linked in.
  9. PeterBelow

    Playing multiple wave files simultaneously

    As far as I remember from older discussions you have to merge (mix) the sound files into one before you can play it. Windows has an API for that, see Audio mixers If you google for mixer audio sound delphi you may find something useful.
  10. PeterBelow

    Debugging Inline Variables in 10.3.2

    Mh, not very enlightening. Looks like setting up a exception handling frame.
  11. PeterBelow

    Debugging Inline Variables in 10.3.2

    I'm surprised that you can even set a breakpoint on a variable declaration. Makes no sense in my opinion. Could you please run to the breakpoint and switch to the CPU disassembly view to see what statement the breakpoint is actually on? I have not been able to install 10.3.2 myself yet due to trouble with the licence, so cannot test that myself.
  12. PeterBelow

    Component Compatibility 10.3.2 vs. 10.3.1?

    Generally the minor releases of Delphi (e.g. 10.3.1 10.3.2) are binary compatible, which means there are no changes to the interface part of run-time library or frame work units, so dcus and packages build for one release can be used with other. The same applies to the open tools API, so components you bought for 10.3.1 should work in 10.3.2, even if you cannot recompile them since you don't have the source. This only applies if said components play by the rules, of course. If they rely on undocumented features or dig around in the IDE's innards all bets are off.
  13. PeterBelow

    VCL component issue

    Is the project perhaps Win64 or FMX?
  14. PeterBelow

    WinAPI to query if a form is ready to Rock.

    Some of the form properties (e.g. border and bordericons) are implemented via window styles on the API level, and Windows only honors some of the styles when the window is first created. Changes to these properties recreate the window handle for this reason. Another reason are modal forms with popupmode pmauto or pmexplicit; their window handle has to be recreated when they are shown to tie them to their popup parent in Z-order. Changing the formstyle also recreates the handle.
  15. PeterBelow

    WinAPI to query if a form is ready to Rock.

    There is no panacea for this kind of problem, too much depends on how the form in question has been set up. What you can do from "outside" the process is check if the window is visible (IsWindowVisible) check whether it is the current foreground window (GetForegroundWindow) check whether its message loop is running (WaitForInputIdle, or use SendMessageTimeout to send a do-nothing message to the form, e.g. wm_null, the call will not return until the loop is running) Nothing will help you if the form does some kind of delayed initialization, e.g. using a timer started when the form is created. Also keep in mind that a Delphi form may recreate its window handle at the drop of a (virtual) hat during the initialization phase.
×