回复 19楼 BlueGuy
哇哇,我只想知道你研究是什么意思。前辈能否指教一下




用心做一件事情就这么简单

程序代码:
#include "stdafx.h"
#include "resource.h"
#include "MainDlg.h"
#include <COMMCTRL.H>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
//Enable IPAddress、Calendar.etc
InitCommonControls();
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), NULL, Main_Proc);
return 0;
}
程序代码:#include "stdafx.h"
#include <windows.h>
#include <windowsx.h>
#include "resource.h"
#include "MainDlg.h"
/*
Template designed by Please visit <span style="color: #008000; text-decoration: underline;">http://www.[/color] for more information
如鹏网(<span style="color: #008000; text-decoration: underline;">http://www.[/color])大学生计算机学习社区,提供大量免费视频学习教程,提供个性化一对一学习指导
*/
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)
{
switch(id)
{
case ID_MENUITEMOPEN:
{
FILE *fp = fopen("D:/1.txt", "r");
// 可以读多行
char line[256];
fgets(line, sizeof(line), fp);
fclose(fp);
SetDlgItemText(hwnd, IDC_EDIT1, line);
}
break;
default:
break;
}
}
void Main_OnClose(HWND hwnd)
{
EndDialog(hwnd, 0);
}MainDlg.h
程序代码:#ifndef _MAIN_H #define _MAIN_H #include <windows.h> BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); BOOL Main_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam); void Main_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify); void Main_OnClose(HWND hwnd); #endif

