学生 残废管理系统(是管理系统残废)喵

#include "stdafx.h"
#include "iostream"
#include <windows.h>
#include <windowsx.h>
#include "resource.h"
#include "MainDlg.h"

using namespace std;

BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
        HANDLE_MSG(hWnd, WM_INITDIALOG, Main_OnInitDialog);
        HANDLE_MSG(hWnd, WM_COMMAND, Main_OnCommand);
		HANDLE_MSG(hWnd,WM_CLOSE, Main_OnClose);
    }

    return FALSE;
}

BOOL Main_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
    return TRUE;
}

void Main_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
	int n,i=0;
	HWND hwndCombo1 = GetDlgItem(hwnd,IDC_COMBO1);
	TCHAR str[101];
	TCHAR str1[101];
	TCHAR str2[101];
    switch(id)
    {
        case IDC_OK:
			{
				GetDlgItemText(hwnd,IDC_EDIT1,str,sizeof(str));
				ComboBox_AddString(hwndCombo1,str);
				ComboBox_SetCurSel(hwndCombo1,0);
			}
			break;
		case IDC_OK2:
			{
				n=ComboBox_GetCurSel(hwndCombo1);
				ComboBox_DeleteString(hwndCombo1,n);
				ComboBox_SetCurSel(hwndCombo1,0);
			}
			break;
		case IDC_OK3:
			{
				n=ComboBox_GetCount(hwndCombo1);
				GetDlgItemText(hwnd,IDC_EDIT1,str1,sizeof(str1));
				while(i<=n)
				{
					ComboBox_GetLBText(hwndCombo1,i,str2);
					if(lstrcmp(str1,str2)==0)
					{
						ComboBox_SetCurSel(hwndCombo1,i);
						break;
					}
					i++;
				}
				i=0;
					if(lstrcmp(str1,str2)!=0)
						MessageBox(hwnd,TEXT("Not Found"),TEXT("Seach error"),0|MB_ICONHAND);
			}
			break;
		case 65535:
			MessageBox(hwnd,TEXT("添加:(在文本框内输入 然后添加)\n删除:(在下拉表内选中 然后删除)\n查找:(在文本框内输入 然后查找)"),TEXT("HELP"),0|MB_ICONQUESTION);
        break;
        default:
		break;
    }
}

void Main_OnClose(HWND hwnd)
{
    EndDialog(hwnd, 0);
}

你可能感兴趣的:(command,include,winapi)