Recent

Author Topic: Trying to load an Icon file and get an access violation ..  (Read 2067 times)

Dasun

  • New Member
  • *
  • Posts: 41
Trying to load an Icon file and get an access violation ..
« on: July 31, 2016, 08:46:56 am »
All, appreciate some help here ..Evaluating fpgui toolkit and need to load an icon file.  I thought the following code snippet would do but I get an access violation error -  The Icon file exists, it is a windows icon file - copied from a windows machine - and I can not find out why LoadFromFile blows up after a real good dig - any ideas appreciated.

===C ode Snippet

Test : Ticon ;
.
.
.
Test := TIcon.Create() ;

 Test.LoadFromFile(test.ico');

 fpgImages.AddBMP('mainicon',  Test.RawImage.Data , Test.RawImage.DataSize); 

Error message
===========
Project xxxx raised exception class 'External: SIGSEGV'.

 In file 'include/winapi.inc' at line 485

Dasun

  • New Member
  • *
  • Posts: 41
Re: Trying to load an Icon file and get an access violation ..
« Reply #1 on: July 31, 2016, 09:02:46 pm »
Bit more information ... I am running on Linux Mint...

So when I try to load an Icon file..with test.LoadFromFile

A number of functions to load the Icon file are called but the the trouble starts with In Icon.inc ...

class function TCustomIcon.GetDefaultSize: TSize;
begin
  Result := Size(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
end;

Which calls

In winapi.inc
function GetSystemMetrics(nIndex: Integer): Integer;
begin
  Result := WidgetSet.GetSystemMetrics(nIndex);     ///AND BOOM - A SEG V
end;

So what is the go?  Is GetSystemMetrics not defined for the widgetset ?

Appreciate any help...

 

TinyPortal © 2005-2018