Leaderboard
Popular Content
Showing content with the highest reputation since 04/27/24 in Posts
-
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
PeterBelow replied to sp0987's topic in General Help
If you changed the interface section (bad idea, really) that means that every RTL and VCL unit using system.sysutils needs to be recompiled in addition to your own units and the resulting dcus need to be put in a folder where they replace the dcus that come with the Delphi installation. And remember that said installation has different dcus for debug and release and different platforms, something D7 did not have. Best reevaluate the original cause for this change in D7 and see wether you can avoid it in D11 completely. -
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Brandon Staggs replied to sp0987's topic in General Help
Unfortunately, since they broke the most truly useful feature of class helpers by removing the ability of the helper to access private members of the class, they don't work so great as an alternative to editing source files directly. Now you have to write a RTTI monstrosity to accomplish the same thing. -
ANN HelpNDoc 9.2 is available: AI-Powered Technical Writing, improved documentation import, and more...
Anders Melander replied to HelpNDoc's topic in Delphi Third-Party
...depending on your definition of "smarter"- 6 replies
-
- helpndoc
- help authoring tools
-
(and 1 more)
Tagged with:
-
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Anders Melander replied to sp0987's topic in General Help
There's no difference between Delphi 7 and 11 with regard to modifying sysutils that I can think of. You have most likely not specified the correct project search path. Where have you placed the modified sysutils.pas ? -
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Sherlock replied to sp0987's topic in General Help
I presume you copied this altered version to your projects path...? And it is missing from the other project? Project requirements that require a change to a file which might in turn get changed with every patch/update of the IDE are at least worthy of discussion. -
How to write several SetAs...Array procedures ?
Uwe Raabe replied to RayTmsk's topic in RTL and Delphi Object Pascal
That is true for strings, but nor for dynamic arrays. -
A gem from the past (Goto)
Sherlock replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
That reminds me: -
Bug: Lock Controls is not restored at IDE start!
PeterPanettone posted a topic in Delphi IDE and APIs
The activated option "Lock Controls" in the Edit menu is not restored when re-starting the IDE! This option is very important and helpful, as it prevents an unintentional repositioning of controls in the Form Designer! It also prevents the annoying file change in the FormDesigner that frequently (randomly) happens when switching from the Code Editor to the FormDesigner (with F12), caused by the automatic re-aligning of aligned controls in the Form Designer: The option "Lock Controls" should be restored automatically when re-starting the IDE to prevent this annoying behavior! Can anyone confirm this? -
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Anders Melander replied to sp0987's topic in General Help
The project search path has precedence. Post your .dproj file if you can. ...or you could explain what your end goal is; Why do you need to modify sysutils.pas? We might help you with a better solution. -
I did that a few days ago out of curiosity. I did it a function at a time so it needs work to make it workable. procedure FindDesktopFolderView(riid: TGUID; var ppv: Pointer); var spShellWindows: IShellWindows; vtLoc: OleVariant; vtEmpty: OleVariant; lhwnd: LongInt; spdisp: IDispatch; spBrowser: IShellBrowser; spView: IShellView; begin spShellWindows := CoShellWindows.Create; vtLoc := CSIDL_DESKTOP; vtEmpty := VarEmpty; spShellWindows.FindWindowSW(vtLoc, vtEmpty, SWC_DESKTOP, lhwnd, SWFO_NEEDDISPATCH, spdisp); spBrowser := (spdisp as IServiceProvider).QueryService(SID_STopLevelBrowser, IShellBrowser) as IShellBrowser; spBrowser.QueryActiveShellView(spView); spView.QueryInterface(riid, ppv); end; ----------------- program DesktopFolderView; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, ActiveX, ComObj, ShlObj, ShellAPI; // CCoInitialize incorporated by reference function wmain(argc: Integer; argv: PWideChar): Integer; var init: IUnknown; // Equivalent to CCoInitialize spView: IFolderView; spFolder: IShellFolder; spEnum: IEnumIDList; spidl: PItemIDList; str: TStrRet; spszName: PWideChar; pt: TPoint; begin init := CreateComObject(CLSID_CoInitialize); FindDesktopFolderView(IID_IFolderView, spView); spView.GetFolder(IID_IShellFolder, spFolder); spView.Items(SVGIO_ALLVIEW, IID_IEnumIDList, spEnum); while spEnum.Next(1, spidl, nil) = S_OK do begin spFolder.GetDisplayNameOf(spidl, SHGDN_NORMAL, str); StrRetToStr(@str, spidl, spszName); spView.GetItemPosition(spidl, pt); Writeln(Format('At %4d,%4d is %s', [pt.x, pt.y, WideString(spszName)])); CoTaskMemFree(spidl); end; Result := 0; end; begin try CoInitialize(nil); wmain(ParamCount, PWideChar(ParamStr(0))); CoUninitialize; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. --------------------------- program DesktopFolderRandomPosition; {$APPTYPE CONSOLE} uses System.SysUtils, ActiveX, ComObj, ShlObj, ShellAPI, Windows; function wmain(argc: Integer; argv: PWideChar): Integer; var init: IUnknown; // Equivalent to CCoInitialize spView: IFolderView; spEnum: IEnumIDList; spidl: PItemIDList; pt: TPoint; apidl: array[0..0] of PItemIDList; begin init := CreateComObject(CLSID_CoInitialize); FindDesktopFolderView(IID_IFolderView, spView); spView.Items(SVGIO_ALLVIEW, IID_IEnumIDList, spEnum); while spEnum.Next(1, spidl, nil) = S_OK do begin spView.GetItemPosition(spidl, pt); pt.x := pt.x + (Random(5) - 2); pt.y := pt.y + (Random(5) - 2); apidl[0] := spidl; spView.SelectAndPositionItems(1, @apidl[0], @pt, SVSI_POSITIONITEM); CoTaskMemFree(spidl); end; Result := 0; end; begin try CoInitialize(nil); Randomize; // Initialize random number generator wmain(ParamCount, PWideChar(ParamStr(0))); CoUninitialize; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. ------------------------------------ procedure SavePositions(pView: IFolderView; pszFile: PWideChar); var spStream: IStream; spEnum: IEnumIDList; spidl: PItemIDList; pt: TPoint; begin SHCreateStreamOnFileEx(pszFile, STGM_CREATE or STGM_WRITE, FILE_ATTRIBUTE_NORMAL, True, nil, spStream); pView.Items(SVGIO_ALLVIEW, IID_IEnumIDList, spEnum); while spEnum.Next(1, spidl, nil) = S_OK do begin WritePidlToStream(spStream, spidl); // Custom function to write PIDL to stream pView.GetItemPosition(spidl, pt); WritePointToStream(spStream, pt); // Custom function to write POINT to stream ILFree(spidl); // Free the PIDL end; end; ----------------------------------- procedure RestorePositions(pView: IFolderView; pszFile: PWideChar); var spStream: IStream; spidl: PItemIDList; pt: TPoint; apidl: array[0..0] of PItemIDList; begin // Create a file stream SHCreateStreamOnFileEx(pszFile, STGM_READ, FILE_ATTRIBUTE_NORMAL, False, nil, spStream); // Read PIDLs and their positions from the stream and restore them while Succeeded(IStream_ReadPidl(spStream, spidl)) and Succeeded(spStream.Read(@pt, SizeOf(pt), nil)) do begin apidl[0] := spidl; pView.SelectAndPositionItems(1, @apidl[0], @pt, SVSI_POSITIONITEM); CoTaskMemFree(spidl); // Free the PIDL end; end; // Note: IStream_ReadPidl is a placeholder for the actual function you would use to read a PIDL from a stream. // You will need to implement this functionality in Delphi, as it is not provided by Delphi's standard libraries.
-
TCP Port Check with timeout
Remy Lebeau replied to chmichael's topic in ICS - Internet Component Suite
You are leaking the socket handle if connect() fails. You have to close the handle if socket() succeeds, regardless of whether connect() succeeds. You can't reduce (or even set) the timeout on a blocking connect(). You have to use a non-blocking connect() and then use select() or equivalent to implement the timeout. AFAIK, you can't disable SACK on a per-socket basis. You have to use the Registry or command-line netsh utility to disable it globally: https://superuser.com/questions/1808254/how-to-disable-tcp-sack-in-windows-xp https://www.linkedin.com/advice/3/how-can-tcp-selective-acknowledgment-sack-improve-heatc -
You might be able to modify this code to use TMemo instead of TLabel: https://github.com/grijjy/CodeRage2019/tree/master/HtmlLabel
-
The standard FMX TMemo simply does not support HTML (or even basic text formatting in general). You will have to use a 3rd party control (or make your own from scratch) to display rich/formatted text.
-
File opening error C++ builder CE trivial program
Remy Lebeau replied to BruceV's topic in General Help
The C++ standard file library really sucks what it comes to error reporting. I would suggest using TFileStream or even CreateFile() directly to get better details about what the actual failure is. On a side note: kbhit() is a really old-school Borland function, it is not standard in either C or C++. Consider using C++'s standard std::cin.get() method instead. Try this: #include <iostream> #include <memory> #include <System.SysUtils.hpp> #include <System.Classes.hpp> int _tmain(int argc, _TCHAR* argv[]) { try { auto ifs = std::make_unique<TFileStream>(_D("C:\\Junk\\testfile.txt"), fmOpenRead); std::cout << "Opened OK\n"; } catch (const Sysutils::Exception &e) { std::wcout << L"Can't open input file. Error: " << e.Message.c_str() << "\n"; std::cin.get(); return 1; } std::cin.get(); return 0; } Or: #include <iostream> #include <windows.h> int _tmain(int argc, _TCHAR* argv[]) { HANDLE hFile = CreateFileW(L"C:\\Junk\\testfile.txt", GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); if (hFile == INVALID_HANDLE_VALUE) { DWORD dwError = GetLastError(); cout << "Can't open input file. Error: " << dwError << "\n"; std::cin.get(); return 1; } std::cout << "Opened OK\n"; CloseHandle(hFile); std::cin.get(); return 0; } -
File opening error C++ builder CE trivial program
bdw_nz20 replied to BruceV's topic in General Help
That code works for me fine on 12.1, I guess the basic question is do you have a file the that input stream can load. If it doesnt exist it will fail -
In that case you will have to implement it yourself.
-
https://delphihtmlcomponents.com/editor.html
-
A gem from the past (Goto)
Bill Meyer replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
There is a classic, if dusty, article from Donald Knuth: https://pic.plover.com/knuth-GOTO.pdf -
Bug: Lock Controls is not restored at IDE start!
MarkShark replied to PeterPanettone's topic in Delphi IDE and APIs
As a possibly related note. I've created a bug report Lock Controls not visible initially regarding that menu item having some issues when placed on an IDE toolbar. I always do this when I customize the IDE after install. It's a very useful feature. -
Bug: Lock Controls is not restored at IDE start!
Uwe Raabe replied to PeterPanettone's topic in Delphi IDE and APIs
Seems someone already filed a report 8 years ago: https://quality.embarcadero.com/browse/RSP-13448 -
WebUI framework: Technical preview. Part 1.
Alexander Sviridenkov replied to Alexander Sviridenkov's topic in I made this
Small example of using custom HTML/JS inside Report control. JS code send pallet and boxes params to Server (Delphi), receive calculated pallet loading and display it. pallet.mp4 -
Delphi and "Use only memory safe languages"
dummzeuch replied to Die Holländer's topic in General Help
Since Delphi is kind of a legacy programming language nowadays, backwards compatibility is very important. You don't want to throw away millions lines of proven code because they don't work any more, or even worse, because they are now buggy. So trying to change strings to be zero based was a bad idea, even if it was "just for mobile platforms". -
Raymond Chen's blog article on Manipulating the positions of desktop icons includes code "to enumerate all the desktop icons and print their names and locations."
-
My recommendation would be, to avoid 3rd Libraries as much as possible. Since FMX on Mobile is very volatile and Android/iOS change significantly every 6 months, it is very important not to rely on additional, possibly unstable, external components. My recommendation would be, to make as much as possible on your own. I can recommend DelphiWorlds-Kastri as a common life-saver, TMS FNC and other TMS components - since they are quite active, but I would still reduce any external reference as much as possible. Moreover, I would not directly try to port a desktop app to mobile. Better to start clean with a mobile-first app and then put your "desktop" functionality back step-by-step.
-
MsgDlgIcons[TMsgDlgType.mtInformation]:=TMsgDlgIcon.mdiInformation; MessageDlg('Exiting the Delphi application.', mtInformation, [mbOk], 0, mbOk); You have to System.UITypes into the uses.