Standard URL encode function?
Look at indy IdURI unit, it has two static methods in the TIdURI class for Encode/Decode the URL. uses IdURI; .. begin S := TIdURI.URLEncode(str); // S := TIdURI.URLDecode(str); end;
Look at indy IdURI unit, it has two static methods in the TIdURI class for Encode/Decode the URL. uses IdURI; .. begin S := TIdURI.URLEncode(str); // S := TIdURI.URLDecode(str); end;
In regular Delphi functions, the function return is actually a parameter passed by reference, even though syntactically it looks and feels like an ‘out’ parameter. You can test this out like so (this may be version dependent): function DoNothing: IInterface; begin if Assigned(Result) then ShowMessage(‘result assigned before invocation’) else ShowMessage(‘result NOT assigned before invocation’); end; … Read more
Darian’s right that the DCCStrs.pas lists the identifiers used by the Delphi compiler. It hadn’t occurred to me to search the source, since Delphi doesn’t include the source to its compiler. I’ve extracted the identifiers for hints and warnings from that file: {$WARN ASG_TO_TYPED_CONST OFF} {$WARN BAD_GLOBAL_SYMBOL OFF} {$WARN BOUNDS_ERROR OFF} {$WARN CASE_LABEL_RANGE OFF} {$WARN … Read more
See delphibasics-FreeAndNil docwiki.embarcadero-FreeAndNil pages-freeandnil [Broken] eurekalog-freeandnil blogs.embarcadero (via Wayback Machine) … And have a look at the implementation: procedure FreeAndNil(var Obj); var Temp: TObject; begin Temp := TObject(Obj); Pointer(Obj) := nil; Temp.Free; end; Examples Consider the following code: procedure TForm1.FormCreate(Sender: TObject); var bm: TBitmap; begin bm := TBitmap.Create; bm.LoadFromFile(‘C:\Users\Andreas Rejbrand\Documents\RAD Studio\6.0\Demos\DelphiWin32\VCLWin32\Football\up.bmp’); bm.Free; if Assigned(bm) then … Read more
The reason for the application window has a bit of a sordid history. When developing Delphi 1, we knew we wanted to use “SDI” (windows scattered all over the desktop) ui model for the IDE. We also knew that Windows sucked (and still does) at that model. However we also noticed that Visual Basic at … Read more
According to the online documentation: Refresh – Repaints the control on the screen. Call Refresh method to repaint the control immediately. Refresh calls the Repaint method. Use the Refresh and Repaint methods interchangeably. Repaint – Forces the control to repaint its image on the screen. Call Repaint to force the control to repaint its image … Read more
You can get useful memory usage information out of the Delphi runtime without using any direct Win32 calls: unit X; uses FastMM4; //include this or method will return 0. …. function GetMemoryUsed: UInt64; var st: TMemoryManagerState; sb: TSmallBlockTypeState; begin GetMemoryManagerState(st); result := st.TotalAllocatedMediumBlockSize + st.TotalAllocatedLargeBlockSize; for sb in st.SmallBlockTypeStates do begin result := result + … Read more
I use FL studios with my Midi and odds are is you need to turn down your buffer quality so that there is little to no delay. It’s probably by default set to about mid-high range which means you will almost for sure have 1 – 1.5 second delay Don’t turn it down too low … Read more
Workaround rowCnt := UsedRange.Rows.Count; colCnt := UsedRange.Columns.Count; for Row := 1 to rowCnt do begin for Col := 1 to colCnt do begin v := UsedRange.Item[Row, Col].Value; end; end; This also works (and may help you find a workaround in more complicated use cases): function ColCount(const range: ExcelRange): integer; begin Result := range.Columns.Count; end; for … Read more
For the price, you cannot beat FastMM4 as a memory tracker. It’s simple to use yet powerful and well integrated with Delphi. I guess that you know that, without downloading, installing or changing anything else, just putting this line ReportMemoryLeaksOnShutDown := True; anywhere in your code, will enable basic reporting of memory leaks. If you … Read more