On Monday, 27 January 2020 at 11:34:47 UTC, Marcone wrote:
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "resource.h"
#include <iostream>

HINSTANCE hInst;

BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
    case WM_INITDIALOG:
    {
    }
    return TRUE;

    case WM_CLOSE:
    {
        EndDialog(hwndDlg, 0);
    }
    return TRUE;

    case WM_COMMAND:
    {
        switch(LOWORD(wParam))
        {
            //case BT_1:
            //{
            //    std::cout << "Ola Mundo!\n";
            //}
        }
    }
    return TRUE;
    }
    return FALSE;
}


int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    hInst=hInstance;
    InitCommonControls();
return DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DlgMain);
}


Translated (including errors & comments):

import core.sys.windows.windows;
import core.sys.windows.commctrl;
import std.stdio;

HINSTANCE hInst;

extern(Windows):

BOOL DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow
{
    switch(uMsg)
    {
    case WM_INITDIALOG:
    {
    }
    return TRUE;

    case WM_CLOSE:
    {
        EndDialog(hwndDlg, 0);
    }
    return TRUE;

    case WM_COMMAND:
    {
        switch(LOWORD(wParam))
        {
            //case BT_1:
            //{
            //    writeln("Ola Mundo!");
            //}
        }
    }
    return TRUE;
    }
    return FALSE;
}


int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    hInst=hInstance;
    InitCommonControls();
return DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, &DlgMain);
}

Reply via email to