Remy Lebeau

Member since: Tuesday, 18 March 2014
Last login: 12 hours 45 minutes ago
Profile viewed: 1,921 views

Your Rank: 52
Points: 44

Remy Lebeau replied to the topic 'UsbScan.h conversion...' in the forum. 12 hours 48 minutes ago

What is stopping you from converting it yourself? There are C-to-Delphi converters available if you look around.

Read More...

Remy Lebeau replied to the topic 'July 15th Announcement ?' in the forum. 12 hours 50 minutes ago

What made you think there was going to be an announcement on July 15? I haven't seen anything.

Read More...

Remy Lebeau replied to the topic 'RTL240.BPL is missing from your computer.' in the forum. 13 hours 31 minutes ago

David wrote: However, I have been tasked with developing something that can sit in the background - I'm running it as a system tray app - monitoring types of trades and when a certain type has been done then ensure the user of the PC knows about it.


Why not develop it as a background Service instead of as a hidden app?

David wrote: Flashing tray icons doesn't cut the mustard so I have downloaded some source code re the old Office 97 type characters (parrots etc) and the end result is very pleasing in that it works extremely well on my development system.


What you are referring to is known as "Microsoft Agent" ( msdn.microsoft.com/en-us/library/windows/desktop/ms695784.aspx ), which was discontinued in Windows 7. It requires a hotfix from Microsoft in order to be installed on Windows 7 (or you can use a third party replacement known as "Double Agent", doubleagent.sourceforge.net/ ), but it is not available at all in Windows 10 onwards (Double Agent does not support Windows 10).

The MSAgent technology is dead, don't use it anymore. Find another way to notify your users. Display a popup window. Use system notifications (even system tray icons can display popup notifications).

David wrote: However when others try to use it on their systems they receive the 'program can't start because rtl240.bpl is missing' message.


That means you compiled your project with Runtime Packages enabled, so you must deploy dependent BPL files along with your executable. Otherwise, if you want a self-contained executable, you need to disable Runtime Package in the Project Settings.

David wrote: Reading posts on the web, I have ensured I have have the Link with runtime packages unchecked (false)


Then you shouldn't be getting the error at all, unless you are statically linking to an external library that, in turn, was compiled with Runtime Packages enabled.

Read More...

Remy Lebeau replied to the topic 'TListView columns In the field of visibility' in the forum. 3 days ago

TListView does not natively support what you are asking for, but you can accomplish it manually.

Use the Win32 ListView_GetHeader() function to get the HWND of the ListView's header control. You will need that to retreive Column information.

Next, loop through the ListView's Columns, calling the Win32 Header_GetItemRect() function for each Column to get its current rectangle (unfortunately, all you can get is the rectangle of the entire Column, not the rectangle of the Column's text, but you can offset the dimensions of the rectangle manually as needed after you retrieve it).

Column rectangles will always be positioned relative to (0,0), so to determine if a given Column is visible, you can call the Win32 ListView_GetOrigin() or ListView_GetViewRect() function (despite what MSDN's documentation says, they do work in Report mode) to get the ListView's current scrolling offsets, and then you can offset the Column's rectangle X position by the ListView's scroll X position.

Then, you can compare the Column rectangle to see if it falls within the ListView's current client rectangle as needed Whether you want to detect full visibility or partial visibility is up to you.

If you want to track Column visibility changes in real-time, you can subclass the TListView to handle the WM_HSCROLL message, and the HDN_TRACK and HDN_ITEMCHANGED notifications from the Header control.

Below is a simple example that displays each column's current visibility in a virtual ListBox:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.ExtCtrls, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    ListView1: TListView;
    ListBox1: TListBox;
    procedure ListBox1Data(Control: TWinControl; Index: Integer;
      var Data: string);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    ListBoxItems: array of string;
    OldWndProc: TWndMethod;
    procedure ListViewWndProc(var Message: TMessage);
    procedure CalcColumnsVisibile;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses
  Winapi.CommCtrl;

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  OldWndProc := ListView1.WindowProc;
  ListView1.WindowProc := ListViewWndProc;

  SetLength(ListBoxItems, ListView1.Columns.Count);
  for I := Low(ListBoxItems) to High(ListBoxItems) do
    ListBoxItems[i] := '---';

  ListBox1.Count := Length(ListBoxItems);

  CalcColumnsVisibile;
end;

procedure TForm1.ListViewWndProc(var Message: TMessage);
begin
  OldWndProc(Message);
  if Message.Msg = WM_HSCROLL then begin
    CalcColumnsVisibile;
  end
  else if Message.Msg = WM_NOTIFY then begin
    with TWMNotify(Message) do begin
      if NMHdr.code = HDN_TRACK then begin
        CalcColumnsVisibile;
      end
      else if NMHdr.code = HDN_ITEMCHANGED then begin
        if PHDNotify(NMHdr).PItem <> nil then begin
          if (PHDNotify(NMHdr).PItem.Mask and HDI_WIDTH) <> 0 then begin
            CalcColumnsVisibile;
          end;
        end;
      end;
    end;
  end;
end;

procedure TForm1.ListBox1Data(Control: TWinControl; Index: Integer;
  var Data: string);
begin
  Data := ListBoxItems[Index];
end;

procedure TForm1.CalcColumnsVisibile;
var
  Header: HWND;
  I, Offset: Integer;
  P: TPoint;
  LVClient, R: TRect;
  s: string;
begin
  LVClient := ListView1.ClientRect;

  if Winapi.Commctrl.ListView_GetOrigin(ListView1.Handle, P) then
    Offset := -P.X
  else if Winapi.CommCtrl.ListView_GetViewRect(ListView1.Handle, R) then
    Offset := R.Left
  else
    Offset := 0;

  Header := ListView_GetHeader(ListView1.Handle);
  for I := 0 to ListView1.Columns.Count-1 do
  begin
    if Winapi.CommCtrl.Header_GetItemRect(Header, I, @R) then
    begin
      OffsetRect(R, Offset, 0);
      if LVClient.IntersectsWith(R) then
        ListBoxItems[i] := 'Yes'
      else
        ListBoxItems[i] := 'No';
    end;
  end;

  ListBox1.Invalidate;
end;

end.


Read More...

Remy Lebeau replied to the topic 'Good laptop to run Delphi on?' in the forum. 3 days ago

ioan wrote: Are you using VM player, server or workstation?


I use VMWare Workstation Player.

ioan wrote: Does it run well on 8GB of RAM?


It is OK. It helps that most of my VMs are using XP as the Guest OS, so they require fewer resources from the Host machine. But recent RAD Studio versions won't work on XP anymore, which is why I don't have the latest versions installed. The last version I have installed with XP is 10.0 Seattle, and even it has some troubles running. I have a Win7 VM, but I don't have any IDEs installed in it yet.

Read More...

Remy Lebeau replied to the topic 'Good laptop to run Delphi on?' in the forum. 4 days ago

I run Delphi XE2 natively on a Dell Inspiron N7110 w/ 8GB RAM running Windows 7 x64 Home Premium SP1. I also run newer IDE versions in VMs on the same laptop.

Read More...

Remy Lebeau replied to the topic 'Forums unusable' in the forum. 4 days ago

Roger wrote: Does anyone know the reasoning behind the decision to shut these down permanentl?


Because they are working on a new one to replace it:

forums.embarcadero.com/ann.jspa?annID=157

Read More...

Remy Lebeau replied to the topic 'Forums unusable' in the forum. 4 days ago

April Anne wrote: Yes, there is a counter. Only 'first 100 posts' will be moderated


Wow, that is REALLY high for an average user. Most forums stop moderating after just a few posts have been approved. If moderators can't spot spam after that many approvals, they probably shouldn't be moderating.

Read More...

Remy Lebeau replied to the topic 'Delphi Starter edition & C++ Builder Starter edition together?' in the forum. 5 days ago

David wrote: I don't see any starter edition for RAD Studio.


Correct, per Embarcadero's FAQs:

www.embarcadero.com/products/delphi/starter-faq

Is there a RAD Studio Starter edition? Or Starter edition of HTML5 Builder?

Only Delphi Starter edition and C++Builder Starter edition are available at this time.

David wrote: So you have to buy a license, correct?


If you want to use RAD Studio, yes. Delphi Starter and C++Starter are not intended to be used together:

Can I purchase and use both Delphi Starter and C++Builder Starter together to create a mini RAD Studio?

No. Only one or the other can be installed.



Read More...

Remy Lebeau replied to the topic 'Trouble creating Mailslots' in the forum. 5 days ago

pss wrote: You were true, after correcting the code, now the error is "183: Operation completed correctly"


There is no Win32 error code that has a text message of "Operation completed correctly". The closest would be "The operation completed successfully", which is the text message for error code 0 (ERROR_SUCCESS).

Error code 183 is ERROR_ALREADY_EXISTS ("Cannot create a file when that file already exists"). Which makes sense, if you are trying to create the same mailslot multiple times. Per MSDN documentation , only 1 process can have ownership of a named mailslot at a time. Subsequent attempts to create the same mailslot will fail.

pss wrote: I suspect that this is due to two of my programs in the same computer trying to create the same mailslot, (using both the same function and the same mailslot name in each program).


Yes, that would cause a conflict.

pss wrote: So, now, the new question is: How can I get the handle to the mailslot that is created in another program in the same computer.. Can I share this same mailslot.


It probably CAN be done (such as by having the creating process use DuplicateHandle() to duplicate the mailslot handle and then pass it to the sharing process via IPC). But I would not recommend it, as it introduces a race condition when both processes then try to read inbound messages from the same mailslot. And besides, further MSDN documentation also suggests this wouldn't work, anyway.

The real question is, why do you have multiple processes creating the same mailslot to being with? Are you running multiple instances of the same executable? You might need to consider moving the mailslot to a separate dedicated process and then delegate received messages to other processes as needed.

Read More...

Remy Lebeau replied to the topic 'C++ VCL RadioGroup question' in the forum. 5 days ago

Andy wrote: A quick Google search threw this up;

stackoverflow.com/questions/7430219/how-...r-around-tradiogroup

There is no BorderStyle on TRadioGroup so looks like you have to just put some Radio Button on a TPanel instead and deal with it that way.


Yup, that is exactly what you would have to do. TRadioGroup is hard-coded to always draw a border, there is no option to tun that off, unless you handle the painting manually.

Read More...

Remy Lebeau replied to the topic 'Forums unusable' in the forum. 5 days ago

April Anne wrote: Spam posts are still coming in, but since posts are moderated - they will not get in and will be blocked immediately.


Hopefully there is a mechanism in place so that LEGITIMATE users are no longer moderated after their posts have started being approved? I've noticed that my posts are no longer moderated, but I don't know if that is because of my reputation and good standing in posting non-spam, or because I had to ask not to be moderated anymore. A *decent* forum should have some kind of counter in place for moderating new users until they are deemed OK to continue posting unmoderated.

Read More...

daniel L62827 thanked Remy Lebeau in topic Forums unusable 6 days ago
@aprilanne thanked Remy Lebeau in topic Forums unusable 6 days ago
Remy Lebeau replied to the topic ''Cannot open socket' INDY error' in the forum. 7 days ago

Trevor wrote: I get a 'cannot create a socket' error at the point when I call SMTP.Connect.


That is not an Indy 9 error message. Did you mean 'Cannot allocate socket', by chance? Because that one is an Indy 9 error message.

Unfortunately, when a socket fails to create, Indy 9 doesn't report the OS error code+message explaining WHY the socket could not be created. Indy 10 does, though.

Read More...

Remy Lebeau replied to the topic 'Would this be categorized as an compiler error?' in the forum. 7 days ago

Svend Meyland wrote: Would compiler generated code that results in heap corruption with FastMM in "debug mode" but not with the build in memory manager be categorized as an compiler error?


I don't think so. It would sound more like a FastMM bug, or maybe a mistake in how you configure FastMM that does not match your compiler settings.

Svend Meyland wrote: The code that generates heap corruption with FastMM are


If you compile the exact same code in the same debug mode, and the ONLY difference you make is your choice of memory manager, then it obviously cannot be a compiler error since the machine code leading up to the MM calls *should* be the exact same.

Svend Meyland wrote: It turns out that the code Test2([ACommand]+Result) does the follwing:

  • Creates a dynamic array with one byte.
  • Concatenates this array with Result, In this process a new array is created ant he array created in step 1 is disposed.


That has nothing to do with which MM is used, since the MM has no say in how dynamic arrays are managed. That is up to the compiler/RTL instead.

Svend Meyland wrote:

  • The problem now is that the cleanup code for the function Test disposes the array created in step 1 one more time.


If the compiler is generating machine code that cleans up the same array twice, or the RTL has logic that frees the source array when it shouldn't be during a concatenation, then that is a clear compiler/RTL bug, not a MM bug.

Svend Meyland wrote: This works fine if the memory is initialized to zero values, as it will be with the normal memory manager. But with FastMM in debug mode, memory are filled with nonzero values when freed, and heap corruption occurs.


What the MM fills the *content* of the free array with should not matter. What *would* matter is if the source array is freed and the *pointer* to that array was not set to nil afterwards. That could certainly lead to a second cleanup action, corrupting memory trying to free something that was already freed. But again, that has nothing to do with the MM itself. Unless the MM is exceeding the bounds of the allocated array and corrupting the *pointer* to the array. That would be a very serious MM glitch.

You are just going to have to debug the code deeper, study the generated machine code and step through it with the debugger, until you find the source of the corruption. Pay attention to the value of variables before and after function calls, etc. Even put data breakpoints on them and see if they change value when you are not expecting them to change.

Read More...

Remy Lebeau replied to the topic 'OSX 64 bit application' in the forum. 7 days ago

Paolo wrote: It's not yet possible in Tokyo 10.2.3


And will NEVER be possible in 10.2, you have to wait for 10.3.

Paolo wrote: So my customer wants the update and I cannot deploy it and they ask me 'why' and what should have I to say them?


The only thing you can tell them - that your compiler vendor doesn't support 64bit OSX yet, and if they are not willing to wait for that release, then they will have to wait for you to port your project to another compiler that does (FreePascal, for instance).

Read More...

Remy Lebeau replied to the topic 'Delphi Starter edition & C++ Builder Starter edition together?' in the forum. 7 days ago

David wrote: Is it possible to install the Delphi Starter edition and the C++ Builder Starter edition on the same computer? When I tried to install C++ Builder on a computer which already had Delphi installed, a message popped up saying I had to uninstall Delphi first (or words to that effect). I ended up installing Delphi on my desktop and C++ Builder on my laptop, but it's rather inconvenient. I'd like to install both of them on my desktop (which I mostly use for development).


Those are separate and individual products based on the same IDE. If you want them both installed, you should be installing the full RAD Studio instead, which includes both Delphi and C++Builder. Don't install them separately on the same machine.

Read More...