Howto add menu item to Mac OS Finder in Delphi XE2

Finally, I returned to this project and successfully registered service provider and handled service request. First of all I tried to use NSRegisterServicesProvider method, but there is no such method in Macapi sources, so I searched for applicationDidFinishLaunching delegate. Using it I registered my service provider: procedure TApplicationDelegate.applicationDidFinishLaunching(Notification: Pointer); var autoReleasePool: NSAutoreleasePool; app: NSApplication; provider: … Read more

Which language elements can be annotated using attributes language feature of Delphi?

Interesting question! You can declare attributes on almost anything, the problem is retrieving them using RTTI. Here’s a quick console demo of declaring custom attributes for: Enums Function type Procedure type Method type (of object) Aliased type Record type Class type Record type that’s internal to a class Record field Record method Class instance field … Read more

How to open an URL with the default browser with FireMonkey cross-platform applications?

Regarding the answer of mjn, I have written the following unit. I have successfully tested it on Windows but I don’t have an OSX to test it on this platform. If someone can confirm it works, I’d appreciate. unit fOpen; interface uses {$IFDEF MSWINDOWS} Winapi.ShellAPI, Winapi.Windows; {$ENDIF MSWINDOWS} {$IFDEF POSIX} Posix.Stdlib; {$ENDIF POSIX} type TMisc … Read more

Firemonkey (FMX) bitmap and colours

FMX use antialiazing for drawing. If you would like draw line without blur effect you should use special function for pixel alignment: TCanvas.AlignToPixel TCanvas.AlignToPixelVertically TCanvas.AlignToPixelHorizontally This functions automatically calculate pixel position for drawing without blur. Thank you

Why does CreateProcess give error 193 (%1 is not a valid Win32 app)

The most likely explanations for that error are: The file you are attempting to load is not an executable file. CreateProcess requires you to provide an executable file. If you wish to be able to open any file with its associated application then you need ShellExecute rather than CreateProcess. There is a problem loading one … Read more

Is there a trick for using TSQLMonitor with a TSQLConnection that uses the new ODBC dbExpress driver?

Try this out: procedure TForm2.Button1Click(Sender: TObject); begin try Connect; SQLMonitor1.SQLConnection := SQLConnection1; SQLMonitor1.Active := True; ExecuteQueries; SQLMonitor1.SaveToFile(‘D:\\Log.txt’); except on E: Exception do ShowMessage(‘Exception ocurred!: ‘ + E.Message); end; end; procedure TForm2.Connect; begin SQLConnection1 := TSQLConnection.Create(nil); SQLConnection1.ConnectionName := ‘odbcinterbaseconnection’; SQLConnection1.LoginPrompt := False; SQLConnection1.LoadParamsOnConnect := True; SQLConnection1.Connected := True; end; procedure TForm2.ExecuteQueries; var Query: String; begin try … Read more