Tuesday, January 10, 2017

[HowTo] Call any code on UI thread outside of Activity

using Android.OS;

public class MyThread
{
    public void Run()
    {
        RunOnUiThread(() => DoSomething());
    }

    private void RunOnUiThread(Action action)
    {
        using (var handler = new Handler(Looper.MainLooper))
        {
            handler.Post(action);
        }
    }
}

Tuesday, January 3, 2017

[HowTo] Locate drives in hot-swap bays in Super Micro servers using LED


Friday, December 23, 2016

[HowTo] Boot Acer Aspire Switch 10 from a USB stick


Thursday, December 22, 2016

[HowTo] Make a Windows application full screen


MONITORINFO monitorInfo = { sizeof(monitorInfo) };
if (GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST), &monitorInfo))
{
    SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_THICKFRAME));
    SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));

    SetWindowPos(hwnd, NULL, monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.top,
        monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top,
        SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}

[HowTo] Remove system icon from the application title bar


DWORD flags = WTNCA_NODRAWICON | WTNCA_NOSYSMENU;
SetWindowThemeNonClientAttributes(hwnd, flags, flags);