i have searched everywhere and i cannot find a simple c example for creating a simple click button, where if the user clicks on it, the program prints something to the screen, or something. any help would be very appreciated.

Recommended Answers

You have to write a GUI program. For MS-Windows here is a tutorial

Jump to Post

All 4 Replies

ok, the link brought me to some helpful code, but the compiler (Visual C++) is saying the 2nd argument in MessageBox isnt the correct type. once again, I run into LPCWSTR.

#include <windows.h>

WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR pszCmdLine, int iCmdShow)
	MessageBox(NULL, "Text", "Title", MB_OK | MB_ICONEXCLAMATION);
	return 0;

Try this

MessageBox(NULL, L"Text", "Title", MB_OK | MB_ICONEXCLAMATION);

Or don't compile your code for UNICODE. Go to project --> Settings --> General and turn UNICODE off.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.