digitalmars.D.learn - How to convert this C++ code to Dlang? Please send me Dlang version of
-
Marcone
(42/42)
Jan 27 2020
#include
- rumbu (43/85) Jan 27 2020 Translated (including errors & comments):
- Marcone (6/50) Jan 27 2020 Thank you very much! But I have this error when I try to compile:
- Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= (2/10) Jan 27 2020 probably, you need to link your exec with comctl32.lib
- Marcone (4/17) Jan 27 2020 Very good!! Working fine adding:
#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); }
Jan 27 2020
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); }
Jan 27 2020
On Monday, 27 January 2020 at 13:07:20 UTC, rumbu wrote:On Monday, 27 January 2020 at 11:34:47 UTC, Marcone wrote:Thank you very much! But I have this error when I try to compile: Error 42: Symbol Undefined _InitCommonControls 0 Error: linker exited with status 1 I am using Resedit.exe for create dialog resource and compiled .rc to .res for link.[...]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); }
Jan 27 2020
On Monday, 27 January 2020 at 13:24:03 UTC, Marcone wrote:On Monday, 27 January 2020 at 13:07:20 UTC, rumbu wrote:probably, you need to link your exec with comctl32.lib[...]Thank you very much! But I have this error when I try to compile: Error 42: Symbol Undefined _InitCommonControls 0 Error: linker exited with status 1 I am using Resedit.exe for create dialog resource and compiled .rc to .res for link.
Jan 27 2020
On Monday, 27 January 2020 at 13:41:13 UTC, Ferhat Kurtulmuş wrote:On Monday, 27 January 2020 at 13:24:03 UTC, Marcone wrote:Very good!! Working fine adding: pragma(lib, "comctl32.lib");On Monday, 27 January 2020 at 13:07:20 UTC, rumbu wrote:probably, you need to link your exec with comctl32.lib[...]Thank you very much! But I have this error when I try to compile: Error 42: Symbol Undefined _InitCommonControls 0 Error: linker exited with status 1 I am using Resedit.exe for create dialog resource and compiled .rc to .res for link.
Jan 27 2020