I have a Firemonkey form in RAD studio and I am trying to do some experiments using MediaPlayer. MediaPlayerControl has a procedure named PaintTo, as the name implies I would expect by using this to be able and show my video in another object in my form. I don't know though, neither I can find in the documentation the correct way of using
MediaPlayerControl1.PaintTo();
It asks for a TCanvas a rectangle and a FMXObject. As a Canvas I tried giving
ImageViewer1.Bitmap.Canvas
but I don't know what an FMXObject is. Can someone provide a valid use of the PaintTo procedure?
Related
I am using RAD Studio xe6 and I have a simple Firemonkey form, what I want to do is get all Images that are in a folder and display them in a list for the user to see, is this possible, and if yes how.
Delphi already ships with a sample program which does similar thing that you seek. The sample program is called FireFlow. If you haven't installed sample programs while installing Delphi you can get the sample program from:
http://docwiki.embarcadero.com/CodeExamples/XE6/en/FMX.FireFlow_Sample
But othervise what you want to do is first search the specific directory for supported image files. To do this use FindFirst, FindNext.
Then you need to decide how are you going to display these images. Now if you intend to display them inside the listbox controll do check the CustomListBox sample which you can also get from web here:
http://docwiki.embarcadero.com/CodeExamples/XE6/en/FMX.CustomListBox_Sample
Presently I am developing a small security application in Delphi. It is intended to be installed in Windows XP and higher OS-s and almost finished, but I'd like to implement the feature to scan MS Office files while opening. To that end, I'm planning to use IOfficeAntiVirus interface. I am trying to realize using the scan method of the interface based on the article by Serge Perevoznyk (http://www.delphi-central.com/MS_Office_AV_API.aspx).
The original example supposed to display a message box when a file is opened, however it does not, although I tried it on different versions of Windows and Office. I compared this solution with the information on MSDN. It seemed to be correct. I suppose there should be some additional settings in the Windows Registry which I missed to make. Can anyone give me some hint where shall I look for the solution?
You do not use IOfficeAntiVirus, you implement it.
You need to create a new ActiveX Library that contains a new ActiveX Control whose implementation class implements the Scan() method. In the Control's registration code, you have to use ICatRegister to register your Control as using the CATID_MSOfficeAntiVirus category. That way, Office/IE can find your ActiveX Control so it can instantiate it and call its Scan() implementation. The second half of Serge's article shows you how to do that (Serge's example shows Scan() taking a PChar as input, but it actually takes a TMsoavinfo^ instead. Don't pass TMsoavinfo using a PChar).
You then have to register the resulting DLL using Windows' command-line regsvr32.exe app.
If Office/IE is not calling your Scan() implementation, then you are likely not registering your ActiveX control correctly, such as if you are not taking 32bit/64bit and/or UAC issues into account.
Just for information's sake if anyone is interested. Remy's answer is correct, however there is a small bug in the initialization section of the above mentioned example project.
Instead of
TComObjectFactory.Create(ComServer, TMsoTest, Class_MsoTest,
'MsoTest', '', ciMultiInstance, tmApartment);
The correct command is:
TMSOAVFactory.Create(ComServer, TMsoTest, Class_MsoTest,
'MsoTest', '', ciMultiInstance, tmApartment);
The problem: I need to obtain the selected text from a window in a Windows application (not my program). I am doing my work in Delphi XE and the software I am attempting to access is a kluge built over the past 15 years with C, C++, VB and who knows what else. I do not have the source code. The edit box (an RTF memo) I am attempting to read is of the class "Ter32Class". When I use wm_copy, nothing goes to the clipboard. when I use wm_gettext, nothing. When I use wm_keydown commands (to simulate Ctrl-Ins or Ctrl-C) nothing happens. Note that I can get all of these alternatives to work in wordpad, notepad, and FireFox but not this application (or OpenOffice, incidentally, but that's not the issue). The only way I have been able to programmatically obtain text from this box is to use autohotkey with the simple "send ^c" command. While it works, it is inelegant. HELP?!?
More information: Window hierarchy: Ter32Class is a child of OI_Mdi which is a child of MDIClient, which is a child of OI_Window . I am drilling down to obtain the appropriate handle as it will respond to a paste command.
I am using Delphi XE but I'd love any solution in C++ or VB if no Delphi XE gurus have the answer.
From Quick Macros Forum
One of the windows I need to talk to is of class Ter32Class which
apparently is a TE Edit Control, an editor that doesn't inherit from
the standard RichText Control
and
The published method of talking to this control is via it's DLL
so unless something has changed (post is 2006), it appears you'll need to use it's dll to get the text.
From Sub Systems (TE Edit control website)
Application Interface functions
GetTerBuffer: Retrieve Window Text
HANDLE GetTerBuffer(hWnd, size)
There is a whole host of components that I am trying out to better understand how to detect when a file or folder has changed. I want to write a delphi application to also do this but delphi Unicode(Tiburon) doesn't seem to ship with any component that can accomplish this. At least not anymore. I found a curious component on the palette called shellersources and after just placing it on a form and running it I get an error:
Cmctrls was compiled with a different version of SHLObj.IAutocomplete
I tried virtually all the component listed here: shell resourcehttp://www.torry.net/pages.php?id=252 and interestingly I get the same exact error on compiling them. I am running delphi on Vista, could this be a vista issue? I also tried the SHChangeNotify component from about.com and even it too produced an identical error concerning SHlObj.IAutocomplete. Anyone noticed this? Strange.
There are two Windows API calls that will help you accomplish this in Delphi:
FindFirstChangeNotification
FindNextChangeNotification
The drawback is that these function calls are low-level-non-delphi components. But you can still make those function calls in Delphi. If you ABSOLUTELY need a delphi component, you could always write your own, using the mentioned functions as base.
Is there really not a TSpinEdit control for floats in Delphi? It looks like there are third party components that supply a control that will work.
How do you implement TSpinEdit for floats? I've been creating my own with a TEDit field and a TSpinButton positioned right beside it but it seems like there should be a better way.
TJvSpinEdit is a part of the JEDI Visual Component Library.
As far as I know it has a property called ValueType which you can set to vtFloat.
As far as I know there exists no such component in Delphi.
I'm also using a component from a 3rd party library, SpTBXLib, which is very good for other things, too.
Even if there aren't, you can easily create one using two buttons and a textbox.
There is non in Delphi, but you can create your own.
I have done so for my open source project, you might check it out as a starting point for your own.
EDIT: You will also need following two file to get it working:
KomponenteSplosno.pas
RisanjeSplosno.pas