Remy Lebeau

Member since: Tuesday, 18 March 2014
Last login: 3 years ago
Profile viewed: 4,510 views

Your Rank: 52
Points: 44

Michael P67985 thanked Remy Lebeau in topic Inline Assembly 3 years ago
Remy Lebeau replied to the topic 'Issues with inline variables and the IDE' in the forum. 3 years ago

Emailx45 wrote: maybe you need read the article by Marco Cantu

Nothing in that articles explains (or even hints at) Error Insight's incorrect behavior in this situation.


Remy Lebeau replied to the topic 'Inline Assembly' in the forum. 3 years ago

Michael wrote: When I step to lodsb I can see it is loading a bad value in al register.

Your code is assuming Delphi's 32-bit 'register' calling convention is being used in 64-bit, but that is not actually the case. Remember, there are NO 32-bit calling conventions in 64-bit (cdecl, stdcall, register, etc). There is only 1 calling convention, dictated by the x64 ABI (see Overview of x64 Calling Conventions on MSDN).

So, in 64-bit, your TestString and Result parameters are NOT passed via the RAX and RDX registers, respectively, like you are expecting (they ARE passed via EAX and EDX in 32-bit, though). They are actually passed via the RDX and RCX registers instead, respectively (see Register Usage for why). Remember, the Result of your function is not a trivial integer type, so it gets passed in as a hidden reference parameter, not as the function's actual return value (which is why RAX is not used):

This change works for me:
//mov rdi,rdx
//mov rsi,rax
mov rdi,rcx
mov rsi,rdx


Remy Lebeau replied to the topic 'Android force repaint' in the forum. 3 years ago

Why are you using such a loop in the first place? You should not be doing that. Restructure your code to run asynchronously instead. Start the thread and move on. Use a timer, for instance, to run your animation, so the main message loop is not blocked at all. Let the thread's OnTerminate event notify you when the thread has finished, then you can stop your animation and run your next code as needed.


Remy Lebeau replied to the topic 'Event when changing between different applications' in the forum. 3 years ago

Miguel wrote: Under Windows operating system. When i run my c++ builder program and work with it, and then i change to work with another program (notepad, photoshop, or whatever) but without closing my c++ builder program, and then i come back to it, is there any event that happens when the active window is again my c++ builder program just after having worked with another application?

Yes, TApplication::OnActivate .

You can either:

- assign a handler to it dynamically in code at runtime, such as in your Form's constructor.

- use the TApplicatioEvents component.


Remy Lebeau replied to the topic 'C++ 10.3 Rio. App icons and splash screen tab missing in IDE' in the forum. 3 years ago

According to this documentation , there is a new dedicated "Icons" page underneath "Project > Options > Application".


Remy Lebeau replied to the topic 'TListItems.Count to 0, whereas TListView has items' in the forum. 3 years ago

Didier wrote: example of logic I don't understand : you seem to explain that, in the OnCreate, the CM_RECREATEWND message is undoubtedly achieved because the TListView HWND is 0.

Before OnCreate is called, actually. But essentially, yes. And you can prove that for yourself by stepping through the DFM streaming logic using the debugger at runtime. When the DFM is being streamed in, the Items property gets streamed in first, loading the TListItem objects into the HWND. Then the ReadOnly property gets assigned afterwards, destroying the HWND (and caching the list items in memory for later re-loading when a new HWND is eventually allocated). By the time OnCreate is called, the HWND has been destroyed, but not allocated anew yet.

Didier wrote: As a solution, you proposed a "ListView1.HandleNeeded". Note that on my side, I proposed a "ListView1.Handle" at the same place :-)

The end effect is the same either way, because the Handle property getter simply calls HandleNeeded() and then returns the HWND:
function TWinControl.GetHandle: HWND;
  Result := WindowHandle;

However, calling HandleNeeded() in your own code makes it more explicit as to what your intent really is - to ensure an HWND exists - whereas reading the Handle property is less explicit - obtaining the HWND and then ignoring it.

Didier wrote: This "bug" does not occur with Delphi 10.3 Rio -> no need to add the handle allocation forcing in the OnCreate with Delphi 10.3 Rio

It was not a bug to begin with, just an unfortunate side effect of timing, and that fact that the VCL likes to use RecreateWnd() for things that don't really require a full HWND recreation to begin with. But you will have to study Rio's VCL source code to find out exactly why it works now (I don't have Rio installed to look at). For instance, the TTreeView.ReadOnly property does not call RecreateWnd(), it simply toggle's the HWND's TVS_EDITLABELS style, if the HWND is allocated. Maybe Embarcadero finally made a similar change to TListView so it doesn't have to call RecreateWnd() anymore? Who knows. You will have to look for yourself.


Remy Lebeau replied to the topic 'TListItems.Count to 0, whereas TListView has items' in the forum. 3 years ago

If you do not use the ListView in virtual mode (OwnerData=true), the list items are physically stored inside the ListView's HWND. So, if there is no HWND allocated, there are no items to display in the ListView, even if there are TListItem objects stored in the TListItems collection. That is why the Items.Count property returns 0 when HandleAllocated returns false.

If the HWND gets recreated after the Items collection has been populated, the existing TListItem objects are saved to an internal stream that gets reloaded back into the HWND after it has been re-allocated. You can force that re-allocation in your OnCreate event using the HandleNeeded() method:

procedure TForm1.FormCreate(Sender: TObject);
  i: integer;
  ListView1.HandleNeeded; // <-- add this!
  i := ListView1.Items.Count; // <-- not 0 anymore !!


Remy Lebeau replied to the topic 'Inline Assembly' in the forum. 3 years ago

Michael wrote: This works in 32 but not 64bit?

In what way exactly? Please be more specific. What is the code trying to accomplish, and why is it using inline assembly to accomplish it?


Remy Lebeau replied to the topic '__FUNC__ not producing full ClassName::FunctionName' in the forum. 3 years ago

No, there is not. However, being as how the Win64 compiler is a CLang-based compiler, you might try using a different macro instead, ie __FUNCTION__ or maybe __PRETTY_FUNCTION__.


Remy Lebeau replied to the topic 'Delphi 5 ISO Needed -- Embarcadero Approved' in the forum. 3 years ago

Ken wrote: I am a registered user of everything from Delphi 5 -> Seattle and I have a project developed in Delphi 5 but when I migrated to my new computer I could find neither the serial number nor the Installation CD. Yes, my office is a disaster.

If you are truly registered, your serial number should be in the "My registered products" section of your EDN account.

Ken wrote: Christopher McDowell at Embarcadero suggested I post here and ask whether anyone has an old Installation CD that they could zip and send to me along with the serial number.

This is completely legitimate and above board because users of Seattle get free use of all previous versions... but their official downloads only go back to version 7.

No, actually, NOT all previous versions. Your Seattle license does not include access to versions prior to Delphi 7. See for details. So no, using someone else's license is not legal, unless they transfer ownership of it to you.


Czeslav wrote: It seems that the forum I am mentioning has died.


Czeslav wrote: Is this a replacement for that forum?

It was supposed to be, but this forum is a piece-of-cr** that nobody likes. Embarcadero acknowledged that, with a promise of creating YET ANOTHER new forum to replace THIS forum. Recently, was added, though I have my doubts about whether that is the promised forum (I hope not! It is not much better than this forum), or just a temporary step to hold people over while Embarcadero continues work on the new-new forum. There has been no announcement one way or the other.


Remy Lebeau replied to the topic 'Issues with inline variables and the IDE' in the forum. 3 years ago

Error Insight doesn't recognize the new syntax yet. Just ignore it and move on, or disable Error Insight. Nothing you can do about it until Embarcadero fixes it.


Vasilius wrote: After upgrade to 10.3 can't compile project
I am using USB HID Library and get error on linking


[ilink32 Error] Error: Unresolved external '__tpdsc__ TByteDynArray' referenced from FHID.OBJ
[ilink32 Error] Error: Unable to perform link


[ilink64 Error] Error: Unresolved external '_ZTRN6System5Types13TByteDynArrayE' referenced from FHID.O

You are likely linking to outdated obj files that need to be recompiled for Rio. In Rio, TByteDynArray is no longer a distinct type, it is now just an alias for TArray<Byte> (as it should have been a long time ago).


Remy Lebeau replied to the topic 'Why aren't my posts showing up?' in the forum. 3 years ago

You both have low counts of approved posts, so you are likely still being moderated. Approving moderated posts takes time.


Remy Lebeau replied to the topic '10.3 Rio Compiler conditional define' in the forum. 3 years ago

Mark wrote: Downloaded Rio. Installed without issue (phew). Started to build my previous code. I need the compiler version for a conditional compile in a 3rd party package. Tried VER330 - seemed a reasonable guess, but not so.

VER330 is the correct value (the compiler version in Rio is 33.0). If that VERxxx conditional is not working correctly, file a bug report with Quality Portal .

However, you really should not be using {$IFDEF VERxxx} conditional checks anymore. Those have been outdated since Delphi 6 introduced {$IF}. Use the System.CompilerVersion or System.RTLVersion constants instead:

Using Conditional Defines for the Compiler Version

For example:
{$IF (CompilerVersion >= 33) and (CompilerVersion < 34)}
// Rio ...

If you still need to support pre-D6 compilers:
  // check CompilerVersion for specific D6+ versions as needed...
  {$IF (CompilerVersion >= 33) and (CompilerVersion < 34)}
  // Rio ...
  // check for specific pre-D6 versions as needed...
  {IFDEF VERxxx}
  // ...


Remy Lebeau replied to the topic 'Rio and JSON' in the forum. 3 years ago

Please file a bug report with Quality Portal .


Remy Lebeau replied to the topic 'Stupid Question' in the forum. 3 years ago

Robert wrote: Below from action item and menu.

Syntax checker says
[Error] frmuMain.pas(181): Statement expected, but expression of type 'TAction' found
[Fatal Error] IBPLanalyzer.dpr(16): Could not compile used unit 'frmuMain.pas'

Comment out the if dlgConnectToDB.ShowModal = mrCancel then exit;
and add dlgConnectToDB.Show; works fine.

The only way I could imagine that happening is if that Form class has a TAction data member named ShowModal, shadowing the Form's inherited ShowModal() class method. Make sure data members have unique names.