Posts

Showing posts with the label Windows Programming

Write a Windows Program to display a message box with cancel, Retry and Continue.

Steps: 1. Open DEV C++. 2. Click “File” then “New” after that “Project”. 3. From “Basic” select “Wildows Application”. 4. Select “C++ project”. 5. Give a project name. 6. Click “ok” then “save”. Remove some code and write according to below program. #include <windows.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int nResult=MessageBox(NULL, “An example of Cancel, Retry, Continue”, “Hello Message Box!”, MB_ICONERROR|MB_ABORTRETRYIGNORE); switch (nResult) { case IDABORT: break; case IDRETRY: break; case IDIGNORE: break; } return 0; } Steps: 1. From “Execute” menu click on “Compile and run”. 2. Give it a name and save it. 3. Wait until your compilation is completed by the compiler. 4. Hope you get your output.

Write a windows program to output a blank box with your name given

Steps: 1. Open DEV C++. 2. Click “File” then “New” after that “Project”. 3. From “Basic” select “Wildows Application”. 4. Select “C++ project”. 5. Give a project name. 6. Click “ok” then “save”. Now you get the full program code here. You dont have to write the same code again and again for different programs. Steps: 1. From “Execute” menu click on “Compile and run”. 2. Give it a name and save it. 3. Wait until your compilation is completed by the compiler. 4. You see a blank box with the name “Caption”. 5. Close the blank box. 6. In your program code press CTRL+F. 7. Here you type the name “Caption” then click on “find”. 8. Change the word with “your name”. 9. From “Execute” menu click on “Compile and run” again. You get you result with your name printed on a blank box. #include <windows.h> /* This is where all the input to the window goes to */ LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { /* Upon destruction, ...