Forum > Windows

[SOLVED] Default to the W Alias inside the Windows unit?

(1/3) > >>

KodeZwerg:
Good day.

How do I tell my project that it use the W Aliases from the Windows API instead of the A Aliases?

By looking inside of Windows.pp I do see:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$ifdef FPC_OS_UNICODE}  {$define UNICODE}{$endif} followed later by {$ifdef UNICODE}{$i unidef.inc}{$else not UNICODE}{$i ascdef.inc}{$endif UNICODE}
By doing:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1;{$DEFINE FPC_OS_UNICODE}{$DEFINE UNICODE}{$mode delphiunicode}{$modeswitch m_default_unicodestring}
It still points me to the Ansi versions, but I want the Wide versions to be used without adding "W" to the API methods.


--- Quote ---{$DEFINE FPC_OS_UNICODE}
{$define UNICODE}
--- End quote ---
inside Project Options / Custom Options / Conditionals       has also no effect.
Also the -WA switch has no effect.

What is the correct way of how it should be done please?

Answers that telling me to simply put a W at end I really not need to get.

Thanks in advance!


(At the end I want to have this behavior: a ctrl+click on "GetBinaryType" jumps into unidef.inc and of course uses it also)

KodeZwerg:
Sorry, I forgot to tell, I am using Lazarus 2.3.0 (rev 3bdbedd91b) FPC 3.2.2 x86_64-win64-win32/win64 on a Windows 10 64bit machine.

KodeZwerg:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1;{$DEFINE FPC_OS_UNICODE}{$DEFINE UNICODE}{$mode delphiunicode}{$modeswitch m_default_unicodestring} interface uses  Windows ,  Classes , SysUtils , Forms , Controls , Graphics , Dialogs; type   { TForm1 }   TForm1 = class(TForm)    procedure FormCreate(Sender: TObject);  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin  // next line is my test line, a ctrl+click should point me to the unidef.inc declaration  // how to do that please?  GetBinaryTypeend; end.

marcov:
There currently is no easy way.  While the Windows has some ifdef work, but probably too many other units depend on it being one byte, to simply enable it and recompile everything.

tetrastes:

--- Quote from: KodeZwerg on April 12, 2023, 01:57:35 am ---Good day.

How do I tell my project that it use the W Aliases from the Windows API instead of the A Aliases?

By looking inside of Windows.pp I do see:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$ifdef FPC_OS_UNICODE}  {$define UNICODE}{$endif} followed later by {$ifdef UNICODE}{$i unidef.inc}{$else not UNICODE}{$i ascdef.inc}{$endif UNICODE}

--- End quote ---

But at the second line below there is

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$i redef.inc}
and in redef.inc

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function GetBinaryType(lpApplicationName: PChar; var lpBinaryType: DWORD): BOOL;external 'kernel32' name 'GetBinaryTypeA';

Navigation

[0] Message Index

[#] Next page

Go to full version