gtkD window centering message up and no app on taskbar

Mike Wey via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 8 14:37:40 PDT 2017


On 07-08-17 23:52, Johnson Jones wrote:
> On Monday, 7 August 2017 at 20:57:08 UTC, Mike Wey wrote:
>> On 07-08-17 22:46, Johnson Jones wrote:
>>> [...]
>>
>> This appears to be a GTK issue, a work around might be to get the 
>> Window handle from gtk and use the Windows API to set the taskbar 
>> visibility.
>>
> 
> Yeah, I was thinking about that but haven't yet figured out how to find 
> the window handle ;/

To get the Window handle you could use this for 32bit Windows:

```
import gtk.c.functions;

// Danger, Will Robinson!

HANDLE handle = 
*(cast(HANDLE*)((cast(void*)gtk_widget_get_window(w.getWidgetStruct()))+4));

		
```
Where w is your application window, i used this in the map event signal 
so the handle is actually set. To complicate things there is a race 
condition in gdk some ware so at random the handle isn't valid.


I haven't been able to set the taskbar icon with is tough.

The two attempts:

-Setting the parent window to null as windows with no parent should have 
an taskbar icon:

```
ShowWindow(handle, SW_HIDE);
SetParent(handle, null);
ShowWindow(handle, SW_SHOW);
```

Or set the extended window style to WS_EX_APPWINDOW as that should fore 
an taskbar icon according to msdn.

```
ShowWindow(handle, SW_HIDE);
SetWindowLong(handle, GWL_EXSTYLE, WS_EX_APPWINDOW);
ShowWindow(handle, SW_SHOW);
```

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list