Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
MultiMon and Unicode
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
How to get along with the...
by
BrassGear
[
Today
at 03:24:10 pm]
Assign (textfile) not com...
by
Thaddy
[
Today
at 03:16:52 pm]
How to: create DLL file f...
by
paule32
[
Today
at 03:05:49 pm]
[Solved] Find child contr...
by
Handoko
[
Today
at 03:01:47 pm]
Linux Workspaces -- StayO...
by
QEnnay
[
Today
at 02:40:24 pm]
what to do if my target M...
by
Key-Real
[
Today
at 02:35:34 pm]
lazarus-project_3.2.0-0_a...
by
Edgardo M. López
[
Today
at 02:29:07 pm]
Azure sql database will n...
by
wpflum
[
Today
at 02:18:43 pm]
create system unit from s...
by
KodeZwerg
[
Today
at 02:02:25 pm]
Spiral of Theodorus: Reve...
by
Roland57
[
Today
at 01:24:14 pm]
I just released a commerc...
by
BrassGear
[
Today
at 01:20:51 pm]
InstallAware Using Lazaru...
by
dbannon
[
Today
at 01:05:38 pm]
Improvement of TFPTimerTh...
by
lagprogramming
[
Today
at 12:53:29 pm]
Question for people who h...
by
marcov
[
Today
at 12:04:56 pm]
[SOLVED] assembler name i...
by
Laksen
[
Today
at 11:40:43 am]
Warning: Source OS Redefi...
by
Laksen
[
Today
at 11:32:46 am]
[SOLVED] how to see what ...
by
Laksen
[
Today
at 11:30:25 am]
Slow copying of small str...
by
alpine
[
Today
at 11:25:10 am]
Text orientation in TMemo...
by
wp
[
Today
at 10:27:54 am]
Demoscene The Champs Crac...
by
Lulu
[
Today
at 08:15:12 am]
location of non visual co...
by
VisualLab
[April 17, 2024, 11:58:55 pm]
For-in loop over constant...
by
Joanna
[April 17, 2024, 11:57:15 pm]
Lazarus editor feature re...
by
440bx
[April 17, 2024, 11:49:08 pm]
How would you define a fi...
by
wp
[April 17, 2024, 11:04:00 pm]
Directx9 with mylogo insi...
by
KodeZwerg
[April 17, 2024, 11:03:54 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: MultiMon and Unicode (Read 1036 times)
Mr.Madguy
Hero Member
Posts: 844
MultiMon and Unicode
«
on:
September 06, 2020, 01:39:25 pm »
I need EnumDisplayDevicesW from MultiMon. It requires UNICODE definition, that also requires FPC_OS_UNICODE. How can I define it? I tried to define it in project options, but it didn't work. OS is Win64.
Logged
Is it healthy for project not to have regular stable releases?
Just for fun:
Code::Blocks, GCC 13 and DOS - is it possible?
jamie
Hero Member
Posts: 6130
Re: MultiMon and Unicode
«
Reply #1 on:
September 06, 2020, 04:42:01 pm »
Code: Pascal
[Select]
[+]
[-]
unit
Unit1
;
{$mode objfpc}{$H+}
interface
uses
Windows
,
Classes
,
SysUtils
,
Forms
,
Controls
,
Graphics
,
Dialogs
,
StdCtrls
;
type
{ TForm1 }
DISPLAY_DEVICEW
=
record
Cb
:
DWORD
;
DeviceName
:
Array
[
0
..
31
]
of
WCHAR
;
// DeviceName[32];
DeviceString
:
array
[
0
..
127
]
of
WCHAR
;
// DeviceString[128];
StateFlags
:
DWORD
;
DeviceID
:
Array
[
0
..
127
]
of
WCHAR
;
//DeviceID[128];
DeviceKey
:
Array
[
0
..
127
]
of
WCHAR
;
// DeviceKey[128];
End
;
PDISPLAY_DEVICEW
=
DISPLAY_DEVICEW
;
TForm1
=
class
(
TForm
)
Button1
:
TButton
;
procedure
Button1Click
(
Sender
:
TObject
)
;
private
public
end
;
Function
EnumDisplayDevicesW
(
lpDevice
:
LPWSTR
;
iDevNum
:
DWORD
;
lpDisplayDevice
:
Pointer
;
//DISPLAY_DEVICEW;
dwFlags
:
DWORD
)
:
WinBool
;
StdCall
External
'user32.dll'
name
'EnumDisplayDevicesW'
;
Const
EDD_GET_DEVICE_INTERFACE_NAME
=
1
;
//(0x00000001
var
Form1
:
TForm1
;
implementation
{$R *.lfm}
{ TForm1 }
procedure
TForm1
.
Button1Click
(
Sender
:
TObject
)
;
Var
V
:
Display_DEVICEW
;
begin
Fillchar
(
V
,
sizeof
(
V
)
,
0
)
;
V
.
cb
:
=
Sizeof
(
V
)
;
{Change parameter nnumbre 2 as the index to the monitor to look at}
{ When there are no more monitors it will return false}
If
EnumDisplayDevicesW
(
Pointer
(
0
)
,
0
,
@
V
,
EDD_GET_DEVICE_INTERFACE_NAME
)
then
Begin
caption
:
=
V
.
DeviceName
;
End
;
end
;
end
.
It seems to work, I couldn't find the W version of the record so I changed this one, it seems to work just fine..
Logged
The only true wisdom is knowing you know nothing
jamie
Hero Member
Posts: 6130
Re: MultiMon and Unicode
«
Reply #2 on:
September 06, 2020, 05:30:01 pm »
I have attached a Project that shows the list with their defines. hope this helps others too..
Logged
The only true wisdom is knowing you know nothing
Mr.Madguy
Hero Member
Posts: 844
Re: MultiMon and Unicode
«
Reply #3 on:
September 06, 2020, 05:41:01 pm »
It's in MultiMon.
Code: Pascal
[Select]
[+]
[-]
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
...
{$ifdef UNICODE}
DISPLAY_DEVICE
=
DISPLAY_DEVICEW
;
PDISPLAY_DEVICE
=
PDISPLAY_DEVICEW
;
LPDISPLAY_DEVICE
=
LPDISPLAY_DEVICEW
;
TDisplayDevice
=
TDisplayDeviceW
;
PDisplayDevice
=
PDisplayDeviceW
;
{$else}
DISPLAY_DEVICE
=
DISPLAY_DEVICEA
;
PDISPLAY_DEVICE
=
PDISPLAY_DEVICEA
;
LPDISPLAY_DEVICE
=
LPDISPLAY_DEVICEA
;
TDisplayDevice
=
TDisplayDeviceA
;
PDisplayDevice
=
PDisplayDeviceA
;
{$endif}
// UNICODE
...
{$ifdef UNICODE}
Pointer
(
g_pfnEnumDisplayDevices
)
:
=
GetProcAddress
(
hUser32
,
'EnumDisplayDevicesW'
)
;
if
IsPlatformNT
then
Pointer
(
g_pfnGetMonitorInfo
)
:
=
GetProcAddress
(
hUser32
,
'GetMonitorInfoW'
)
else
Pointer
(
g_pfnGetMonitorInfo
)
:
=
GetProcAddress
(
hUser32
,
'GetMonitorInfoA'
)
;
{$else}
Pointer
(
g_pfnGetMonitorInfo
)
:
=
GetProcAddress
(
hUser32
,
'GetMonitorInfoA'
)
;
Pointer
(
g_pfnEnumDisplayDevices
)
:
=
GetProcAddress
(
hUser32
,
'EnumDisplayDevicesA'
)
;
{$endif}
UNICODE isn't defined for me. And defining it in project options doesn't help. I've implemented my code as is for now, as I hope, that crucial parts of TDisplayDevice can be english only.
Logged
Is it healthy for project not to have regular stable releases?
Just for fun:
Code::Blocks, GCC 13 and DOS - is it possible?
jamie
Hero Member
Posts: 6130
Re: MultiMon and Unicode
«
Reply #4 on:
September 06, 2020, 05:47:05 pm »
please look at the attached project.
Unicode as in strings is basically WIDESTRING for windows when it comes to doing this sort of stuff..
I can't help it if the UNICODE define isn't defined...
«
Last Edit: September 06, 2020, 05:50:44 pm by jamie
»
Logged
The only true wisdom is knowing you know nothing
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
MultiMon and Unicode
TinyPortal
© 2005-2018