Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/01/20 in all areas

  1. Hi all, I just wanted to let you know my (long-awaited) FMX book is now available (actually it is rolling out on Packt and Amazon so availability may be different across different countries). If you like to read some details you can read my latest blog post: https://blog.andreamagni.eu/2020/10/book-delphi-gui-programming-with-firemonkey-now-available/ I really hope the book will be useful to spread Delphi and FMX as development platform. Thanks for the attention, Andrea
  2. Carlos Tré

    Tools API - Changing Key Assignment

    I wrote it myself a few years ago, based on an article written by Cary Jensen that you can find here. Attached is the code for the expert in its current state, the changing of the format source key assignment is still a work in progress. Editor.zip
  3. Tired of all those programs which install lots of additional stuff I have been using more and more so called “Portable Apps”. “Portable” in this context means: You can put them anywhere, even on a portable storage device and start them from there. These Programs are still Windows only. And of course nobody prevents you from putting them in a folder on the system harddisk, usually c:\PortableApps. All files these programs need are inside this one folder, so in order to move or copy them, you simply move/copy that folder. There is a dedicated launcher and updater for these types of programs at portableapps.com, which is written in Delphi btw. and the source code is available. One thing that has irked me all the time is that these programs don’t show up in the Windows start menu, unless I add them manually, which I usually don’t. Today I had enough and wrote PortableAppsToStartMenu, a tool which given a PortableApps directory collects all the executables stored there and creates shortcuts in the Windows Start Menu for them. Read on in the blog post.
  4. Use Regex101 to find the issue.
  5. Call me old fashioned but the way you've formatted your code makes it close to unreadable to me.
  6. Mahdi Safsafi

    Some components show class =nil

    GetClass requires a class to be priory registered using RegisterClass function otherwise it will fail. Below, a sample that uses some undocumented functions to get all classes: type TDesignPackages = TObject; TDesignPackage = TObject; TIDEDesignPackage = TObject; TRegModule = TObject; TRegClass = TObject; TDesignPackagesGetPackages = function(Obj: TDesignPackages; PackageIndex: Integer): TObject; TIDEDesignPackageGetCount = function(Obj: TIDEDesignPackage): Integer; TRegModuleGetCount = function(Obj: TRegModule): Integer; TIDEDesignPackageGetModules = function(Obj: TIDEDesignPackage; Index: Integer): TRegModule; TRegModuleGetClasses = function(Obj: TRegModule; Index: Integer): TRegClass; var DesignPackagesGetPackages: TDesignPackagesGetPackages; IDEDesignPackageGetCount: TIDEDesignPackageGetCount; IDEDesignPackageGetModules: TIDEDesignPackageGetModules; RegModuleGetCount: TRegModuleGetCount; RegModuleGetClasses: TRegModuleGetClasses; function GetClass2(PackageIndex, ComponentIndex: Integer): TClass; var Coreide: THandle; Delphicoreide: THandle; LGlobalPackagesPtr: Pointer; LDesignPackages: TDesignPackages; LIDEDesignPackage: TIDEDesignPackage; LRegModule: TRegModule; LRegClass: TRegClass; LIDEDesignPackageCount: Integer; LRegModuleCount: Integer; LIndex: Integer; I: Integer; J: Integer; begin Result := nil; { --- Move me outside --- } // adapt 260 suffix according to your Delphi version. Coreide := GetModuleHandle('coreide260.bpl'); Delphicoreide := GetModuleHandle('delphicoreide260.bpl'); LGlobalPackagesPtr := GetProcAddress(Coreide, '@Pakmgr@Packages'); DesignPackagesGetPackages := GetProcAddress(Coreide, '@Pakmgr@TDesignPackages@GetPackages$qqri'); IDEDesignPackageGetCount := GetProcAddress(Delphicoreide, '@Pascpppakmgr@TIDEDesignPackage@GetCount$qqrv'); IDEDesignPackageGetModules := GetProcAddress(Delphicoreide, '@Pascpppakmgr@TIDEDesignPackage@GetModules$qqri'); RegModuleGetCount := GetProcAddress(Coreide, '@Pakmgr@TRegModule@GetCount$qqrv'); RegModuleGetClasses := GetProcAddress(Coreide, '@Pakmgr@TRegModule@GetClasses$qqri'); Assert(Assigned(LGlobalPackagesPtr), 'LGlobalPackagesPtr not assigned'); Assert(Assigned(DesignPackagesGetPackages), 'DesignPackagesGetPackages not assigned'); Assert(Assigned(IDEDesignPackageGetCount), 'IDEDesignPackageGetCount not assigned'); Assert(Assigned(IDEDesignPackageGetModules), 'IDEDesignPackageGetModules not assigned'); Assert(Assigned(RegModuleGetCount), 'RegModuleGetCount not assigned'); Assert(Assigned(RegModuleGetClasses), 'RegModuleGetClasses not assigned'); { --- End Move outside --- } if Assigned(LGlobalPackagesPtr) then begin LDesignPackages := TObject(PPointer(LGlobalPackagesPtr)^); LIDEDesignPackage := DesignPackagesGetPackages(LDesignPackages, PackageIndex); LIDEDesignPackageCount := IDEDesignPackageGetCount(LIDEDesignPackage); LIndex := 0; // Component Index. for I := 0 to LIDEDesignPackageCount - 1 do begin LRegModule := IDEDesignPackageGetModules(LIDEDesignPackage, I); LRegModuleCount := RegModuleGetCount(LRegModule); for J := 0 to LRegModuleCount - 1 do begin if LIndex = ComponentIndex then begin LRegClass := RegModuleGetClasses(LRegModule, J); Result := TClass(PPointer(PByte(LRegClass) + 4)^); exit; end; Inc(LIndex); end; end; end; end; procedure Test(Sender: TObject); var PackageServices: IOTAPAckageServices; I: Integer; J: Integer; LClass: TClass; s: string; begin if Supports(BorlandIDEServices, IOTAPAckageServices, PackageServices) then begin for I := 0 to PackageServices.PackageCount - 1 do begin for J := 0 to PackageServices.GetComponentCount(I) - 1 do begin s := PackageServices.ComponentNames[I, J]; LClass := GetClass2(I, J); if Assigned(LClass) then begin Assert(LClass.ClassName = s); end; end; end; end; end;
  7. Just bought it for those sleepless nights, Thanks!! Renate
  8. Hi Dave, finally after a long time I managed to solve Thanks a lot to you, Chris and Allen. Without you I wouldn't have been able to do it. You are great developers and great people Massimiliano
×