Jump to content

programmerdelphi2k

Members
  • Content Count

    1406
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by programmerdelphi2k

  1. programmerdelphi2k

    Intercept "WM_COPY" on Windows

    @gioma based on @Remy Lebeau text, I have test this code and works... but not guaratee if it's good for all...ok? // VCL tests ... private FClipboardListenerHandle: HWND; procedure ClipboardUpdateHandler(var Msg: TMessage); message WM_CLIPBOARDUPDATE; ... implementation {$R *.dfm} uses Winapi.ShellAPI, Winapi.ShlObj, Vcl.Clipbrd; { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin if AddClipboardFormatListener(Handle) then; // ???? // Memo1.Lines.Add('AddClipboardFormatListener: GetLastError = ' + GetLastError.ToString); end; procedure TForm1.FormDestroy(Sender: TObject); begin if RemoveClipboardFormatListener(Handle) then; /// ??? // Memo1.Lines.Add('RemoveClipboardFormatListener: GetLastError = ' + GetLastError.ToString); end; procedure TForm1.ClipboardUpdateHandler(var Msg: TMessage); var LClipboardData : THandle; LGLobalLock : Pointer; LFilename : PWideChar; LFilenameBuffer: array [0 .. MAX_PATH] of WideChar; // cfShellIDList: UINT; begin if not IsClipboardFormatAvailable(CF_HDROP) then exit; // cfShellIDList := RegisterClipboardFormat(CFSTR_SHELLIDLIST); // if OpenClipboard(Handle) then // opening the Clipboard... begin try LClipboardData := GetClipboardData(CF_HDROP); // some data? // if (LClipboardData > 0) then try LGLobalLock := GlobalLock(LClipboardData); // lock it... try if (LGLobalLock <> nil) then begin DragQueryFileW(HDROP(LGLobalLock), 0, LFilenameBuffer, MAX_PATH); // catch the file/folder name // Memo1.Lines.Add('File name: ' + LFilenameBuffer); end else Memo1.Lines.Add('LGLobalLock = nil'); finally GlobalUnlock(LClipboardData); // unlock it... end; except on E: Exception do Memo1.Lines.Add('Exception: ' + E.Message); end else Memo1.Lines.Add('----- ClipboardData = 0 -----'); finally CloseClipboard; end; end else Memo1.Lines.Add('OpenClipboard = false'); end;
  2. programmerdelphi2k

    SDK API 32 /versions/12 WRITE_EXTERNAL_STORAGE

    https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Standard_RTL_Path_Functions_across_the_Supported_Target_Platforms tutorials for read https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Mobile_Tutorials:_Mobile_Application_Development_(iOS_and_Android) in Android 11, you can not save your files in any folder, basically in your App folder and public folder! the rules to External_storage changed, read more here https://developer.android.com/about/versions/11/privacy/storage
  3. programmerdelphi2k

    iOS_64 linking problem

    I think that last update "RADStudio_11_3_28_13236a.ISO" or "RADStudio_11_3_esd_28_13236.exe (web installer)", contains the Community Edition if you are using your license key for 1 years, but need test it!
  4. programmerdelphi2k

    Intercept "WM_COPY" on Windows

    @gioma, I think you should avoid using Clipboard, even if it works in your project, for the simple fact that it is a neutral layer and used by any other application in your system. In this way, nothing guarantees that the information obtained will be the desired information. You know it! Now, as you are already communicating with the second (or any other) application on the network, then, I think the most sensible thing would be to approach this direction, that is, send the desired information through TCP/IP, UDP or similar communication ... etc... In this way, you can guarantee that your transmissions will be directed exclusively to your interested applications, that is, to everyone who makes use of this communication, it can be one, two, or as many as you wish. You could easily do this code without much impact on your current project, if you want, you could even create a small TCP/IP server using INDY or whatever to listen on a certain port, and thus receive all messages (information) desired. In this way, you can ensure that you receive the information sent by another application. Delphi can easily generate a DataSnap Server (ie the code) for you to add to your applications. Delphi has Tethering components, which you can easily add to a form, so almost no code is needed. Communication is carried out by TCP/IP and UDP protocols, in this way, you just need to place a Tethering Server component in the applications that will receive the information, and another Tethering Client in the application that will send the information, the rest is just using one or two events to receive the information. Very easy and without much complexity. here a great sample by Malcolm Groves : http://www.malcolmgroves.com/blog/?p=1891
  5. programmerdelphi2k

    iOS_64 linking problem

    remember: this way it's not legal way!!! and can not works at all...
  6. programmerdelphi2k

    iOS_64 linking problem

    no! then, just installing Arch edition same that trial!
  7. programmerdelphi2k

    iOS_64 linking problem

    try install Delphi11 CE in a VM, with ALL platforms checked! and see if this files is deployed! if possible, try install from GetIT some updates, etc....
  8. programmerdelphi2k

    iOS_64 linking problem

    I dont have the CE installed in moment, but CE x Pro it's just the license subscription, basically! if IDE supports iOS, then the compiler should be present!
  9. programmerdelphi2k

    security with no access to the cmd.exe

    As it was still "a future plan", I thought you could do the test on your terminal, or who knows on your test PC! good luck, if possible let know about it
  10. programmerdelphi2k

    Intercept "WM_COPY" on Windows

    @gioma maybe exists some other msg about "file created on disk...", I dont know exactly because my knowledge it's not enough here! try send the msg after the files was copyed from your app...
  11. programmerdelphi2k

    Intercept "WM_COPY" on Windows

    I'm not an expert on Windows messages, but you would have to intercept the "WM_DRAWCLIPBOARD" message, to receive notification that MSExplorer intends to copy some object (file/folder/etc...). But first your app must be registered with a "Clipboard Viewer" ( SetClipboardViewer() ), and when you finish the app, do the "Un-Register" ( ChangeClipboardChain() ) try verify this message in your app: procedure WMDrawClipboard(var Msg: TMessage); message WM_DRAWCLIPBOARD; procedure WMChangeCBChain(var Msg: TMessage); message WM_CHANGECBCHAIN; NOTE: This does not guarantee that the file was actually copied, as you are only receiving the notification that something will be copied. The file may be large and the other application will need to check if the file "already exists on disk"
  12. programmerdelphi2k

    iOS_64 linking problem

    really you see it in https://www.embarcadero.com/br/products/rad-studio/product-editions RAD 11 features matrix (including CE) Support for using our C++Builder compilers to build CMake projects on the command line for Win32, Win64, iOS32, iOS64, and Android, including deployment support Support for Delphi Unicode string evaluation, for evaluating properties and variants and function call support when debugging iOS64 applications
  13. programmerdelphi2k

    security with no access to the cmd.exe

    @RTollison removing CMD.exe from the system I think would be a "delicate" thing to do, however, system administrators should know more than I do. In any case, you could just try "blocking its use", which could be reversed more easily: Using GPEdit.msc from the command line (irony or not) User Settings -> Administrative Templates -> System "Prevent access to the command prompt" = Enabled to revert I do it "Disabled" NOTE: Now, just run the tests on your applications and others that possibly use the CMD... however, there will be no guarantees that all applications work as they should, not even the operating system with stability!
  14. @soft4u Bạn đã cài đặt đúng PAServer trên macOS chưa? Bạn có quyền truy cập vào các thư mục nơi nó được cài đặt và nơi dự án của bạn sẽ được tải lên không? Có bất kỳ tường lửa nào chặn truy cập hoặc bất kỳ quy tắc nào để kết thúc kết nối wifi trong một khoảng thời gian không? Have you installed PAServer correctly on macOS? Do you have access privileges to the directories where it is installed and where your project will be uploaded? Is there any firewall blocking access, or any rule to end a wifi connection during a period?
  15. programmerdelphi2k

    iOS_64 linking problem

    in RAD11.3 Architect, this file has "1,76 MB (1.847.296 bytes) in disk", on ..\Bin folder!
  16. programmerdelphi2k

    Can anyone spot the errors?

    I think you are stretching this subject unnecessarily! What I stated in my post above, was that "0".."9" is valid because it is an ordinal type.... and "0000"..."1111" IS NOT! Because, THERE IS NO way to know what would be the "NEXT VALUE" in a "NON ORDINAL" universe (WITHOUT NATURAL ORDER) I hope it ends here, because I will not continue the discussion! is not a "ordinal" ... array['0'.. '9'] of Char is valid!
  17. programmerdelphi2k

    Sorting two lists in step?

    @giomach saving your dic in a file var MyDict: TDictionary<Integer, String>; MyValues: TStringList; begin MyDict := TDictionary<String, String>.Create; MyValues := TStringList.Create; try // add your values on dic MyDict.Add('xxxx', 'yyyy'); // store your dic values in your stringlist temp to save it for var Pair in MyDict do MyValues.Add(Format('%d=%s', [Pair.Key, Pair.Value])); // save it using StringList MyValues.SaveToFile('yourFile.txt'); finally MyDict.Free; MyValues.Free; end; end;
  18. programmerdelphi2k

    Anyone know of an AVIF Image Decoder for Delphi?

    maybe a simple search in Github you'll find some: google search --> site:github.com AVIF "Delphi" "Decode"
  19. programmerdelphi2k

    obb file location

    see on https://developer.android.com/google/play/expansion-files The getObbDir() method returns the specific location for your expansion files in the following form: <shared-storage>/Android/obb/<package-name>/ by Android Developers pages: https://developer.android.com/training/data-storage/shared/documents-files maybe some like this (need test it in your environment) function GetObbDir: string; var AppContext: JContext; ObbDir : JFile; begin AppContext := TAndroidHelper.Context; // SharedActivityContext; // TJNativeActivity.Wrap(System.DelphiActivity); ObbDir := AppContext.GetObbDir; { Delphi11 } // before... // ObbDir := TJContextCompat.JavaClass.GetObbDir(AppContext); Result := JStringToString(ObbDir.GetAbsolutePath); end; tested in Android11 + Delphi11 file:///storage/emulated/0/Android/obb/com.embarcadero.Project1
  20. programmerdelphi2k

    Can anyone spot the errors?

    and Chars is not a "Ordinals"?
  21. programmerdelphi2k

    Can anyone spot the errors?

    is not a "ordinal" ... array['0'.. '9'] of Char is valid!
  22. programmerdelphi2k

    Can anyone spot the errors?

  23. programmerdelphi2k

    Can anyone spot the errors?

    or that way const MyBins3: string = '0,00001,00012,00103,00114,01005,01016,01107,01118,10009,1001A,1010B,1011C,1100D,1101E,1110F,1111'; function MyFindIt2(AMyChars: string; AChar: char): string; var i: integer; begin result := ''; // i := Pos((AChar + ','), AMyChars, 1); // if (i > 0) then result := Copy(MyBins3, i + 2, 4); end; procedure TForm1.Button3Click(Sender: TObject); var LHexToBin: string; begin LHexToBin := Trim(' F0D138A2zzz '); // for var i: integer := 1 to Length(LHexToBin) do Memo1.Lines.Add(MyFindIt2(MyBins3, LHexToBin[i])); end;
  24. programmerdelphi2k

    Can anyone spot the errors?

    or this way... type TMyChars = array [0 .. 15] of char; TMyBins = array [0 .. 15] of string; const MyChars: TMyChars = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); MyBins: TMyBins = ('0000', '0001', '0010', '0011', '0100', '0101', '0110', '0111', '1000', '1001', '1010', '1011', '1100', '1101', '1110', '1111'); function MyFindIt(AMyChars: TMyChars; AChar: char): integer; begin result := -1; // for var i: integer := 0 to high(AMyChars) do if AMyChars[i] = AChar then exit(i); end; procedure TForm1.Button2Click(Sender: TObject); var LHexToBin: string; LResult : string; x : integer; begin LHexToBin := Trim(' F0D138A2zzz '); // for var i: integer := 1 to Length(LHexToBin) do begin x := MyFindIt(MyChars, LHexToBin[i]); // if (x > -1) then Memo1.Lines.Add(MyBins[x]); end; end;
  25. programmerdelphi2k

    Can anyone spot the errors?

    @Emmerisch you can try this way... type TMyDic = record FChar: char; FBinStr: string; // [4]; end; TArrMyDic = array [0 .. 15] of TMyDic; const MyDic: TArrMyDic = ( { } (FChar: '0'; FBinStr: '0000'), { } (FChar: '1'; FBinStr: '0001'), { } (FChar: '2'; FBinStr: '0010'), { } (FChar: '3'; FBinStr: '0011'), { } (FChar: '4'; FBinStr: '0100'), { } (FChar: '5'; FBinStr: '0101'), { } (FChar: '6'; FBinStr: '0110'), { } (FChar: '7'; FBinStr: '0111'), { } (FChar: '8'; FBinStr: '1000'), { } (FChar: '9'; FBinStr: '1001'), { } (FChar: 'A'; FBinStr: '1010'), { } (FChar: 'B'; FBinStr: '1011'), { } (FChar: 'C'; FBinStr: '1100'), { } (FChar: 'D'; FBinStr: '1101'), { } (FChar: 'E'; FBinStr: '1110'), { } (FChar: 'F'; FBinStr: '1111') { } ); function MyFindBin(AMyDic: TArrMyDic; AChar: char): string; begin result := ''; // for var C in AMyDic do if (C.FChar = AChar) then exit(C.FBinStr); end; procedure TForm1.Button1Click(Sender: TObject); var LHexToBin: string; LResult : string; i : integer; begin LHexToBin := 'F0D138A2'; // { for var C in LHexToBin do LResult := LResult + '-' + MyFindBin(MyDic, C); // Memo1.Text := LResult; } // LResult := ''; for i := 1 to length(LHexToBin) - 1 do begin LResult := LResult + '-' + MyFindBin(MyDic, LHexToBin[i]); end; // Memo1.Text := LResult; end;
×