On Tuesday, 13 October 2020 at 22:26:35 UTC, Marcone wrote:
struct Teste {
    string nome = "Paul";
    int idade = 33;
}

extern(Windows):
BOOL DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow
{
    // I want to be able to use the struct object here.
    // writeln(test.nome);
    return false;
}

void chamaJanela(){
Test test; // How to send this object to the DlgMain function? DialogBox(null, MAKEINTRESOURCE(IDD_DIALOG1), null, &DlgMain);
}

Instead of calling DialogBox, you might try DialogBoxParam[A|W].

Before displaying the dialog box, the function passes an application-defined value to the dialog box procedure as the lParam parameter of the WM_INITDIALOG message. An application can use this value to initialize dialog box controls.

- https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-dialogboxparamw


Reply via email to