Hey, I was attempting to make a password protection system in windows API where someone can type the password in an editbox and if it is the right password, then continue the program else display an error message box. I've tried a bunch of different things but can't get one that works. Could anybody show me how to do this?

Since you have already tried some methods. Just post down your existing code and maybe We can find where the problem is.

Or You can always use google :)

case IDC_ENTER:
				{
					SetDlgItemText(hwnd3, IDC_PASS, "pass");
					HWND hPass = GetDlgItem(hwnd3, IDC_PASS);
					HWND hPass2 = GetDlgItem(hwnd3, IDC_PASSC);
					if(hPass == hPass2)
					{
						if (!IsWindow(hwndGoto3)) 
						{ 
							HINSTANCE hinst3 = NULL;
							hwndGoto3 = CreateDialog(hinst3, MAKEINTRESOURCE(IDD_MAIN), hwnd3, (DLGPROC)DlgProc); 
							ShowWindow(hwndGoto3, SW_SHOW);
						}
					}
				}
			break;

I defined both IDC_PASS and IDC_PASSC in the header file. Also IDC_PASSC is an editbox.

actually here is my latest up-to-date attempt.

case IDC_ENTER:
				{
					char pass[20];
					GetDlgItemText(hwnd3, IDC_PASSC, pass, 20);
					if(pass == "password")
					{
						if (!IsWindow(hwndGoto3)) 
						{ 
							HINSTANCE hinst3 = NULL;
							hwndGoto3 = CreateDialog(hinst3, MAKEINTRESOURCE(IDD_MAIN), hwnd3, (DLGPROC)DlgProc); 
							ShowWindow(hwndGoto3, SW_SHOW);
						}
					}
				}
			break;
Be a part of the DaniWeb community

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