diff --git a/lcl/forms.pp b/lcl/forms.pp index b18b91e86a..a0f9afa9cc 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -26,7 +26,7 @@ unit Forms; -{$mode objfpc}{$H+} +{$mode objfpc}{$H+}{$macro on} interface @@ -1456,6 +1456,11 @@ procedure Register; implementation +{$ifdef WinCE} + {$define extdecl := cdecl} +{$else} + {$define extdecl := stdcall} +{$endif} uses WSForms; // Widgetset uses circle is allowed diff --git a/lcl/include/screen.inc b/lcl/include/screen.inc index 61da19eea8..f0ba0fb631 100644 --- a/lcl/include/screen.inc +++ b/lcl/include/screen.inc @@ -28,7 +28,7 @@ const ); function EnumMonitors(hMonitor: HMONITOR; hdcMonitor: HDC; lprcMonitor: PRect; - dwData: LPARAM): LongBool; stdcall; + dwData: LPARAM): LongBool; extdecl; var Screen: TScreen absolute dwData; Monitor: TMonitor; @@ -39,6 +39,19 @@ begin Result := True; end; +function EnumFontsNoDups(var LogFont: TEnumLogFontEx; var Metric: TNewTextMetricEx; + FontType: Longint; Data: LParam): LongInt; extdecl; +var + L: TStrings; + S: String; +begin + L := TStrings(PtrInt(Data)); + S := LogFont.elfLogFont.lfFaceName; + if L.IndexOf(S) < 0 then + L.Add(S); + Result := 1; +end; + {------------------------------------------------------------------------------ Method: TScreen.Create Params: AOwner: the owner of the class @@ -420,22 +433,6 @@ begin Result := nil; end; -function EnumFontsNoDups( - var LogFont: TEnumLogFontEx; - var Metric: TNewTextMetricEx; - FontType: Longint; - Data: LParam):LongInt; stdcall; -var - L: TStrings; - S: String; -begin - L := TStrings(PtrInt(Data)); - S := LogFont.elfLogFont.lfFaceName; - if L.IndexOf(S)<0 then - L.Add(S); - result := 1; -end; - procedure GetScreenFontsList(FontList: TStrings); var lf: TLogFont; diff --git a/lcl/interfaces/wince/wincecallback.inc b/lcl/interfaces/wince/wincecallback.inc index b0d8805d3d..c779c5173d 100644 --- a/lcl/interfaces/wince/wincecallback.inc +++ b/lcl/interfaces/wince/wincecallback.inc @@ -180,7 +180,7 @@ type Handles the messages sent to the specified window, in parameter Window, by Windows or other applications ------------------------------------------------------------------------------} -Function +function {$ifdef MSG_DEBUG} RealWindowProc {$else} diff --git a/lcl/interfaces/wince/wincedef.pp b/lcl/interfaces/wince/wincedef.pp index c81e2dd44b..ee56bab8c1 100644 --- a/lcl/interfaces/wince/wincedef.pp +++ b/lcl/interfaces/wince/wincedef.pp @@ -110,8 +110,11 @@ type TimerFunc: TFNTimerProc; // owner function to handle timer end; -function EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MONITORENUMPROC; dwData: LPARAM): LongBool; external KernelDLL name 'EnumDisplayMonitors'; -function GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): LongBool; external KernelDLL name 'GetMonitorInfo'; +function EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MONITORENUMPROC; dwData: LPARAM): LongBool; cdecl; external KernelDLL name 'EnumDisplayMonitors'; +function GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): LongBool; cdecl; external KernelDLL name 'GetMonitorInfo'; +function MonitorFromWindow(hWnd: HWND; dwFlags: DWORD): HMONITOR; cdecl; external KernelDLL name 'MonitorFromWindow'; +function MonitorFromRect(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR; cdecl; external KernelDLL name 'MonitorFromRect'; +function MonitorFromPoint(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR; cdecl; external KernelDLL name 'MonitorFromPoint'; var // FTimerData contains the currently running timers diff --git a/lcl/interfaces/wince/winceextra.pp b/lcl/interfaces/wince/winceextra.pp index 94f5b9a68c..26e1a37a4b 100644 --- a/lcl/interfaces/wince/winceextra.pp +++ b/lcl/interfaces/wince/winceextra.pp @@ -83,7 +83,7 @@ const {$ifdef win32} function ImageList_Copy(himlDst: HIMAGELIST; iDst: longint; himlSrc: HIMAGELIST; Src: longint; uFlags: UINT): BOOL; stdcall; external 'comctl32'; {$else} -function ImageList_Copy(himlDst: HIMAGELIST; iDst: longint; himlSrc: HIMAGELIST; Src: longint; uFlags: UINT): BOOL; stdcall; external KernelDLL; +function ImageList_Copy(himlDst: HIMAGELIST; iDst: longint; himlSrc: HIMAGELIST; Src: longint; uFlags: UINT): BOOL; cdecl; external KernelDLL; {$endif} const diff --git a/lcl/interfaces/wince/winceint.pp b/lcl/interfaces/wince/winceint.pp index 9a33a9ed62..c830316a27 100644 --- a/lcl/interfaces/wince/winceint.pp +++ b/lcl/interfaces/wince/winceint.pp @@ -12,7 +12,7 @@ * * * This file is part of the Lazarus Component Library (LCL) * * * - * See the file COPYING.modifiedLGPL.txt, included in this distribution, * + * See the file COPYING.modifiedLGPL.txt, included in this distribution, * * for details about the copyright. * * * * This program is distributed in the hope that it will be useful, * diff --git a/lcl/interfaces/wince/wincewinapi.inc b/lcl/interfaces/wince/wincewinapi.inc index 9b397a471f..2e18307d4a 100644 --- a/lcl/interfaces/wince/wincewinapi.inc +++ b/lcl/interfaces/wince/wincewinapi.inc @@ -1889,6 +1889,21 @@ begin PWideChar(WideLPCaption), UType); end; +function TWinCEWidgetSet.MonitorFromPoint(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR; +begin + Result := WinCEDef.MonitorFromPoint(ptScreenCoords, dwFlags); +end; + +function TWinCEWidgetSet.MonitorFromRect(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR; +begin + Result := WinCEDef.MonitorFromRect(lprcScreenCoords, dwFlags); +end; + +function TWinCEWidgetSet.MonitorFromWindow(hWnd: HWND; dwFlags: DWord): HMONITOR; +begin + Result := WinCEDef.MonitorFromWindow(hWnd, dwFlags); +end; + {------------------------------------------------------------------------------ Method: MoveToEx Params: DC - handle of device context diff --git a/lcl/interfaces/wince/wincewinapih.inc b/lcl/interfaces/wince/wincewinapih.inc index b65064a9a0..178cdeb829 100644 --- a/lcl/interfaces/wince/wincewinapih.inc +++ b/lcl/interfaces/wince/wincewinapih.inc @@ -163,6 +163,9 @@ procedure LeaveCriticalSection(var CritSection: TCriticalSection); override; function LineTo(DC: HDC; X, Y: Integer): Boolean; override; function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override; +function MonitorFromPoint(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR; override; +function MonitorFromRect(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR; override; +function MonitorFromWindow(hWnd: HWND; dwFlags: DWord): HMONITOR; override; function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override; {function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;} function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override; diff --git a/lcl/interfaces/wince/wincewsforms.pp b/lcl/interfaces/wince/wincewsforms.pp index 496f9e8af2..70a6f5ee7b 100644 --- a/lcl/interfaces/wince/wincewsforms.pp +++ b/lcl/interfaces/wince/wincewsforms.pp @@ -152,7 +152,7 @@ end; function ScrollWindowPtr(hWnd:HWND; XAmount:longint; YAmount:longint; lpRect: pointer; lpClipRect: pointer):WINBOOL; stdcall; external 'user32' name 'ScrollWindow'; {$else} function ScrollWindowPtr(hWnd:HWND; dx:longint; dy:longint; prcScroll: lpRECT; prcClip: lpRECT; - hrgnUpdate: HRGN; prcUpdate: LPRECT; flags:UINT):longint; external KernelDll name 'ScrollWindowEx'; + hrgnUpdate: HRGN; prcUpdate: LPRECT; flags:UINT):longint; cdecl; external KernelDll name 'ScrollWindowEx'; {$endif} class procedure TWinCEWSScrollingWinControl.ScrollBy(const AWinControl: TScrollingWinControl; diff --git a/lcl/interfaces/wince/wincewsstdctrls.pp b/lcl/interfaces/wince/wincewsstdctrls.pp index 2d01774732..c8cf917ee9 100644 --- a/lcl/interfaces/wince/wincewsstdctrls.pp +++ b/lcl/interfaces/wince/wincewsstdctrls.pp @@ -376,7 +376,7 @@ end; //roozbeh:there are still some issues with group box! function GroupBoxPanelWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam; - LParam: Windows.LParam): LResult; stdcall; + LParam: Windows.LParam): LResult; {$ifdef win32}stdcall{$else}cdecl{$endif}; begin // handle paint messages for theming case Msg of diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index 8bc370d57d..320371a7a2 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -36,7 +36,7 @@ the Delphi Windows unit. This is only done for compatibiltiy. unit LCLType; -{$mode objfpc}{$H+} +{$mode objfpc}{$H+}{$macro on} interface @@ -54,6 +54,12 @@ uses {$endif WINDOWS} Classes, SysUtils; +{$ifdef WinCE} + {$define extdecl := cdecl} +{$else} + {$define extdecl := stdcall} +{$endif} + type {$IFDEF USE_UTF8BIDI_LCL} TUTF8Char = UTF8BIDI.TUTF8Char; @@ -2196,13 +2202,13 @@ type end; FontEnumProc = function (var ELogFont:TEnumLogFont; var Metric:TNewTextMetric; - FontType:longint; Data:LParam):longint; stdcall; + FontType:longint; Data:LParam):longint; extdecl; FontEnumExProc = function (var ELogFont: TEnumLogFontEx; var Metric: TNewTextMetricEx; - FontType: Longint; Data:LParam):Longint; stdcall; + FontType: Longint; Data:LParam):Longint; extdecl; - MonitorEnumProc = function(hMonitor: HMONITOR; hdcMonitor: HDC; lprcMonitor: PRect; - dwData: LPARAM): LongBool; stdcall; + MonitorEnumProc = function(hMonitor: HMONITOR; hdcMonitor: HDC; lprcMonitor: PRect; + dwData: LPARAM): LongBool; extdecl; PWndClassExA = ^TWndClassExA; PWndClassExW = ^TWndClassExW;