From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vince Salvino Newsgroups: gmane.emacs.devel Subject: RE: Dark mode on Windows Date: Mon, 25 Oct 2021 15:44:05 +0000 Message-ID: References: <87mtmx3nsx.fsf@yahoo.com> <87ee893nl4.fsf@yahoo.com> <8735opzq2j.fsf@yahoo.com> <87cznty61p.fsf@yahoo.com> <83zgqx1drx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17112"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "emacs-devel@gnu.org" To: Eli Zaretskii , Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 25 17:45:03 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mf29m-0004B4-Eb for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Oct 2021 17:45:02 +0200 Original-Received: from localhost ([::1]:41604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mf29k-0003V7-Q4 for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Oct 2021 11:45:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mf28z-0002pB-7v for emacs-devel@gnu.org; Mon, 25 Oct 2021 11:44:13 -0400 Original-Received: from mail-mw2nam10on2082.outbound.protection.outlook.com ([40.107.94.82]:17953 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mf28w-0007Gn-Ig; Mon, 25 Oct 2021 11:44:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IMMhJFVkA0LtnxXbr3ji0tKrvu+m9pl6qHekSs9dj/w95OB9JACw1U1LSM7/JkbVjYJtOS4y5bx2tLVA8MVXBsEDJ28+KHqoq72U+XXJxOUEh6QC6W+ilJi3/Gs1sRZyH7XBTGwzu1nY8VUECAM3TqBaVQ/6BtrbGlE3tlfFaodQs8wUnrj6762yuPSjIiwZc1R2bD3bfU+EjQhBiYNggACpkKPvvm5x2jKuYTNa7iCDxB/5kbn4lCLMy2y03OQJUBNGqMTFEPLXIVFNCQhS22j8sCIlUZrIZCOuvX8aoiPn2mRxSRZkuFTgHf4TgGIL1dcvuktguX3UQh0fzbZpaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NRI2dgZOjafMUtYoBd4ahsk6zN+vdRkFTWJBs0oX5v0=; b=i3J2Gk5IVg3fZCqDlarM+8h9r9K0AkzX1vN8rsrZ8BcONEHMM8Bh6ibVwgtZQVgRVEJ3mJQfoIlRwG4RvSq16y50X6cKgEXfLWiGHHAFk2IPF+0THXR9PWAFHWwgY1hzczWuQ+yCI8lHCbvH3Bpc12fuFQecsRxMol7yPSszNquH/8JFFIUKF6fJC70Qnd6/MKk2tOw3iYFdJNUx+cZ1S1QuKUKkv2CPJfkXYbBUnMrFIT9iRh8T8vPzZi/cSP9vV2pABeKO45VPCpPyy/98a+7EQa/e/FfUP3h3L3Uk2/FUzVIWLIqKkOT0PQR9yyQXAH/eFGGCvYwJilSPljF1cA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=coderedcorp.com; dmarc=pass action=none header.from=coderedcorp.com; dkim=pass header.d=coderedcorp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coderedcorp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NRI2dgZOjafMUtYoBd4ahsk6zN+vdRkFTWJBs0oX5v0=; b=MxzIympwsKghaXh/yjrZp/Sd40E6e+rvQU273f7UzO1sbqSAphCEovLHg9CqgZg0YB1W7lofjuRxCtZy7Qv6FU5KOSEPQRSquxT4tRJ8KJqN6oTVPjU7NEaMHZxNw+SzJRS2j08eFDDqV6kqq3V3F9iOjB36ZT+om3hUS0ZKj54= Original-Received: from CH2PR12MB4231.namprd12.prod.outlook.com (2603:10b6:610:7d::24) by CH2PR12MB4054.namprd12.prod.outlook.com (2603:10b6:610:a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Mon, 25 Oct 2021 15:44:06 +0000 Original-Received: from CH2PR12MB4231.namprd12.prod.outlook.com ([fe80::55e4:7d22:a6df:970b]) by CH2PR12MB4231.namprd12.prod.outlook.com ([fe80::55e4:7d22:a6df:970b%6]) with mapi id 15.20.4628.020; Mon, 25 Oct 2021 15:44:05 +0000 Thread-Topic: Dark mode on Windows Thread-Index: AdfJJLnhgOTSduS6R4GjAFarFtqzBwAGW4YCAAAqVrEABYK38AAA9UwcAAB0MtAAA6mXqAAM+y4yAAZTL/A= In-Reply-To: <83zgqx1drx.fsf@gnu.org> Accept-Language: en-US Content-Language: en-US authentication-results: gnu.org; dkim=none (message not signed) header.d=none;gnu.org; dmarc=none action=none header.from=coderedcorp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 00a2796d-bd1b-4584-fb53-08d997ce46fe x-ms-traffictypediagnostic: CH2PR12MB4054: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UmnzyTXBxu4Y75VUpVkF6cFAxbi2p+hpkNyuoHox4A3h0JWBLk/yTnMYzMhZz7ke+4lfQblJto1r3C0mApKP+rcxR5a2nDgZrvqz4QqkERzDT/mC7TzgivkYSZf4UFsQxzuXA8XHHAREGTIUGxItsxoi7Re0w4/YLguWPkQ+hADa7NSBn2DaLINqHRfxRGZA9wKvZazD3sNzMpQQU8GO0xuC6ram+o9BXfzB59shhh36YkFcYGO6f0PLF4OGsaXl5ZVWa0d9q0e1yVv7l5taW/J70nNMdLPq98McPk0dQE/XAFC1jB1jQOo3A1ucuxmCGcoewUwRYHlo7JuWPk6lltryjZyly/ViCILxEBWjQGVp6hYjSRnQgfEO/oNtM8lGFjYFjl0CGfyGTTBfpf/ATp7I+ISAo3X30fyzAc0t/kJLXhf/iIziwKtps0/Gxt2kfGpq0PEZ+vnxxypJS+aguIx01ug843DJ7QyPkdaU8MxEBwfLGAQBnwoNKDXRKkNGdFHAFKy2deRP/fD7XP1gud94HQZG931XW8kLfpGPdazrkfgH6GBfyqlcG7h86Eusth536M/9F2z1Upq5zLzcQo2iImWyore+CXvs8M22IE3aMMkmOU0rVYI5+HTbhagANT7cim4Bec/2TtoaZEtWDtzNF7ndnCz1V488weha4Rev07WS2hEFe5JyRAP2uzuxrVQ13FykfAMvlreq/UgacA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4231.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(136003)(366004)(39830400003)(346002)(396003)(26005)(38070700005)(86362001)(7696005)(38100700002)(66446008)(122000001)(76116006)(9686003)(186003)(55016002)(2906002)(64756008)(508600001)(3480700007)(33656002)(53546011)(316002)(4326008)(5660300002)(66946007)(83380400001)(71200400001)(66476007)(110136005)(8936002)(66556008)(8676002)(6506007)(52536014); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?40eb67iOjdwGtHz2cmNOcyDV92peOL1gHRzJUJ0z+zyv7WsY6sXH5vYAb+3k?= =?us-ascii?Q?mAshh28r+c7HEnVwxBOB3XNsINFMBx2/gf8vEFsCTjNMPQnKo3oX2quifhmD?= =?us-ascii?Q?K+huC7MYlmu3pn0+qfsgIGu1hI7Ao8L62lJQcK3fxLNs7fYQX92cSU120jkm?= =?us-ascii?Q?PPQqXMNISnt+BrHQfDcXiiqhiPPJfhsK8qc20b1qlBHu5fES8bHBnsEj6hzx?= =?us-ascii?Q?Tf/7FhkEYxqlrFhYWBwTJHTh5z9zV0SBbdTzq1SqTJRRav1f6+XWykYU4WAK?= =?us-ascii?Q?VVKEvQrCFbcQjHgpR6SUNzKQPmP5eo/kkLfGuQHF5m1cRjF6/6DDz72o2zRm?= =?us-ascii?Q?eXwDnmRRkz54tuuES4UJtD730yVucDAPwQJCHUKPb0Sjf2FPVGZFRDBa2dbb?= =?us-ascii?Q?AObDMie8upXfWq2+4/3g8hK5Kda7NEuJXKsBkfHo5+vP+XPhK4scDGLhdcAj?= =?us-ascii?Q?JXbwfpRItCeuLF3S4ySQp4BBSQQWusu7Z970/44rGq/1inNF+E7jgoVwFpri?= =?us-ascii?Q?W69dddQfOI9HuXRBm4wSqHyJTINc3AGHVgK2Ck6e6yLqfFjVD94DNlUfxigs?= =?us-ascii?Q?UwZ/D9RTI4rGerCmDOnFtJd6geGW5yAWPL5IuFjd2MSBhDhNVVVcb7R7NFlH?= =?us-ascii?Q?LZ X-OriginatorOrg: coderedcorp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4231.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00a2796d-bd1b-4584-fb53-08d997ce46fe X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Oct 2021 15:44:05.7896 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9c94adb1-2ce8-484f-be82-c9b5127d4cb1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ZyAyRYO+uis5+j2k+BZY9zUDyC+zEFNahTe3OHcvc7ZCAJsT2RHWemk7YqJK9dmtMCYEf3/H4gUiCD3zNmng+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4054 Received-SPF: pass client-ip=40.107.94.82; envelope-from=salvino@coderedcorp.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:277756 Archived-At: Thanks for the suggestions Eli and Po. I tried GetModuleHandle, and did in = fact run into the error that you cannot GetModuleHandle if the DLL is not a= lready loaded (it returns 0x0). For some reason this worked with uxtheme.dl= l (I'm guessing something must have inadvertently loaded it as a side effec= t?), but not with dwmapi.dll. I will try LoadLibrary and see if that works. I understand that linking -ldwmapi will shut out XP and earlier, so am tryi= ng to find a solution around that. Will report back with any findings after= playing with it a bit. Vince Salvino -----Original Message----- From: Eli Zaretskii =20 Sent: Monday, October 25, 2021 8:38 AM To: Po Lu Cc: Vince Salvino ; emacs-devel@gnu.org Subject: Re: Dark mode on Windows > From: Po Lu > Cc: "emacs-devel@gnu.org" > Date: Mon, 25 Oct 2021 14:25:38 +0800 >=20 > Vince Salvino writes: >=20 > > I originally tried dynamically loading dwmapi.dll, and it cannot be=20 > > done dynamically. It will simply not load. I spent a lot of time=20 > > head-scratching in gdb to figure this out. From what I read, it=20 > > behaves a bit differently than other DLLs and has to be linked. This=20 > > is also my first foray into Win32 programming, so I have exactly=20 > > zero experience with any of this stuff, and could be wrong. >=20 > Some searching reveals that dwmapi.dll is apparently already loaded=20 > into every program on systems that have it. If it is already loaded, LoadLibrary should just increase its reference cou= nt, but will return a valid handle. We do that all the time in Emacs, for = example when using LoadLibrary to load kernel32.dll, which on modern Window= s systems is always loaded. > So you probably just need a way to get the address of the symbol for=20 > the function you want to use. You cannot get an address without a handle to the DLL, and that's what Load= Library gives you. An alternative is to use GetModuleHandle, if we know th= e library is already loaded. The main point is that if we link with -ldmwapi, i.e. link statically again= st the DLL, the resulting Emacs binary will refuse to start on systems wher= e this DLL is not available. So this means in practice we will be unable t= o provide precompiled binaries that run on any supported Windows system.