Recent

Author Topic: [Solved] i can't inatall Dam dialog ?!  (Read 4440 times)

majid.ebru

  • Hero Member
  • *****
  • Posts: 519
Re: i can't inatall Dam dialog ?!
« Reply #15 on: December 04, 2023, 06:14:27 am »
Your screenshot looks like Windows 7 or even Vista. Searching the web for "shcore.dll windows 7", however, shows that this dll does not exist for Windows 7, only for 8.1 or later: https://stackoverflow.com/questions/37058349/shcore-dll-on-windows-7-does-it-exist

thank you
yes my OS is windows 7 home ( maybe Enterprise ?!?  %) )
now What should I do to install the ِDLL file?
« Last Edit: December 04, 2023, 06:16:36 am by majid.ebru »

majid.ebru

  • Hero Member
  • *****
  • Posts: 519
Re: i can't inatall Dam dialog ?!
« Reply #16 on: December 04, 2023, 06:15:33 am »
if all you want is an escape code string, can't you use something like the IPro HTML panel and use the "SetHTMLFromStr" method?

Lazarus has a HTML editor where you should be able to come up with something.

I assume you are looing for mark up strings?

thank you
i just want to use dam dialog https://github.com/digao-dalpiaz/Dam

af0815

  • Hero Member
  • *****
  • Posts: 1379
Re: i can't inatall Dam dialog ?!
« Reply #17 on: December 04, 2023, 09:20:18 am »
As you see, Dam dialoge need a function, available only in win 8.1 and newer as wp found out. So you can ask the maintainer of dam dialoge to fix it or fix it by yourself eg. make a dummy funktion.

the component looks nice, but is win only, this is one goal for me not to go deeper, becauae i need win and linux on different platforms.
regards
Andreas

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: i can't inatall Dam dialog ?!
« Reply #18 on: December 04, 2023, 09:28:51 am »
...
now What should I do to install the ِDLL file?
Should be obvious ? Upgrade to a Windows version that comes accompanied with this specific dll or use a(nother) solution that does not depend on the presence of this dll.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: i can't inatall Dam dialog ?!
« Reply #19 on: December 04, 2023, 11:33:13 am »
My first idea when a feature in a third-party unit is not supported on my system is: Remove it, maybe it is not needed (there is lots of ancient unneeded stuff in complicated units!), or I can work around it.

Following this idea, I searched for "shcore.dll" within the DzHtmlText and Dam downloads - it is only found in unit "ScalingUtils", function GetDpiForMonitor. Commented this unit out and compiled the DzHtmlText package to let the compiler help me. The removed function is called by function RetrieveMonitorPPI(F: TCustomForm). Looking at the source code of this function I get the impression, without knowing details, that it seems to determine the PixelsPerInch for the monitor on with the form F is displayed. I do a Ctrl+click on "TCustomForm" to let the IDE open the declaration of TCustomForm for me. Scrolling down a bit I see that there is a property "Monitor: TMonitor" - ah: every form in Lazarus knows the monitor, which which it is displayed! Another Ctrl+click, now on TMonitor, and another scroll down shows that TMonitor has a property PixelsPerInch. Now it is easy: remove the function RetrieveMonitorPPI from "ScalingUtils" and replace it by an equally named function which returns the Result := F.Monitor.PixelsPerInch. A final compilation test - and it seems to work without the shcore.dll.

In summary:
Code: Pascal  [Select][+][-]
  1. (*
  2. type
  3.   TMonitorDpiType = (
  4.     MDT_EFFECTIVE_DPI = 0,
  5.     MDT_ANGULAR_DPI = 1,
  6.     MDT_RAW_DPI = 2,
  7.     MDT_DEFAULT = MDT_EFFECTIVE_DPI
  8.   );
  9.  
  10. {$WARN SYMBOL_PLATFORM OFF}
  11. function GetDpiForMonitor(
  12.   hmonitor: HMONITOR;
  13.   dpiType: TMonitorDpiType;
  14.   out dpiX: UINT;
  15.   out dpiY: UINT
  16.   ): HRESULT; stdcall; external 'Shcore.dll' {$IFDEF DCC}delayed{$ENDIF};
  17. {$WARN SYMBOL_PLATFORM ON}
  18.  
  19. function RetrieveMonitorPPI(F: TCustomForm): Integer;
  20. var
  21.   Ydpi: Cardinal;
  22.   Xdpi: Cardinal;
  23.   DC: HDC;
  24. begin
  25.   if CheckWin32Version(6,3) then
  26.   begin
  27.     if GetDpiForMonitor(F.Monitor.Handle, TMonitorDpiType.MDT_EFFECTIVE_DPI, Ydpi, Xdpi) = S_OK then
  28.       Result := Ydpi
  29.     else
  30.       Result := 0;
  31.   end
  32.   else
  33.   begin
  34.     DC := GetDC(0);
  35.     Result := GetDeviceCaps(DC, LOGPIXELSY);
  36.     ReleaseDC(0, DC);
  37.   end;
  38. end;
  39. *)
  40.  
  41. function RetrieveMonitorPPI(F: TCustomForm): Integer;
  42. begin
  43.   Result := F.Monitor.PixelsPerInch;
  44. end;              

I normally work with Laz/main, but checked back to v2.0.12 and found that this patch works at least back to this version, probably even with older ones.

The patch seems to be needed for high-dpi handling. But since the packages are primarily written for Delphi, I doubt whether they handle high-res monitors in the correct way for Lazarus. But even if this - or my entire patch - would not work you will certainly be able to compile and install the dam package now.

[P.S.]
There were two additional error messages when compiling the Dam package, related to some "Styleelements" property. You can safely remove them (or put them into a {$IFNDEF FPC}...{$ENDIF} directive).
« Last Edit: December 04, 2023, 12:21:21 pm by wp »

Thaddy

  • Hero Member
  • *****
  • Posts: 16158
  • Censorship about opinions does not belong here.
Re: i can't inatall Dam dialog ?!
« Reply #20 on: December 04, 2023, 02:38:15 pm »
All this I read is nonsense. better to delete this thread and start with  new one. Reason is that you will get a proper answer in two lines.
If I smell bad code it usually is bad code and that includes my own code.

majid.ebru

  • Hero Member
  • *****
  • Posts: 519
Re: i can't inatall Dam dialog ?!
« Reply #21 on: December 04, 2023, 07:44:15 pm »
i created new topic https://forum.lazarus.freepascal.org/index.php?topic=65444.new#new

please , delete this topice , thank you

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: i can't inatall Dam dialog ?!
« Reply #22 on: December 04, 2023, 07:55:42 pm »
i created new topic https://forum.lazarus.freepascal.org/index.php?topic=65444.new#new

please , delete this topice , thank you
No. Thaddy is talking nonsense, he's in his grumpy mode again...

majid.ebru

  • Hero Member
  • *****
  • Posts: 519
Re: i can't inatall Dam dialog ?!
« Reply #23 on: December 05, 2023, 10:12:23 am »
My first idea when a feature in a third-party unit is not supported on my system is: Remove it, maybe it is not needed (there is lots of ancient unneeded stuff in complicated units!), or I can work around it.

Following this idea, I searched for "shcore.dll" within the DzHtmlText and Dam downloads - it is only found in unit "ScalingUtils", function GetDpiForMonitor. Commented this unit out and compiled the DzHtmlText package to let the compiler help me. The removed function is called by function RetrieveMonitorPPI(F: TCustomForm). Looking at the source code of this function I get the impression, without knowing details, that it seems to determine the PixelsPerInch for the monitor on with the form F is displayed. I do a Ctrl+click on "TCustomForm" to let the IDE open the declaration of TCustomForm for me. Scrolling down a bit I see that there is a property "Monitor: TMonitor" - ah: every form in Lazarus knows the monitor, which which it is displayed! Another Ctrl+click, now on TMonitor, and another scroll down shows that TMonitor has a property PixelsPerInch. Now it is easy: remove the function RetrieveMonitorPPI from "ScalingUtils" and replace it by an equally named function which returns the Result := F.Monitor.PixelsPerInch. A final compilation test - and it seems to work without the shcore.dll.

In summary:
Code: Pascal  [Select][+][-]
  1. (*
  2. type
  3.   TMonitorDpiType = (
  4.     MDT_EFFECTIVE_DPI = 0,
  5.     MDT_ANGULAR_DPI = 1,
  6.     MDT_RAW_DPI = 2,
  7.     MDT_DEFAULT = MDT_EFFECTIVE_DPI
  8.   );
  9.  
  10. {$WARN SYMBOL_PLATFORM OFF}
  11. function GetDpiForMonitor(
  12.   hmonitor: HMONITOR;
  13.   dpiType: TMonitorDpiType;
  14.   out dpiX: UINT;
  15.   out dpiY: UINT
  16.   ): HRESULT; stdcall; external 'Shcore.dll' {$IFDEF DCC}delayed{$ENDIF};
  17. {$WARN SYMBOL_PLATFORM ON}
  18.  
  19. function RetrieveMonitorPPI(F: TCustomForm): Integer;
  20. var
  21.   Ydpi: Cardinal;
  22.   Xdpi: Cardinal;
  23.   DC: HDC;
  24. begin
  25.   if CheckWin32Version(6,3) then
  26.   begin
  27.     if GetDpiForMonitor(F.Monitor.Handle, TMonitorDpiType.MDT_EFFECTIVE_DPI, Ydpi, Xdpi) = S_OK then
  28.       Result := Ydpi
  29.     else
  30.       Result := 0;
  31.   end
  32.   else
  33.   begin
  34.     DC := GetDC(0);
  35.     Result := GetDeviceCaps(DC, LOGPIXELSY);
  36.     ReleaseDC(0, DC);
  37.   end;
  38. end;
  39. *)
  40.  
  41. function RetrieveMonitorPPI(F: TCustomForm): Integer;
  42. begin
  43.   Result := F.Monitor.PixelsPerInch;
  44. end;              

I normally work with Laz/main, but checked back to v2.0.12 and found that this patch works at least back to this version, probably even with older ones.

The patch seems to be needed for high-dpi handling. But since the packages are primarily written for Delphi, I doubt whether they handle high-res monitors in the correct way for Lazarus. But even if this - or my entire patch - would not work you will certainly be able to compile and install the dam package now.

[P.S.]
There were two additional error messages when compiling the Dam package, related to some "Styleelements" property. You can safely remove them (or put them into a {$IFNDEF FPC}...{$ENDIF} directive).

WP sorry

i will test your ides (code) as soon

 thank you

majid.ebru

  • Hero Member
  • *****
  • Posts: 519
Re: i can't inatall Dam dialog ?!
« Reply #24 on: December 05, 2023, 05:35:15 pm »
thank you WP  :D  :)

I could install DzHTMLText but i could not install dam correctly Because some components are only for Delphi

After I commented some of them, I was able to install DAM, but DAM doesn't have any example for lazarus  ?!?!?

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: i can't inatall Dam dialog ?!
« Reply #25 on: December 05, 2023, 05:55:22 pm »
Try those from the attachment:

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: i can't inatall Dam dialog ?!
« Reply #26 on: December 06, 2023, 10:31:44 am »
fwiw: Original author seem to have addressed the issue (as well).
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

majid.ebru

  • Hero Member
  • *****
  • Posts: 519
Re: i can't inatall Dam dialog ?!
« Reply #27 on: December 06, 2023, 05:53:55 pm »
@WP
Except for the last two buttons, the rest of the buttons worked
Thank you

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: i can't inatall Dam dialog ?!
« Reply #28 on: December 06, 2023, 06:15:51 pm »
Except for the last two buttons, the rest of the buttons worked
No, they are working, too. They are supposed to show the modified exception dialog and intentionally raise an exception. Run the demo outside the IDE, and you won't see the usual exception dialog, but only the exception dialog of the dam package.

majid.ebru

  • Hero Member
  • *****
  • Posts: 519
Re: i can't inatall Dam dialog ?!
« Reply #29 on: December 06, 2023, 06:55:28 pm »
yes you said true.
thank you

 

TinyPortal © 2005-2018