simple gui on windows 11

PeterHoo peterhu.peterhu at outlook.com
Sun Jan 25 01:11:56 UTC 2026


On Saturday, 24 January 2026 at 13:27:55 UTC, Lars Johansson 
wrote:
> On Saturday, 24 January 2026 at 05:42:05 UTC, Lars Johansson 
> wrote:
>> On Friday, 23 January 2026 at 15:27:42 UTC, Serg Gini wrote:
>>> On Friday, 23 January 2026 at 15:00:53 UTC, Lars Johansson 
>>> wrote:
>>>> [...]
>>>
>>> Hey there!
>>> "for sure"
>>>
>>> Here we go (Higher in the list - higher my suggestion to 
>>> check):
>
>> Thank you for all alternatives I will start with Dlangui, as 
>> it seems to be a good start.
>
> After trying almost all alternatives I finally made Dlangui 
> work.
> First I got dlangui cyclic dependecy error. I got the same for 
> fluid. I then realised you should not name the root dir same as 
> the product. I renamed dlangui to mydlangui and voila!
> I have not seen any warning about this, but it might just be me 
> not reading all the fine prints.
> Anyway I have a working gui. I play with it, and try to figure 
> out my next step in D.
>
> p.s. Clude warned me, Gui in Windows with Dlang can be tricky.

On Windows DFL https://code.dlang.org/packages/dfl is great.And 
it is execellent with its GUI designer (Drag & drop components) 
Entice http://www.dprogramming.com/entice.php

dub fetch dfl and dub build dfl -a=x86_64 works smoothly ever 
since.

And interop with win32 api within DFL is as easy as if win32 api 
is integrated.

```
/*
	Generated by Entice Designer
	Entice Designer written by Christopher E. Miller
	www.dprogramming.com/entice.php
*/

import dfl.all;
import core.sys.windows.windows;
import std.format;
import std.conv;

enum info="¡Hola Mundo!Γειά σου Κόσμε!Привет, 
мир!こんにちは世界!你好世界!नमस्ते दुनिया!👋🌎!"d;
class MyForm: dfl.form.Form
{
	// Do not modify or move this block of variables.
	//~Entice Designer variables begin here.
	dfl.label.Label label1;
	dfl.button.Button btnGet;
	//~Entice Designer variables end here.
	
	
	this()
	{
		initializeMyForm();
		
		//@  Other MyForm initialization code here.
		
		btnGet.click~=(Object sender,EventArgs ea)
		{
			label1.text=format("नमस्ते दुनिया!👋🌎!Width: %d  Height: %d",
					GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));

			PlaySound("hellowin.wav",null,SND_FILENAME|SND_ASYNC);
			
             //DFL has Graphics library inside,just to play around 
with win32 API here
			HDC hdc=GetDC(handle);
			PAINTSTRUCT ps;
			RECT rect={20,120,500,160};
	
			SetTextColor(hdc,RGB(0,0,255));
			SetBkMode(hdc,TRANSPARENT);
			DrawText(hdc,info.to!wstring.ptr,-1,&rect,DT_WORDBREAK|DT_CENTER|DT_VCENTER);
			//DrawTextW(hdc,"दुनिया!👋🌎!",-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
			
			
			// Create an array of TRIVERTEX structures that describe
			// positional and color values for each vertex.
			TRIVERTEX[3] vertex;
			vertex[0].x     = 250;
			vertex[0].y     = 150;
			vertex[0].Red   = 0xff00;
			vertex[0].Green = 0x8000;
			vertex[0].Blue  = 0x0000;
			vertex[0].Alpha = 0x0000;

			vertex[1].x     = 100;
			vertex[1].y     = 300;
			vertex[1].Red   = 0x9000;
			vertex[1].Green = 0x0000;
			vertex[1].Blue  = 0x9000;
			vertex[1].Alpha = 0x0000;

			vertex[2].x     = 400;
			vertex[2].y     = 300;
			vertex[2].Red   = 0x9000;
			vertex[2].Green = 0x0000;
			vertex[2].Blue  = 0x9000;
			vertex[2].Alpha = 0x0000;
			
			//Create a gradient_triangle structure taht
			//references the trivertext vertices
			GRADIENT_TRIANGLE gTriangle;
			gTriangle.Vertex1=0;
			gTriangle.Vertex2=1;
			gTriangle.Vertex3=2;
			
			GradientFill(hdc,cast(TRIVERTEX*)vertex,3,&gTriangle,1,GRADIENT_FILL_TRIANGLE);
			EndPaint(handle,&ps);
			
			ReleaseDC(handle,hdc);
		};
	}
	
	
	private void initializeMyForm()
	{
		// Do not manually modify this function.
		//~Entice Designer 0.8.5.02 code begins here.
		//~DFL Form
		text = "My Form";
		clientSize = dfl.all.Size(512, 342);
		//~DFL dfl.label.Label=label1
		label1 = new dfl.label.Label();
		label1.name = "label1";
		label1.backColor = dfl.all.SystemColors.controlLight;
		label1.font = new dfl.all.Font("Microsoft YaHei UI", 10f, 
dfl.all.FontStyle.BOLD);
		label1.foreColor = dfl.all.Color(255, 128, 0);
		label1.borderStyle = dfl.all.BorderStyle.FIXED_3D;
		label1.textAlign = dfl.all.ContentAlignment.MIDDLE_CENTER;
		label1.bounds = dfl.all.Rect(16, 48, 448, 32);
		label1.parent = this;
		//~DFL dfl.button.Button=btnGet
		btnGet = new dfl.button.Button();
		btnGet.name = "btnDraw";
		btnGet.text = "(&D)raw";
		btnGet.bounds = dfl.all.Rect(16, 16, 104, 24);
		btnGet.parent = this;
		//~Entice Designer 0.8.5.02 code ends here.
	}
}


int main()
{
	int result = 0;
	
	try
	{
		Application.enableVisualStyles();
		
		//@  Other application initialization code here.
		
		Application.run(new MyForm());
	}
	catch(DflThrowable o)
	{
		msgBox(o.toString(), "Fatal Error", MsgBoxButtons.OK, 
MsgBoxIcon.ERROR);
		
		result = 1;
	}
	
	return result;
}

```


More information about the Digitalmars-d-learn mailing list