Add Macromedia Flash Resizing - A easy way


Reading the code of a program that i was written in 1998, i found a fix to the glitch that occurs when a Flash control is resized inside a delphi application!

The Problem:
- I lost some time searching about the control donīt receive any notification about changes that modify itself.
The fact is that, after it was dropped in a form or any parent control, it loses the perception of any changes made, because it expect that the parent send this message to him (Using some OLE methodīs).

- Starting at the concept that "when the control is created at runtime it obey the first shape" i looked for a malfunction in one CreateWindow function call.

Voila!

The Solution:
- Overriding the resize method of TControl i could redefine the parent to nil and back. It force the TOleControl to notify the Activex that something was changed and Activex properly reply to event!

The Code:
- After importing the Flash Control (SWFLASH.OCX) to a Delphi unit you can apply this patch:

//-- Begin --
{Shockwave Control}
TShockwaveFlash = class(TOleControl)
private
...
protected
...
{Resize Error Workaround}
procedure Resize; override;
...
end;

{Implementation}
procedure TShockwaveFlash.Resize;
var
SavedParent: TWinControl;
begin
{Sync flash bounds after any move}

SavedParent := Parent;
Try
Parent := nil;
inherited;
finally
Parent := SavedParent;
end;
end;

//--End

You can download the unit shockwav.pas to read more about this!

Obs:

Donīt press Ctrl+Shft+C at TShockwaveFlash to use Class Completion to declare the implementation for you!

It will redefine a large number procedure that are inherited of TOleControl and donīt exists at this time!

So write it manualy!!!!

The End:
- I hope that it was usefull to something!!!
Related Discussions
  • HOW CAN I LOG A MESSAGE IN THE EVENTVIEWER OF WINNT? (2001-01-09 01:53:38)
    Thanks, Actualy, it uses the same procedure I used, but it is explained... Elscampie
  • HOW DO I STRETCH THE SIZE OF FORM WHEN SCREEN RES INCREASED? (2001-01-09 05:54:00)
    first of all i am not sure what is your requirement are u concerned with first time sizing of your form on initialization or do you want to...
  • CLOSE AN APP I JUST OPEN WITHIN DELPHI (2001-01-12 15:32:36)
    See this component... TRunner. http://sedlan.com/runner.php Key Features Available for Delphi versions 3, 4 and 5 Get the handle of the...
  • BDE INSTALLATION KIT (2001-01-11 05:04:48)
    Yes, you can install BDE without the use of InstallShield. (Even thu it's easy'er to do it with InstallShield Express) First you need all of...
  • MP3 (2001-01-12 01:15:38)
    Hi! Thx to you all ho have answered to my question about MP3. There seems to be a some easy solutions for me and I will try out them to see...
  • YOUR FAVORITE BDE ALTERNATIVE? (2001-01-13 12:44:19)
    I joined the company I am currently working for three years ago. MsAccess databases were managed with the BDE. Since we ship our application to...
  • SEARCHING RICHEDIT FOR CERTAIN TEXT AND CHANGING FONT (2002-09-09 17:01:26)
    I should recomend you to use the SynEdit highlighters instead, they are very powerful. And you can by easy means create your own syntax highlighter...
  • EASY ENCRYPT A STRING? (2001-01-16 18:30:59)
    const C1 = 52845; C2 = 22719; function Encrypt(const S: String; Key: Word): String; var I: byte; begin Result := S; for...
  • POPUPMENU (2001-01-16 13:38:57)
    http://www.delphipages.com/tips/thread.cfm?ID=80 This sounds like the solution to your question, but not sure, look at it and see. Yes, it is...
  • CHECKING FOR DEPHI IDE / DEBUGGER (2001-01-17 07:38:26)
    Yes, right, it should work with strings as well. Sorry, I used this example a long time ago, as I hadn't a lot of expirience with delphi.
Latest News
Submit News Form Past News
Latest Forum Entries