Jump to content

direktor05

Members
  • Content Count

    61
  • Joined

  • Last visited

Posts posted by direktor05


  1. I'm getting a ton of issues converting from x32 to x64. First one:

     

    var
      Size: Cardinal;
      Handle: Cardinal;
      FileName: String;
    begin
      if ModuleName = '' then
        FileName := OAExeName
      else
        FileName := ModuleName;
      Size := GetFileVersionInfoSize(PWideChar(FileName), Handle);

     

    Size returned is 0 and the error is:

     

    VerQueryValue (Language in Project Settings/Version Info has to be set to English (United Kingdom))

     

    var
      SubBlock: String;
      ValuePointer: Pointer;
      ValueLen: Cardinal;
    begin
      SubBlock := '\StringFileInfo\080904E4\' + ValueName;
      TestGetLastError(VerQueryValue(@FBuffer[0], PWideChar(SubBlock), ValuePointer, ValueLen), 'VerQueryValue (Language in Project Settings/Version Info has to be set to English (United Kingdom))');
      Result := PChar(ValuePointer);

     

    So what is wrong? I assume it's the variable (un)signed-ness again. GetFileVersionInfoSize(PWideChar(FileName), Handle) - Handle must be Cardinal according to API definition.

    How can I fix this?

     

    Another one is  array of Byte variable is causing AV error.

     


  2. 16 hours ago, Remy Lebeau said:

    That code risks pointer truncation in a 64bit build. The integer typecast should be using NativeUInt or UIntPtr  instead. Or, use pointer arithmetic via PByte instead.

     

    Also, the file list is a double-null terminated list, so make sure you account for that in case multiple files are dragged. Also, depending on the source, the file names may be using Ansi or Unicode characters, so pay attention to the DropFiles.fWide field. 

    REMY YOU SOLVED MY PROBLEM! THANKS.


  3. In my code the file list is not filled:

     

    FileName := PWideChar(Cardinal(DropFiles) + DropFiles.pFiles);

     

    where DropFiles comes from WinApi.ShlObj - which means the file list is not being transferred from Windows on IDropTarget.DragEnter

     

    IDropTarget.DragEnter is called but the file list is empty.


  4. 14 hours ago, Anders Melander said:

    No; It works with all drop targets.

     

    And if you look at the WM_DROPFILES example there's also an example of working around the UAC restrictions mentioned by Remy:

    https://github.com/andersmelander/Drag-and-Drop-Component-Suite/blob/de46eb2b804c33921809504d086285da11d4e3e5/Source/DropTarget.pas#L298

    You could also tell me your idea of "example of working around the UAC restrictions " so I don't have to go through your non-working code.

     


  5. Anders your component probably does diagnostic according to your component functions not in general. I need a solution how do you check if a procedure of function is executed/called inside OLE/ActiveX dll, better yet specifically inside shell drag drop dll? Any hero here?


  6. procedure TForm1.Create(Sender: TObject);
    begin
      RegisterDropTarget(TFileDropTarget.Create(FileDragEnter, FileDragOver, FileDragDrop, FileDragLeave));
    end;

    procedure TForm1.RegisterDropTarget(Handler: IDropTarget);
    begin
      RegisterDragDrop(Handle, Handler);
      FDragDropHandle := Handle;
    end;

    procedure TForm1.FileDragEnter(Sender: TObject; FileList: TStrings; Point: TPoint; Shift: TShiftState; var Action: TFileDropAction);
    begin
      IT NEVER ENTERS HERE
      FDragFromWindows := True;
      Point := ScreenToClient(Point);
      UpdateFileDragAction(FileList, Point, Action);
    end;


  7. RegisterDragDrop(Handle, Handler);

     

    Handle: 722688

    Handler: TFileDropTarget($23747B02490) as IDropTarget

     

    So I have a pointer to IDropTarget, but it does not call IDropTarget.DropEnter function when I start the drag operation. Why not? And how can I check this?

     


  8. Hello,

     

    I want to do drag drop from Windows Explorer to my app via OLE interface IDropTarget. Question is how do I detect if OLE communication is working well. For now RegisterDragDrop function is working fine. But I can't get a call to DragEnter function when dragging starts. How can I check that OLE is working fine and that dragging somehow starts? But why I can't get DragEnter function to run? Here is some nice theory: https://delphidabbler.com/articles/article-24

     

    I can't get any of this functions to work or be called. What is wrong? And how do I check if OLE can detect drag-drop in the first place?

    function DragEnter(const dataObj: IDataObject; grfKeyState: Longint;  pt: TPoint; var dwEffect: Longint): HResult; stdcall;

    function DragOver(grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; stdcall;

    function DragLeave: HResult; stdcall;

    function Drop(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; stdcall;


  9. 4 minutes ago, Uwe Raabe said:

    You can set a breakpoint in all possible methods and enter the Condition triggering it. In the Advanced view you can disable Break and set a Log message. This won't interrupt your debugging session and you can see the messages in the event log

    Uwe you are always full of good ideas. Yes this possible methods are many. A few 10. The condition I don't know exactly, if I'd know the triggering condition I'd know where to find the right procedure. That is the catch. I need to know what is triggering the procedures that are executed on timer Track 2 and which methods are triggered.

     


  10. There is an option with DebugView (https://learn.microsoft.com/en-us/sysinternals/downloads/debugview)

    by adding debuglog.add('ProcedurenName'); to every function/procedure and checking what is executed. However this debugview log becomes saturated with junk because the program repeatedly calls certain procedures and functions all the time when the track mp3 is playing. This info I don't need. I just need the info which procedure is called exactly when timer is triggered to play track 2. Not before not after.

×