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: create DLL file f...
by
paule32
[
Today
at 02:15:29 pm]
A fairly simple sound sol...
by
paweld
[
Today
at 01:46:11 pm]
Demoscene The Champs Crac...
by
KodeZwerg
[
Today
at 01:45:18 pm]
Database standards OR Am ...
by
paweld
[
Today
at 01:07:33 pm]
Who is Indy mattias?
by
paweld
[
Today
at 12:58:14 pm]
Access violation when ope...
by
Чебурашка
[
Today
at 12:27:34 pm]
Step-into the field sette...
by
Martin_fr
[
Today
at 11:31:48 am]
Access violation when re-...
by
Chris Osborne
[
Today
at 11:31:25 am]
AI, NLP and CAI: Text Gen...
by
Dzandaa
[
Today
at 11:03:26 am]
dwindows for Android
by
PierceNg
[
Today
at 10:54:44 am]
create system unit from s...
by
Laksen
[
Today
at 10:53:57 am]
how to get class and meth...
by
cdbc
[
Today
at 10:52:22 am]
[Solved] Find child contr...
by
Joanna
[
Today
at 09:53:43 am]
FpDebug unexpected Assemb...
by
Marc
[
Today
at 08:46:38 am]
Offical launch of the 1 B...
by
Handoko
[
Today
at 07:59:07 am]
Big Numbers Math
by
iLya2IK
[
Today
at 07:13:20 am]
Lazarus for Windows on aa...
by
dbannon
[
Today
at 07:02:55 am]
BUG REPORT: Unable to gen...
by
dbannon
[
Today
at 06:29:49 am]
what to do if my target M...
by
Laksen
[
Today
at 12:49:12 am]
For-in loop over constant...
by
ASerge
[
Today
at 12:36:09 am]
Converting a string/index...
by
TRon
[April 18, 2024, 11:56:37 pm]
exclude ALL packages from...
by
PascalDragon
[April 18, 2024, 11:33:29 pm]
Poll: Watches and Display...
by
440bx
[April 18, 2024, 10:55:14 pm]
Have anyone develop UEFI ...
by
PascalDragon
[April 18, 2024, 10:14:15 pm]
The weird Rewrite bug
by
PascalDragon
[April 18, 2024, 09:58:53 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: MultiMon and Unicode (Read 1038 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