Jump to content

Remy Lebeau

Members
  • Content Count

    2338
  • Joined

  • Last visited

  • Days Won

    95

Everything posted by Remy Lebeau

  1. Remy Lebeau

    Can not install Delphi Community Edition 11.2

    This is not StackOverflow. We don't give out points here.
  2. Remy Lebeau

    Windows 10 x64 & HOOK Global with DDetours

    I'm not aware of any documentation that explains how detours work under x64. Please show your actual code that is creating the global hook and the detour. WHERE are you installing AND UNINSTALLING the hook and detour? What do your hook and detour actually look like?
  3. Remy Lebeau

    Windows 10 x64 & HOOK Global with DDetours

    Did you remove the hook before quitting Windows? Is your hook DLL accessing outside resources that may no longer be accessible during Windows shutdown? Again, why are you dealing with Detours at all? In any case, where exactly are you setting your hook/detour, and are you backing it out later when you don't need it aymore?
  4. Remy Lebeau

    Windows 10 x64 & HOOK Global with DDetours

    You can't detour code in an external process. You would have to inject your detouring code into every running process. Why not just use SetWindowsHookEx() instead to set a global WH_CALLWNDPROC hook?
  5. Remy Lebeau

    get gdi render output of invisible form

    You can't. If it's not on-screen, Windows doesn't physically render it. It makes no sense to send user input to an invisible window. Then why are you bothering with creating UI elements that will never be shown on-screen? No, FMX (or VCL) apps cannot be displayed inside a web browser. They don't work for good reason - there is nothing to capture.
  6. Remy Lebeau

    open dialog

    I'm referring to any API that is provided by the OS which is specifically designed for comparing paths and/or filesystem objects. For example, PathIsPrefix() Also see: Best way to determine if two path reference to same file in Windows?
  7. Remy Lebeau

    open dialog

    Just note that comparing filesystem paths as plain strings is not 100% reliable. Better to use system APIs that are better suited for that task, so you don't run into issues related to differences in casing, localization, 8.3 shortening, etc...
  8. Remy Lebeau

    open dialog

    Then you should have said something earlier. I whipped up those examples off the top of my head, I didn't test them (and stated as much). What is the exact error message, and on which line(s) of code? Can you be more specific? What is your root folder? What is your selected folder? While walking the parent tree, which folder are you getting the error on (ie, what is the display data for the failing IShellItem)? You should have said something earlier. How else are you going to learn? That won't solve your main goal, since you will only be getting individual folder names from it, not full paths.
  9. Remy Lebeau

    open dialog

    I literally gave you such code a week ago. Did you not see/try it?
  10. Remy Lebeau

    Delphi 12 List Objects x64

    How does that not work, exactly? Both Count() and Items[] take NativeInt now, you should not need the type-cast. That being said, why not use the Last() method instead? LastCol := Cols.Last.ColNumber + 1;
  11. Remy Lebeau

    Delphi 12 List Objects x64

    What's New: Delphi RTL and Data Improvements - Delphi RTL - List, Arrays, and Collections Improvements
  12. Remy Lebeau

    Send multiple attachments with smtp.office365/outlook.com

    Indy doesn't send an email differently based on server, so if Microsoft is not processing an email the same way that other servers are, then you probably need to contact Microsoft for support, and send them examples of emails that are not displaying correctly.
  13. The 1st parameter of TRttiField.SetValue() expects a pointer to an object instance that the field belongs to, not a pointer to the field itself. Your function's Result is an array of T, is T an object type? If so, then you should constrain T with the 'class' constraint so that the compiler knows T is a class type, and thus Result is an array of object pointers. Can you provide a more complete example of what exactly you are trying to accomplish? Where are you getting the TRttiField from to begin with?
  14. If it hasn't already started copying files onto your disk drive, ie because you didn't tell it where to install to yet, then I think you're fine.
  15. Remy Lebeau

    open dialog

    Which post are you referring to? The code you have shown does not look like code I would have written. Note that the TFileOpenDialog.DefaultFolder applies only if there was no folder previously selected with the same dialog. You might want to prepare your initial IShellItem to your desired root folder before you open the dialog. That being said, you are setting the CanChange parameter to true only if the selected folder and the default folder are the same, which is not what you want. You need to check if the desired initial folder is a parent/ancestor of the selected folder. So, for that, you need to take the Dlg.ShellItem and walk its parent list comparing each one individually until you find a match or exhaust the list. Or, you could query each IShellItem for its ITEMIDLIST and use ILIsParent() or equivalent. For example (untested): var MyFolderShellItem: IShellItem; ... if Succeeded(SHCreateItemFromParsingName(PChar('C:\MyFolder'), nil, IShellItem, MyFolderShellItem)) then try FileOpenDialog1.Execute; finally MyFolderShellItem := nil; end; ... function IsParentOf(ARoot, AItem: IShellItem): Boolean; var iOrder: Integer; iParent: IShellItem; begin Result := (AItem.GetParent(iParent) = S_OK) and ((iParent.Compare(ARoot, SICHINT_ALLFIELDS or SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL, iOrder) = S_OK) or IsParentOf(ARoot, iParent)); end; { alternatively: function IsParentOf(ARoot, AItem: IShellItem): Boolean; var RootIdList, ItemIdList: PIDLIST_ABSOLUTE; begin Result := False; if SHGetIDListFromObject(ARoot, @RootIdList) = S_OK then try if SHGetIDListFromObject(AItem, @ItemIdList) = S_OK then try Result := ILIsParent(RootIdList, ItemIdList, FALSE); finally CoTaskMemFree(ItemIdList); end; finally CoTaskMemFree(RootIdList); end; end; } procedure TForm1.FileOpenDialog1FolderChanging(Sender: TObject; var CanChange: Boolean); begin CanChange := IsParentOf(MyFolderShellItem, (Sender as TFileOpenDialog).ShellItem); end;
  16. Remy Lebeau

    C++ / windows.h and data alignment

    Yes, your understanding is correct, but that wouldn't actually be a problem if each header handled its own alignment directives locally and made sure any alignment changes didn't bleed out into the caller's code.
  17. Remy Lebeau

    Indy TIdTCPClient connect, send and disconnect

    I probably would have used a single port and delimited the 2 datas, but that's just me. Whatever works best for you. No, you need a separate client for each server port. But you can run the 2 clients in parallel, such as with threads.
  18. Remy Lebeau

    Which Indy version in Delphi 12

    I've recently updated Indy's GitHub repo to now tag the commits that have been bundled in the past few RAD Studio releases (including 12.0) since Indy switched from SVN to GitHub.
  19. Remy Lebeau

    C++ / windows.h and data alignment

    Still makes one wonder why Microsoft doesn't just force the alignment in its own headers where needed.
  20. Remy Lebeau

    Delphi 12.0 Athens - Platform status

    Not sure about Delphi, but the "What's New" page in the DocWiki says the following about C++, though:
  21. Remy Lebeau

    Indy TIdTCPClient connect, send and disconnect

    Why? Can't you design your protocol to send your 2 sets of data over a single connection? That means the server is closing the connection on its end. Can you show your actual code that is managing your connections? Do you really need 2 separate connections to the same server, though? Not release specifically. However, if you are planning on re-connecting the same TIdTCPClient again, you should at least make sure its IOHandler.InputBuffer is cleared of any unread data after disconnecting, so Indy won't think the connection is still alive, eg: idTCPClientB.Disconnect; if idTCPClientB.IOHandler <> nil then idTCPClientB.IOHandler.InputBuffer.Clear;
  22. Remy Lebeau

    open dialog

    Letting a user even see that another user's folder exists, even if it's not selectable, is just bad UI design and broken security waiting to be exploited.
  23. Remy Lebeau

    Indy TIdTCPClient connect, send and disconnect

    That is literally exactly how Indy is designed to be used. Indy uses blocking sockets and synchronous I/O. Connect() will block the calling thread and not exit until the connection is established. Sends will block the calling thread and not exit until the data has been passed to the kernel. Etc. So, just do exactly what you said above, it will work fine. Just be sure to put the send in a try..finally to ensure the connection is closed even if the send raises an error, eg: IdTCPClient1.Connect; try // send whatever you need... finally IdTCPClient1.Disconnect; end; Most Indy clients are not event-driven. You do not need to wait for the OnConnect event. It is just a status event, not a logic-driving event.
  24. Remy Lebeau

    open dialog

    TFileOpenDialog has OnFolderChanging and OnFileOkClick events that can be used to verify/reject the user's input so they can't use what you don't want them to use.
  25. Remy Lebeau

    StringGrid: how to get the column number via right-click

    Your 'c' variable is initialized to 0, which is likely why your column 0 gets highlighted at startup. Initialize the variable to -1 instead, and then update it on mouse clicks as needed. Also, you don't need to use the OnSelectCell event at all, just let the OnMouseDown code determine the column using the provided X/Y coordinates. Also, DO NOT call your OnDrawCell event handler direct!y. Let the system call it for you when the Grid actually needs to be painted naturally. Try something more like this instead: implementation var HighlightedColumn: Integer; ... procedure TForm1.FormCreate(Sender: TObject); begin HighlightedColumn := -1; end; procedure TForm1.sg1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin if (ACol = HighlightedColumn) then begin sg1.Canvas.Brush.Color := clBlue; sg1.Canvas.FillRect(Rect); end; end; procedure TForm1.sg1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var c, r: Longint; begin sgl.MouseToCell(X, Y, c, r); if (r < sgl.FixedRows) then begin HighlightedColumn := c; sg1.Invalidate; end; end;
×