It is really difficult to get documentation on the Flash Plugin, if
anybody knows of a good resource, please share it if you can. I even
applied for a Flash Player SDK license from Macromedia, but haven't
heard anything yet. Looking at the code Delphi generated when
importing the Flash ActiveX control I did the following.
{$MACRO ON}
{$IFDEF MSWINDOWS}
{$DEFINE extdecl := stdcall}
{$ELSE}
{$DEFINE extdecl := cdecl}
{$ENDIF}
var
flashGetVariable: function (const pVariable: PChar): PChar; extdecl;
function TFlashPlayer.GetVariable(const pVariable: String): String;
var
s: WideString;
i: LongInt;
function GetFlashProcAddress(Lib: PtrInt; ProcName: PChar): Pointer;
begin
Result := GetProcAddress(Lib, ProcName);
end;
begin
if NSPluginLibrary.LibraryHandle < 32 then
raise Exception.Create('LibraryHandle incorrect!');
flashGetVariable := nil;
flashGetVariable := GetFlashProcAddress(NSPluginLibrary.LibraryHandle,
'native_ShockwaveFlash_GetVariable');
if Assigned(flashGetVariable) then
begin
try
s := ''; { just for testing }
{$Warning It throws an AV here! Not 100% sure what the message
signature is, but got this from the ActiveX generated code from
Delphi. }
flashGetVariable(PChar(pVariable));
Result := s; { just for testing, it never get here anyways! }
except
on E: Exception do
ShowMessage('Error: ' + E.Message);
end;
end
else
Result := 'Failed';
end;
If a backtrace will help, I can post that as well...
I also changed the flashGetVariable to use WideStrings instead of
PChar and no difference. I used PChar, as that is normall what C/C++
programs use in there API definitions.
Regards,
- Graeme -
On 3/6/06, Micha Nelissen <[EMAIL PROTECTED]> wrote:
> Graeme Geldenhuys wrote:
> > Problem in more detail:
> > I call the GetProcAddress using the proc name exported. I then call
> > the function and get a access violation. When I run it through gdb,
> > it shows I am getting the address for the correct function, but when I
> > call the function, it says I am trying to call a different function,
> > and throws the access violation.
>
> What is the definition of the function pointer type, and how are you
> calling it ?
>
> Micha
>
> _________________________________________________________________
> To unsubscribe: mail [EMAIL PROTECTED] with
> "unsubscribe" as the Subject
> archives at http://www.lazarus.freepascal.org/mailarchives
>
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives