Jump to content

FPiette

Members
  • Content Count

    1120
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by FPiette

  1. First thing first, I try with a single extension: .arw. Then I'll update the code when required for multiple extensions, that's not the issue.
  2. The registry structure is what @Remy Lebeaushowed in his constructive answer and is conform to Microsoft documentation and yet it doesn't work. Using registry I checked that my code create the keys as specified by Microsoft (see below). Entering something manually? OK but what? That's the question. I miss something and I don't know what. If I don't publish code, someone (you for example) will say "Show what you tried...". That's why I copied relevant code here and made complete project available. Lines marked "<= Not me" was existing before. I write in HKLM\SOFTWARE\Classes and Windows automatically replicate the keys in HKCR. On my system, there is no property sheet that I can analyze and reproduce the structure.
  3. I have coded that. And it doesn't work at all. Here is the code: procedure TMyDelphiPropSheetHandlerFactory.UpdateRegistry(ARegister: Boolean); const Key = '*\shellex\PropertySheetHandlers\'; var Reg : TRegistry; ClassID : String; {$IFDEF REG_FILENAME} ProgNameVer : String; RegExtArray : TStringDynArray; Ext : String; ExtCount : Integer; ProgID : String; ProgTmp : String; {$ENDIF} begin ClassID := GUIDToString(Class_MyDelphiPropSheetHandler); Reg := TRegistry.Create; try {$IFDEF REG_FILENAME} if ARegister then inherited UpdateRegistry(ARegister); Reg.RootKey := HKEY_LOCAL_MACHINE; ProgNameVer := ProgName + '.' + ProgVer; RegExtArray := SplitString(RegFileExts, ';'); if ARegister then begin // Register if Length(RegExtArray) > 0 then begin ExtCount := 0; for Ext in RegExtArray do begin if not Reg.OpenKey('\Software\Classes\' + Ext, FALSE) then MyMessageBox('File type "%s" doesn''t exists', [Ext]) else begin Inc(ExtCount); ProgID := Reg.ReadString(''); if ProgID = '' then begin ProgID := ProgNameVer; Reg.WriteString('', ProgID); MyMessageBox('Created ProgID[%s]="%s"', [Ext, ProgID]); Reg.CloseKey; if not Reg.OpenKey('\Software\Classes\' + ProgID, FALSE) then begin Reg.OpenKey('\Software\Classes\' + ProgID, TRUE); MyMessageBox('Created key "\Software\Classes\%s"', [ProgID]); end; end else MyMessageBox('ProgID[%s]="%s"', [Ext, ProgID]); Reg.CloseKey; if ExtCount = 1 then begin if Reg.OpenKey('\Software\Classes\' + ProgID + '\ShellEx\PropertySheetHandlers\' + ProgName, TRUE) then begin Reg.WriteString('', ClassID); Reg.CloseKey; MyMessageBox('PropertySheetHandlers[%s]="%s"', [Ext, ProgName]); end; end; MyMessageBox('Registered for Ext="%s"', [Ext]); SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil); end; end; end; end else begin // Unregister ProgID := ProgName + '.' + ProgVer; if Length(RegExtArray) > 0 then begin for Ext in RegExtArray do begin if Reg.OpenKey('\Software\Classes\' + Ext, FALSE) then begin ProgTmp := Reg.ReadString(''); if SameText(ProgID, ProgTmp) then begin Reg.DeleteValue(''); MyMessageBox('Deleted ProgID="%s" for Ext="%s"', [ProgID, Ext]); end; end; end; end; if Reg.OpenKey('\Software\Classes\' + ProgNameVer, False) then Reg.DeleteKey('\Software\Classes\' + ProgNameVer); inherited UpdateRegistry(ARegister); end; {$ELSE} inherited UpdateRegistry(ARegister); Reg.RootKey := HKEY_CLASSES_ROOT; if ARegister then begin if Reg.OpenKey('\*\ShellEx\PropertySheetHandlers\' + ProgName, True) then Reg.WriteString('', ClassID) else MyMessageBox('UpdateRegistry : Can''t open registry key!'); end else begin if Reg.OpenKey('\*\ShellEx\PropertySheetHandlers\' + ProgName, False) then begin if not Reg.DeleteKey('\*\ShellEx\PropertySheetHandlers\' + ProgName) then MyMessageBox('Registry key *NOT* deleted!'); end; end; {$ENDIF} finally Reg.CloseKey; Reg.Free; end; end; As you can see, the symbol REG_FILENAME which select registration for all files or single file name extension. MyMessageBox is a message box that I use for debugging. The registration for all file name extension work nicely, so I'm sure the property sheet code is correct. Only the registration for a single extension doesn't work (no error, just do nothing). The complete source code is there: MyDelphiPropSheetHandlerSourceCode.zip There is also an image in .arw file format to test: http://wiki.overbyte.be/arch/FPI09894.ARW BTW: The property sheet does nothing except displaying the selected files in a TMemo.
  4. Thanks @Remy Lebeau. I will give it a try.
  5. You need "Inter Process Communication" (IPC) between your different executable. I personally use sockets to communicate between exe because the exact same socket and code can also be used when the exe are running on different networked computers! This means you can choose with no code change between local computing or distributed computing. Using sockets, as any other IPC, you have to design messages that will be exchanged between your executable. You can use your own design or use XML or JSON or whatever you like most. There are several "socket" libraries fro Delphi. I'm using "Internet Component Suite" (ICS) which also supports SSL/TLS if you are concerned with communication security.
  6. Because I don't know what to make it point to. You told that the ProgId is used when the file must be opened. I don't want to change the application opening it. My code is just to display some metadata from the file, not the file data.
  7. There is no ProgID for the file type. And yet, Windows open it using Microsoft Windows Photo application (.ARW file is Sony RAW file for photo). If you want to try with a real file on your system, you can download a photo in .ARW format: http://wiki.overbyte.be/arch/FPI09894.ARW (Can't attach it here because it is a 50MB). It is possible that you need to install Microsoft RAW extension (https://apps.microsoft.com/store/detail/extension-dimage-raw/9NCTDW2W1BH8) It is needed for Win10 but already included by default with Win11. If you have Adobe Photoshop or Lightroom installed, thing may be different, not sure.
  8. Thank you for your message but you are still out of scope of my question! My question about a property sheet handler associated with a file extension. To say it otherwise, I don't want to create a new file extension nor associate a program to open a file having that file extension (This is what you show). I guess that you don't know what a "Property Sheet Handler" is. A property sheet is what you see when you right-click on a file and select "properties" in the popup menu. Then you see a window with several tabs. A property sheet is a shell extension that build a show a new tab. I wrote such a property sheet handler using Delphi. I can easily register it for ALL file types (AKA file extension) but I don't want it for all files, I want it only for a small number of file extensions. Look at this: https://learn.microsoft.com/en-us/windows/win32/shell/propsheet-handlers
  9. Thanks. I already saw that documentation. It is probably outdated because there is no ProgID for the file extension.
  10. I dont know if help you, but you try see the result when associating any new EXTention file Doesn't help. My question is not related to the creation of a new file type (extension).
  11. Probably if the process is aborted, DoSomething will not execute. Same if power turned off. Same if fatal system error.
  12. Network share is the way to go. You simply have to design the file server correctly: use a Windows SERVER operating system with a lot of RAM (At least 64GB, preferably 128GB. RAM is more important than CPU power in the role). Also make sure the network is not the bottleneck. Use a 10Gbit Ethernet network with all devices properly sized. Not all network interface card are born equal, pay attention to their performance. Use fast hard disks such as 15000 rpm SAS or fast SSD.
  13. FPiette

    Freeing a non-modal form

    That's what the Release method does. Much easier with Release.
  14. FPiette

    Freeing a non-modal form

    You have to use Release instead of Free or Destroy. Release will defer the actual Free until after all events handlers are done.
  15. FPiette

    Image pool server

    Adopt a layered architecture. On part is the communication with the sources and one part is the processing. The communication shall work with "connectors" handling a specific protocol, for example HTTP, or FTP, or network share and so on. The communication layer talk to the connectors at one end and talk to the processing at the other end. There shall be a queue between the communication layer and the processing layer. The queue shall be serviced by one or more processing units. Of course this is an overly simplified view of one possible architecture. You have to tell much more about the context and goal to get better help. First you need to think about the architecture, then the implementation. This second stage is where Delphi can do something for you.
  16. FPiette

    Image pool server

    What are the sources? What is the processing? Is the processing the same for all images? Probably more a batch processing than a pool.
  17. FPiette

    Jumbo packet use with ICS

    🙂 TWSocket.SetSocketRcvBufSize include that option. Has a look at the source code. The socket must be open to change that option since the socket handle is required.
  18. FPiette

    Jumbo packet use with ICS

    BufSize is only important for sending. For UDP, it must be large enough to contain the largest packet to be sent. Buf size is an internal TWSocket working thing. SocketRcvBufSize and SocketSndBufSize is directly passed to winsock API and it is quite a complex topic. See Microsoft documentation at https://learn.microsoft.com/en-us/troubleshoot/windows/win32/data-segment-tcp-winsock Also note that the network layer may break packets into smaller one. You must set jumbo packet on all devices between sender and receiver. Use WireShark or other protocol analyzer to see if the packet fragmentation is done at sending side (You see it in the protocol analyzer) or into winsock at receiver side (You don't see it in protocol analyzer).
  19. FPiette

    Jumbo packet use with ICS

    Did you try setting SocketSndBufSize, SocketRcvBufSize and BufSize? The first two are passed to Winsock to set Windows own buffer size. The later (BufSize) is used by TWSocket to manage his linked list of buffers for synchronous send.
  20. Since you made it working with Postman, I suggest you use WireShark or other network analyser software to dump the Postman request and then dump the request you send with ICS. Comparing the two will give you a good idea about what is wrong.
  21. FPiette

    Anyone using MQTT protocol with ICS?

    Maybe a message on GitHub would reach more peoples? Or in https://en.delphipraxis.net/forum/29-network-cloud-and-web/ ?
  22. FPiette

    One place to rule them all???

    In small demo applications, I use a TDataModule with component dropped on it. For real world large application, I use a simple unit have the code that encapsulate database access and database components are created at runtime. The unit offers classes that give access to the data stored in the database in an abstracted way. More code but much better program if correctly designed.
  23. FPiette

    Writing & Reading as a Console App?

    Classic Pascal I/O is probably not the most efficient. I would use direct WinAPI call (GetStdHandle, ReadFile, WriteFile). Using that API, you can easily make it non blocking (using I/O Completion Ports and/or multi threading). To organize your software, you should probably create an abstract class offering the services you need to communicate and then make one or more implementation using various I/O mechanisms.
  24. FPiette

    Writing & Reading as a Console App?

    I read in UCI specification: "the engine must always be able to process input from stdin, even while thinking.". Are you sure it is the case with your engine ?
  25. Hello, I'm trying to write a shell property sheet extension. The DLL with the COM object is not an issue for me since I already done that kind of work with my context menu extension (That's easy with Delphi). But for a property sheet extension, the COM object must implement IShellPropSheetExt. In that interface AddPage method must create the UI. There are many C++ examples on the web but I did not found any Delphi example. The C++ examples all use the old Windows dialog box feature. I don't want to use a windows dialog box but a Delphi form. I have no idea how to do that and search for some Delphi example or tutorial (Already done extensive Google searches without success). Any help will be appreciated! Thanks.
×