I have console application in c. I want to convert into window application, kindly guide me so that I can make it possible.
I have console application in c. I want to convert into window application, kindly
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Outline of steps you need to take:
First two are quite easy, the most work lies in the next steps. if you want the window be just your own replication of a console, you can design a dialogue containing one text or edit control, and implement a simple dialog procedure and a message loop. Some code snippets follow, but giving a complete and working sample would go beyond the reasonable space. If you understand the code below, I guess it should get you started. If not, I am afraid you will have to learn Windows progamming basics first.
Dialog procedure
HWND consoleEditHWnd; static int CALLBACK ConsoleDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { InitWindow((HINSTANCE)hInstApp,hDlg); consoleEditHWnd = GetDlgItem(hDlg,IDC_CONSOLE_EDIT); return TRUE; } case WM_SIZE: if (consoleEditHWnd) { RECT rect; GetClientRect(hDlg, &rect); MoveWindow( consoleEditHWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE ); } break; } return FALSE; }Dialog creation and a message loop
hwndApp = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CONSOLE), NULL, ConsoleDlgProc); ShowWindow((HWND)hwndApp,SW_SHOW); UpdateWindow((HWND)hwndApp); MSG msg; while( PeekMessage(&msg, 0, 0, 0, PM_REMOVE) ) { TranslateMessage(&msg); DispatchMessage(&msg); }Writing into the console
When you want to add some text into the “console”, you can do it using