是不错,可惜可视化不如VC,又没有MFC
解决方案 »
- VS2010 MFC工程能否调用C#中的控件?
- 把一个几万行甚至几十万行七列的数组数据写入一个Excel文档为什么会那么慢啊?急
- WDK中的passthru示例无法启动
- 那为大哥懂模式匹配BM算法的进来下!!
- 谁做过K-均值分割或FCM聚类分割来分割图象啊。
- 全局函数的字符串传到对话框成员变量中出现的问题
- 为什么我的总信誉分老是下降?
- 请问,VC中如何枚举所有字体???
- 请问如何得到已打开ie的接口?
- 请问《深入浅出MFC(第二版) CD 》和 《MFC Visual C++ 编程技术内幕 CD 》哪本书比较好。我是初学者
- win2000的ntfs 分区,怎么格式化啊,写了啊,各位超虾
- 求教文件读写问题!
@@header: c:\test\aaaares.h
@@resources: c:\test\aaaa.rc
Do not edit outside the indicated areas */
/*<---------------------------------------------------------------------->*/
/*<---------------------------------------------------------------------->*/
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <string.h>
#include <winsock2.h>
#include "aaaares.h"
/*<---------------------------------------------------------------------->*/
HINSTANCE hInst; // Instance handle
HWND hwndMain; //Main window handleHWND hwndMDIClient; //Mdi client window handle
WSADATA *WsaData;
HWND hwndToolBar;
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
LRESULT CALLBACK MdiChildWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
/* --- The following code comes from e:\lcc\lib\wizard\statbar.tpl. */// Global Variables for the status bar control.HWND hWndStatusbar;/*------------------------------------------------------------------------
Procedure: UpdateStatusBar ID:1
Purpose: Updates the statusbar control with the appropiate
text
Input: lpszStatusString: Charactar string that will be shown
partNumber: index of the status bar part number.
displayFlags: Decoration flags
Output: none
Errors: none------------------------------------------------------------------------*/
void UpdateStatusBar(LPSTR lpszStatusString, WORD partNumber, WORD displayFlags)
{
SendMessage(hWndStatusbar,
SB_SETTEXT,
partNumber | displayFlags,
(LPARAM)lpszStatusString);
}
/*------------------------------------------------------------------------
Procedure: MsgMenuSelect ID:1
Purpose: Shows in the status bar a descriptive explaation of
the purpose of each menu item.The message
WM_MENUSELECT is sent when the user starts browsing
the menu for each menu item where the mouse passes.
Input: Standard windows.
Output: The string from the resources string table is shown
Errors: If the string is not found nothing will be shown.
------------------------------------------------------------------------*/
LRESULT MsgMenuSelect(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
static char szBuffer[256];
UINT nStringID = 0;
UINT fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
UINT uCmd = GET_WM_MENUSELECT_CMD(wparam, lparam);
HMENU hMenu = GET_WM_MENUSELECT_HMENU(wparam, lparam); szBuffer[0] = 0; // First reset the buffer
if (fuFlags == 0xffff && hMenu == NULL) // Menu has been closed
nStringID = 0; else if (fuFlags & MFT_SEPARATOR) // Ignore separators
nStringID = 0; else if (fuFlags & MF_POPUP) // Popup menu
{
if (fuFlags & MF_SYSMENU) // System menu
nStringID = IDS_SYSMENU;
else
// Get string ID for popup menu from idPopup array.
nStringID = 0;
} // for MF_POPUP
else // Must be a command item
nStringID = uCmd; // String ID == Command ID // Load the string if we have an ID
if (0 != nStringID)
LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));
// Finally... send the string to the status bar
UpdateStatusBar(szBuffer, 0, 0);
return 0;
}
/*------------------------------------------------------------------------
Procedure: InitializeStatusBar ID:1
Purpose: Initialize the status bar
Input: hwndParent: the parent window
nrOfParts: The status bar can contain more than one
part. What is difficult, is to figure out how this
should be drawn. So, for the time being only one is
being used...
Output: The status bar is created
Errors:
------------------------------------------------------------------------*/
void InitializeStatusBar(HWND hwndParent,int nrOfParts)
{
const int cSpaceInBetween = 8;
int ptArray[40]; // Array defining the number of parts/sections
RECT rect;
HDC hDC; /* * Fill in the ptArray... */ hDC = GetDC(hwndParent);
GetClientRect(hwndParent, &rect); ptArray[nrOfParts-1] = rect.right;
//---TODO--- Add code to calculate the size of each part of the status
// bar here. ReleaseDC(hwndParent, hDC);
SendMessage(hWndStatusbar,
SB_SETPARTS,
nrOfParts,
(LPARAM)(LPINT)ptArray); UpdateStatusBar("Ready", 0, 0);
//---TODO--- Add code to update all fields of the status bar here.
// As an example, look at the calls commented out below.// UpdateStatusBar("Cursor Pos:", 1, SBT_POPOUT);
// UpdateStatusBar("Time:", 3, SBT_POPOUT);
}
/*------------------------------------------------------------------------
Procedure: CreateSBar ID:1
Purpose: Calls CreateStatusWindow to create the status bar
Input: hwndParent: the parent window
initial text: the initial contents of the status bar
Output:
Errors:
------------------------------------------------------------------------*/
static BOOL CreateSBar(HWND hwndParent,char *initialText,int nrOfParts)
{
hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER|SBARS_SIZEGRIP,
initialText,
hwndParent,
IDM_STATUSBAR);
if(hWndStatusbar)
{
InitializeStatusBar(hwndParent,nrOfParts);
return TRUE;
} return FALSE;
}int GetFileName(char *buffer,int buflen)
{
char tmpfilter[37];
int i = 0;
OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hInstance = GetModuleHandle(NULL);
ofn.hwndOwner = GetActiveWindow();
ofn.lpstrFile = buffer;
ofn.nMaxFile = buflen;
ofn.lpstrTitle = "打开";
ofn.nFilterIndex = 1;
ofn.lpstrDefExt = "txt";
strcpy(buffer,"*.txt");
strcpy(tmpfilter,"文本文件,*.txt,所有文件,*.*");
while(tmpfilter[i]) {
if (tmpfilter[i] == ',')
tmpfilter[i] = 0;
i++;
}
tmpfilter[i++] = 0; tmpfilter[i++] = 0;
ofn.Flags = 539678;
ofn.lpstrFilter = tmpfilter;
return GetOpenFileName(&ofn);}/*<---------------------------------------------------------------------->*/
/*@@0->@@*/
static BOOL InitApplication(void)
{
WNDCLASS wc; memset(&wc,0,sizeof(WNDCLASS));
wc.style = CS_HREDRAW|CS_VREDRAW |CS_DBLCLKS ;
wc.lpfnWndProc = (WNDPROC)MainWndProc;
wc.hInstance = hInst;
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszClassName = "aaaaWndClass";
wc.lpszMenuName = MAKEINTRESOURCE(IDMAINMENU);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
if (!RegisterClass(&wc))
return 0;
/* --- The following code comes from e:\lcc\lib\wizard\regmdichild.tpl. */
wc.style = 0;
wc.lpfnWndProc = (WNDPROC)MdiChildWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 20;
wc.hInstance = hInst; // Owner of this class
wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CHILDICON));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); // Default color
wc.lpszMenuName = NULL;
wc.lpszClassName = "MdiChildWndClass";
if (!RegisterClass((LPWNDCLASS)&wc))
return FALSE;
/*@@0<-@@*/
// ---TODO--- Call module specific initialization routines here return 1;
}/*<---------------------------------------------------------------------->*/
/*@@1->@@*/
HWND CreateaaaaWndClassWnd(void)
{
return CreateWindow("aaaaWndClass","aaaa",
WS_MINIMIZEBOX|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZEBOX|WS_CAPTION|WS_BORDER|WS_SYSMENU|WS_THICKFRAME,
CW_USEDEFAULT,0,CW_USEDEFAULT,0,
NULL,
NULL,
hInst,
NULL);
}
/*@@1<-@@*/
/* --- The following code comes from e:\lcc\lib\wizard\mdicmdnew.tpl. */
/*<---------------------------------------------------------------------->*/HWND MDICmdFileNew(char *title)
{
HWND hwndChild;
char rgch[150];
static int cUntitled;
MDICREATESTRUCT mcs; if (title == NULL)
wsprintf(rgch,"Untitled%d", cUntitled++);
else {
strncpy(rgch,title,149);
rgch[149] = 0;
} // Create the MDI child window mcs.szClass = "MdiChildWndClass"; // window class name
mcs.szTitle = rgch; // window title
mcs.hOwner = hInst; // owner
mcs.x = CW_USEDEFAULT; // x position
mcs.y = CW_USEDEFAULT; // y position
mcs.cx = CW_USEDEFAULT; // width
mcs.cy = CW_USEDEFAULT; // height
mcs.style = 0; // window style
mcs.lParam = 0; // lparam hwndChild = (HWND) SendMessage(hwndMDIClient,
WM_MDICREATE,
0,
(LPARAM)(LPMDICREATESTRUCT) &mcs); if (hwndChild != NULL)
ShowWindow(hwndChild, SW_SHOW); return hwndChild;
}/*<---------------------------------------------------------------------->*/
/* --- The following code comes from e:\lcc\lib\wizard\aboutdlg.tpl. */
BOOL _stdcall AboutDlg(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_CLOSE:
EndDialog(hwnd,0);
return 1;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
EndDialog(hwnd,1);
return 1;
}
break;
}
return 0;
}/*<---------------------------------------------------------------------->*/
/* --- The following code comes from e:\lcc\lib\wizard\mdidefoncmd.tpl. */
/* --- The following code comes from e:\lcc\lib\wizard\aboutcmd.tpl. */
void MainWndProc_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{ char buffer[MAX_PATH]; switch(id) {
// ---TODO--- Add new menu commands here
/*@@NEWCOMMANDS@@*/
case IDM_ABOUT:
DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT),
hwndMain,AboutDlg);
break; case IDM_OPEN:
GetFileName(buffer,sizeof(buffer));
break; case IDM_NEW:
MDICmdFileNew(NULL); // Use a character string if you do not
// want the default "untitled%d" title
break;
case IDM_WINDOWTILE:
SendMessage(hwndMDIClient,WM_MDITILE,0,0);
break;
case IDM_WINDOWCASCADE:
SendMessage(hwndMDIClient,WM_MDICASCADE,0,0);
break;
case IDM_WINDOWICONS:
SendMessage(hwndMDIClient,WM_MDIICONARRANGE,0,0);
break;
case IDM_EXIT:
PostMessage(hwnd,WM_CLOSE,0,0);
break;
}
}
/* --- The following code comes from e:\lcc\lib\wizard\creatMdiClient.tpl. */
//
// FUNCTION: CreateMdiClient(HWND)
//
// PURPOSE: To create an MDI client window.
//
// PARAMETERS:
// hwnd - The window handing the message.
// RETURN VALUE:
// The handle of the mdiclient window.
static HWND CreateMdiClient(HWND hwndparent)
{
CLIENTCREATESTRUCT ccs = {0};
HWND hwndMDIClient;
int icount = GetMenuItemCount(GetMenu(hwndparent)); // Find window menu where children will be listed
ccs.hWindowMenu = GetSubMenu(GetMenu(hwndparent), icount-2);
ccs.idFirstChild = IDM_WINDOWCHILD; // Create the MDI client filling the client area
hwndMDIClient = CreateWindow("mdiclient",
NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL |
WS_HSCROLL,
0, 0, 0, 0,
hwndparent,
(HMENU)0xCAC,
hInst,
(LPVOID)&ccs); ShowWindow(hwndMDIClient, SW_SHOW); return hwndMDIClient;
}/* --- The following code comes from e:\lcc\lib\wizard\mdichildwproc.tpl. */
//
// FUNCTION: MDIChildWndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for MDI child windows.
//
// PARAMETERS:
// hwnd - window handle
// uMessage - message number
// wparam - additional information (dependant of message number)
// lparam - additional information (dependant of message number)
//
// RETURN VALUE:
// Depends on the message number.
//
LRESULT CALLBACK MdiChildWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg) {
}
return DefMDIChildProc(hwnd, msg, wparam, lparam);
}
/*<---------------------------------------------------------------------->*/
/*@@2->@@*/
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch (msg) {
/*@@3->@@*/
case WM_CREATE:
hwndMDIClient = CreateMdiClient(hwnd);
break;
case WM_SIZE:
SendMessage(hWndStatusbar,msg,wParam,lParam);
SendMessage(hwndToolBar,msg,wParam,lParam);
InitializeStatusBar(hWndStatusbar,1);
/* --- The following code comes from e:\lcc\lib\wizard\mditoolbarsize.tpl. */
// Position the MDI client window between the tool and status bars
if (wParam != SIZE_MINIMIZED) {
RECT rc, rcClient;
GetClientRect(hwnd, &rcClient);
GetWindowRect(hWndStatusbar, &rc);
ScreenToClient(hwnd, (LPPOINT)&rc.left);
rcClient.bottom = rc.top;
GetWindowRect(hwndToolBar,&rc);
rcClient.top = rc.bottom - rc.top;
MoveWindow(hwndMDIClient,rcClient.left,rcClient.top,rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, TRUE);
}
case WM_MENUSELECT:
return MsgMenuSelect(hwnd,msg,wParam,lParam);
case WM_COMMAND:
HANDLE_WM_COMMAND(hwnd,wParam,lParam,MainWndProc_OnCommand);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
}
/*@@3<-@@*/
return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
}
/*@@2<-@@*/
/*<---------------------------------------------------------------------->*/
/* --- The following code comes from e:\lcc\lib\wizard\tcpini.tpl. */
// WSADATA *InitWS2(void)
// Routine Description:
//
// Calls WSAStartup, makes sure we have a good version of WinSock2
//
//
// Return Value:
// A pointer to a WSADATA structure - WinSock 2 DLL successfully started up
// NULL - Error starting up WinSock 2 DLL.
//
WSADATA *InitWS2(void)
{
int Error; // catches return value of WSAStartup
WORD VersionRequested; // passed to WSAStartup
static WSADATA WsaData; // receives data from WSAStartup
BOOL ReturnValue = TRUE; // return value flag
// Start WinSock 2. If it fails, we don't need to call
// WSACleanup().
VersionRequested = MAKEWORD(2, 0);
Error = WSAStartup(VersionRequested, &WsaData);
if (Error) {
MessageBox(hwndMain,
"Could not find high enough version of WinSock",
"Error", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
ReturnValue = FALSE;
} else { // Now confirm that the WinSock 2 DLL supports the exact version
// we want. If not, make sure to call WSACleanup().
if (LOBYTE(WsaData.wVersion) != 2) {
MessageBox(hwndMain,
"Could not find the correct version of WinSock",
"Error", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
WSACleanup();
ReturnValue = FALSE;
}
}
if (ReturnValue)
return &WsaData;
return(NULL);
} // InitWS2()
/*<---------------------------------------------------------------------->*/
#define NUM_TOOLBAR_BUTTONS 14
/* --- The following code comes from e:\lcc\lib\wizard\creatToolbar1.tpl. */
HWND CreateAToolBar(HWND hwndParent)
{
HWND hwndTB;
TBADDBITMAP tbab;
TBBUTTON tbb[NUM_TOOLBAR_BUTTONS];
int index;
// Ensure that the common control DLL is loaded.
InitCommonControls();
// Create a toolbar that the user can customize and that has a
// tooltip associated with it.
hwndTB = CreateWindowEx(0, TOOLBARCLASSNAME, (LPSTR) NULL,
WS_CHILD|WS_BORDER|CCS_ADJUSTABLE,
0, 0, 0, 0, hwndParent, (HMENU) ID_TOOLBAR, hInst, NULL);
// Send the TB_BUTTONSTRUCTSIZE message, which is required for
// backward compatibility.
SendMessage(hwndTB, TB_BUTTONSTRUCTSIZE,
(WPARAM) sizeof(TBBUTTON), 0);
// Add the bitmap containing button images to the toolbar.
tbab.hInst = HINST_COMMCTRL;
tbab.nID = IDB_STD_SMALL_COLOR;
SendMessage(hwndTB, TB_ADDBITMAP, (WPARAM) NUM_TOOLBAR_BUTTONS,(LPARAM) &tbab); // clean memory before using it
memset(tbb,0,sizeof tbb);
// Add the strings
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Undo");
tbb[0].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Replace");
tbb[1].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Redo");
tbb[2].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Properties");
tbb[3].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Print preview");
tbb[4].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Print");
tbb[5].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Paste");
tbb[6].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Help");
tbb[7].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Find");
tbb[8].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Open");
tbb[9].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"New");
tbb[10].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Delete");
tbb[11].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Cut");
tbb[12].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Copy");
tbb[13].iString = index;
// Button "Undo"
tbb[0].iBitmap = STD_UNDO;
tbb[0].idCommand = IDM_EDITUNDO;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
// Button "Replace"
tbb[1].iBitmap = STD_REPLACE;
tbb[1].idCommand = IDM_EDITREPLACE;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = TBSTYLE_BUTTON;
// Button "Redo"
tbb[2].iBitmap = STD_REDOW;
tbb[2].idCommand = IDM_EDITREDO;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = TBSTYLE_BUTTON;
// Button "Properties"
tbb[3].iBitmap = STD_PROPERTIES;
tbb[3].idCommand = IDM_PROPERTIES;
tbb[3].fsState = TBSTATE_ENABLED;
tbb[3].fsStyle = TBSTYLE_BUTTON;
// Button "Print preview"
tbb[4].iBitmap = STD_PRINTPRE;
tbb[4].idCommand = IDM_PRINTPRE;
tbb[4].fsState = TBSTATE_ENABLED;
tbb[4].fsStyle = TBSTYLE_BUTTON;
// Button "Print"
tbb[5].iBitmap = STD_PRINT;
tbb[5].idCommand = IDM_PRINT;
tbb[5].fsState = TBSTATE_ENABLED;
tbb[5].fsStyle = TBSTYLE_BUTTON;
// Button "Paste"
tbb[6].iBitmap = STD_PASTE;
tbb[6].idCommand = IDM_EDITPASTE;
tbb[6].fsState = TBSTATE_ENABLED;
tbb[6].fsStyle = TBSTYLE_BUTTON;
// Button "Help"
tbb[7].iBitmap = STD_HELP;
tbb[7].idCommand = IDM_HELP;
tbb[7].fsState = TBSTATE_ENABLED;
tbb[7].fsStyle = TBSTYLE_BUTTON;
// Button "Find"
tbb[8].iBitmap = STD_FIND;
tbb[8].idCommand = IDM_FIND;
tbb[8].fsState = TBSTATE_ENABLED;
tbb[8].fsStyle = TBSTYLE_BUTTON;
// Button "Open"
tbb[9].iBitmap = STD_FILEOPEN;
tbb[9].idCommand = IDM_OPEN;
tbb[9].fsState = TBSTATE_ENABLED;
tbb[9].fsStyle = TBSTYLE_BUTTON;
// Button "New"
tbb[10].iBitmap = STD_FILENEW;
tbb[10].idCommand = IDM_NEW;
tbb[10].fsState = TBSTATE_ENABLED;
tbb[10].fsStyle = TBSTYLE_BUTTON;
// Button "Delete"
tbb[11].iBitmap = STD_DELETE;
tbb[11].idCommand = IDM_EDITDELETE;
tbb[11].fsState = TBSTATE_ENABLED;
tbb[11].fsStyle = TBSTYLE_BUTTON;
// Button "Cut"
tbb[12].iBitmap = STD_CUT;
tbb[12].idCommand = IDM_EDITCUT;
tbb[12].fsState = TBSTATE_ENABLED;
tbb[12].fsStyle = TBSTYLE_BUTTON;
// Button "Copy"
tbb[13].iBitmap = STD_COPY;
tbb[13].idCommand = IDM_EDITCOPY;
tbb[13].fsState = TBSTATE_ENABLED;
tbb[13].fsStyle = TBSTYLE_BUTTON;
SendMessage(hwndTB,TB_ADDBUTTONS,14,(LPARAM)&tbb);
ShowWindow(hwndTB,SW_SHOW);
return hwndTB;
}/*<---------------------------------------------------------------------->*/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
MSG msg;
HANDLE hAccelTable; hInst = hInstance;
if (!InitApplication())
return 0;
hAccelTable = LoadAccelerators(hInst,MAKEINTRESOURCE(IDACCEL));
if ((hwndMain = CreateaaaaWndClassWnd()) == (HWND)0)
return 0;
CreateSBar(hwndMain,"Ready",1);
hwndToolBar = CreateAToolBar(hwndMain);
ShowWindow(hwndMain,SW_SHOW);
WsaData = InitWS2();
if (WsaData == NULL)
return 0;
while (GetMessage(&msg,NULL,0,0)) {
/* --- The following code comes from e:\lcc\lib\wizard\mdimain.tpl. */
if (!TranslateMDISysAccel(hwndMDIClient, &msg))
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
TranslateMessage(&msg); // Translates virtual key codes
DispatchMessage(&msg); // Dispatches message to window
}
}
WSACleanup();
return msg.wParam;
}/*@@ Wedit generated application. Written Mon Oct 08 15:43:16 2001
@@header: c:\test\aaaares.h
@@resources: c:\test\aaaa.rc
Do not edit outside the indicated areas */
/*<---------------------------------------------------------------------->*/
/*<---------------------------------------------------------------------->*/
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <string.h>
#include <winsock2.h>
#include "aaaares.h"
/*<---------------------------------------------------------------------->*/
HINSTANCE hInst; // Instance handle
HWND hwndMain; //Main window handleHWND hwndMDIClient; //Mdi client window handle
WSADATA *WsaData;
HWND hwndToolBar;
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
LRESULT CALLBACK MdiChildWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
/* --- The following code comes from e:\lcc\lib\wizard\statbar.tpl. */// Global Variables for the status bar control.HWND hWndStatusbar;/*------------------------------------------------------------------------
Procedure: UpdateStatusBar ID:1
Purpose: Updates the statusbar control with the appropiate
text
Input: lpszStatusString: Charactar string that will be shown
partNumber: index of the status bar part number.
displayFlags: Decoration flags
Output: none
Errors: none------------------------------------------------------------------------*/
void UpdateStatusBar(LPSTR lpszStatusString, WORD partNumber, WORD displayFlags)
{
SendMessage(hWndStatusbar,
SB_SETTEXT,
partNumber | displayFlags,
(LPARAM)lpszStatusString);
}
/*------------------------------------------------------------------------
Procedure: MsgMenuSelect ID:1
Purpose: Shows in the status bar a descriptive explaation of
the purpose of each menu item.The message
WM_MENUSELECT is sent when the user starts browsing
the menu for each menu item where the mouse passes.
Input: Standard windows.
Output: The string from the resources string table is shown
Errors: If the string is not found nothing will be shown.
------------------------------------------------------------------------*/
LRESULT MsgMenuSelect(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
static char szBuffer[256];
UINT nStringID = 0;
UINT fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
UINT uCmd = GET_WM_MENUSELECT_CMD(wparam, lparam);
HMENU hMenu = GET_WM_MENUSELECT_HMENU(wparam, lparam); szBuffer[0] = 0; // First reset the buffer
if (fuFlags == 0xffff && hMenu == NULL) // Menu has been closed
nStringID = 0; else if (fuFlags & MFT_SEPARATOR) // Ignore separators
nStringID = 0; else if (fuFlags & MF_POPUP) // Popup menu
{
if (fuFlags & MF_SYSMENU) // System menu
nStringID = IDS_SYSMENU;
else
// Get string ID for popup menu from idPopup array.
nStringID = 0;
} // for MF_POPUP
else // Must be a command item
nStringID = uCmd; // String ID == Command ID // Load the string if we have an ID
if (0 != nStringID)
LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));
// Finally... send the string to the status bar
UpdateStatusBar(szBuffer, 0, 0);
return 0;
}
/*------------------------------------------------------------------------
Procedure: InitializeStatusBar ID:1
Purpose: Initialize the status bar
Input: hwndParent: the parent window
nrOfParts: The status bar can contain more than one
part. What is difficult, is to figure out how this
should be drawn. So, for the time being only one is
being used...
Output: The status bar is created
Errors:
------------------------------------------------------------------------*/
void InitializeStatusBar(HWND hwndParent,int nrOfParts)
{
const int cSpaceInBetween = 8;
int ptArray[40]; // Array defining the number of parts/sections
RECT rect;
HDC hDC; /* * Fill in the ptArray... */ hDC = GetDC(hwndParent);
GetClientRect(hwndParent, &rect); ptArray[nrOfParts-1] = rect.right;
//---TODO--- Add code to calculate the size of each part of the status
// bar here. ReleaseDC(hwndParent, hDC);
SendMessage(hWndStatusbar,
SB_SETPARTS,
nrOfParts,
(LPARAM)(LPINT)ptArray); UpdateStatusBar("Ready", 0, 0);
//---TODO--- Add code to update all fields of the status bar here.
// As an example, look at the calls commented out below.// UpdateStatusBar("Cursor Pos:", 1, SBT_POPOUT);
// UpdateStatusBar("Time:", 3, SBT_POPOUT);
}
/*------------------------------------------------------------------------
Procedure: CreateSBar ID:1
Purpose: Calls CreateStatusWindow to create the status bar
Input: hwndParent: the parent window
initial text: the initial contents of the status bar
Output:
Errors:
------------------------------------------------------------------------*/
static BOOL CreateSBar(HWND hwndParent,char *initialText,int nrOfParts)
{
hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER|SBARS_SIZEGRIP,
initialText,
hwndParent,
IDM_STATUSBAR);
if(hWndStatusbar)
{
InitializeStatusBar(hwndParent,nrOfParts);
return TRUE;
} return FALSE;
}int GetFileName(char *buffer,int buflen)
{
char tmpfilter[37];
int i = 0;
OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hInstance = GetModuleHandle(NULL);
ofn.hwndOwner = GetActiveWindow();
ofn.lpstrFile = buffer;
ofn.nMaxFile = buflen;
ofn.lpstrTitle = "打开";
ofn.nFilterIndex = 1;
ofn.lpstrDefExt = "txt";
strcpy(buffer,"*.txt");
strcpy(tmpfilter,"文本文件,*.txt,所有文件,*.*");
while(tmpfilter[i]) {
if (tmpfilter[i] == ',')
tmpfilter[i] = 0;
i++;
}
tmpfilter[i++] = 0; tmpfilter[i++] = 0;
ofn.Flags = 539678;
ofn.lpstrFilter = tmpfilter;
return GetOpenFileName(&ofn);}/*<---------------------------------------------------------------------->*/
/*@@0->@@*/
static BOOL InitApplication(void)
{
WNDCLASS wc; memset(&wc,0,sizeof(WNDCLASS));
wc.style = CS_HREDRAW|CS_VREDRAW |CS_DBLCLKS ;
wc.lpfnWndProc = (WNDPROC)MainWndProc;
wc.hInstance = hInst;
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszClassName = "aaaaWndClass";
wc.lpszMenuName = MAKEINTRESOURCE(IDMAINMENU);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
if (!RegisterClass(&wc))
return 0;
/* --- The following code comes from e:\lcc\lib\wizard\regmdichild.tpl. */
wc.style = 0;
wc.lpfnWndProc = (WNDPROC)MdiChildWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 20;
wc.hInstance = hInst; // Owner of this class
wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CHILDICON));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); // Default color
wc.lpszMenuName = NULL;
wc.lpszClassName = "MdiChildWndClass";
if (!RegisterClass((LPWNDCLASS)&wc))
return FALSE;
/*@@0<-@@*/
// ---TODO--- Call module specific initialization routines here return 1;
}/*<---------------------------------------------------------------------->*/
/*@@1->@@*/
HWND CreateaaaaWndClassWnd(void)
{
return CreateWindow("aaaaWndClass","aaaa",
WS_MINIMIZEBOX|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZEBOX|WS_CAPTION|WS_BORDER|WS_SYSMENU|WS_THICKFRAME,
CW_USEDEFAULT,0,CW_USEDEFAULT,0,
NULL,
NULL,
hInst,
NULL);
}
/*@@1<-@@*/
/* --- The following code comes from e:\lcc\lib\wizard\mdicmdnew.tpl. */
/*<---------------------------------------------------------------------->*/HWND MDICmdFileNew(char *title)
{
HWND hwndChild;
char rgch[150];
static int cUntitled;
MDICREATESTRUCT mcs; if (title == NULL)
wsprintf(rgch,"Untitled%d", cUntitled++);
else {
strncpy(rgch,title,149);
rgch[149] = 0;
} // Create the MDI child window mcs.szClass = "MdiChildWndClass"; // window class name
mcs.szTitle = rgch; // window title
mcs.hOwner = hInst; // owner
mcs.x = CW_USEDEFAULT; // x position
mcs.y = CW_USEDEFAULT; // y position
mcs.cx = CW_USEDEFAULT; // width
mcs.cy = CW_USEDEFAULT; // height
mcs.style = 0; // window style
mcs.lParam = 0; // lparam hwndChild = (HWND) SendMessage(hwndMDIClient,
WM_MDICREATE,
0,
(LPARAM)(LPMDICREATESTRUCT) &mcs); if (hwndChild != NULL)
ShowWindow(hwndChild, SW_SHOW); return hwndChild;
}/*<---------------------------------------------------------------------->*/
/* --- The following code comes from e:\lcc\lib\wizard\aboutdlg.tpl. */
BOOL _stdcall AboutDlg(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_CLOSE:
EndDialog(hwnd,0);
return 1;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
EndDialog(hwnd,1);
return 1;
}
break;
}
return 0;
}/*<---------------------------------------------------------------------->*/
/* --- The following code comes from e:\lcc\lib\wizard\mdidefoncmd.tpl. */
/* --- The following code comes from e:\lcc\lib\wizard\aboutcmd.tpl. */
void MainWndProc_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{ char buffer[MAX_PATH]; switch(id) {
// ---TODO--- Add new menu commands here
/*@@NEWCOMMANDS@@*/
case IDM_ABOUT:
DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT),
hwndMain,AboutDlg);
break; case IDM_OPEN:
GetFileName(buffer,sizeof(buffer));
break; case IDM_NEW:
MDICmdFileNew(NULL); // Use a character string if you do not
// want the default "untitled%d" title
break;
case IDM_WINDOWTILE:
SendMessage(hwndMDIClient,WM_MDITILE,0,0);
break;
case IDM_WINDOWCASCADE:
SendMessage(hwndMDIClient,WM_MDICASCADE,0,0);
break;
case IDM_WINDOWICONS:
SendMessage(hwndMDIClient,WM_MDIICONARRANGE,0,0);
break;
case IDM_EXIT:
PostMessage(hwnd,WM_CLOSE,0,0);
break;
}
}
/* --- The following code comes from e:\lcc\lib\wizard\creatMdiClient.tpl. */
//
// FUNCTION: CreateMdiClient(HWND)
//
// PURPOSE: To create an MDI client window.
//
// PARAMETERS:
// hwnd - The window handing the message.
// RETURN VALUE:
// The handle of the mdiclient window.
static HWND CreateMdiClient(HWND hwndparent)
{
CLIENTCREATESTRUCT ccs = {0};
HWND hwndMDIClient;
int icount = GetMenuItemCount(GetMenu(hwndparent)); // Find window menu where children will be listed
ccs.hWindowMenu = GetSubMenu(GetMenu(hwndparent), icount-2);
ccs.idFirstChild = IDM_WINDOWCHILD; // Create the MDI client filling the client area
hwndMDIClient = CreateWindow("mdiclient",
NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL |
WS_HSCROLL,
0, 0, 0, 0,
hwndparent,
(HMENU)0xCAC,
hInst,
(LPVOID)&ccs); ShowWindow(hwndMDIClient, SW_SHOW); return hwndMDIClient;
}/* --- The following code comes from e:\lcc\lib\wizard\mdichildwproc.tpl. */
//
// FUNCTION: MDIChildWndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for MDI child windows.
//
// PARAMETERS:
// hwnd - window handle
// uMessage - message number
// wparam - additional information (dependant of message number)
// lparam - additional information (dependant of message number)
//
// RETURN VALUE:
// Depends on the message number.
//
LRESULT CALLBACK MdiChildWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg) {
}
return DefMDIChildProc(hwnd, msg, wparam, lparam);
}
/*<---------------------------------------------------------------------->*/
/*@@2->@@*/
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch (msg) {
/*@@3->@@*/
case WM_CREATE:
hwndMDIClient = CreateMdiClient(hwnd);
break;
case WM_SIZE:
SendMessage(hWndStatusbar,msg,wParam,lParam);
SendMessage(hwndToolBar,msg,wParam,lParam);
InitializeStatusBar(hWndStatusbar,1);
/* --- The following code comes from e:\lcc\lib\wizard\mditoolbarsize.tpl. */
// Position the MDI client window between the tool and status bars
if (wParam != SIZE_MINIMIZED) {
RECT rc, rcClient;
GetClientRect(hwnd, &rcClient);
GetWindowRect(hWndStatusbar, &rc);
ScreenToClient(hwnd, (LPPOINT)&rc.left);
rcClient.bottom = rc.top;
GetWindowRect(hwndToolBar,&rc);
rcClient.top = rc.bottom - rc.top;
MoveWindow(hwndMDIClient,rcClient.left,rcClient.top,rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, TRUE);
}
case WM_MENUSELECT:
return MsgMenuSelect(hwnd,msg,wParam,lParam);
case WM_COMMAND:
HANDLE_WM_COMMAND(hwnd,wParam,lParam,MainWndProc_OnCommand);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
}
/*@@3<-@@*/
return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
}
/*@@2<-@@*/
/*<---------------------------------------------------------------------->*/
/* --- The following code comes from e:\lcc\lib\wizard\tcpini.tpl. */
// WSADATA *InitWS2(void)
// Routine Description:
//
// Calls WSAStartup, makes sure we have a good version of WinSock2
//
//
// Return Value:
// A pointer to a WSADATA structure - WinSock 2 DLL successfully started up
// NULL - Error starting up WinSock 2 DLL.
//
WSADATA *InitWS2(void)
{
int Error; // catches return value of WSAStartup
WORD VersionRequested; // passed to WSAStartup
static WSADATA WsaData; // receives data from WSAStartup
BOOL ReturnValue = TRUE; // return value flag
// Start WinSock 2. If it fails, we don't need to call
// WSACleanup().
VersionRequested = MAKEWORD(2, 0);
Error = WSAStartup(VersionRequested, &WsaData);
if (Error) {
MessageBox(hwndMain,
"Could not find high enough version of WinSock",
"Error", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
ReturnValue = FALSE;
} else { // Now confirm that the WinSock 2 DLL supports the exact version
// we want. If not, make sure to call WSACleanup().
if (LOBYTE(WsaData.wVersion) != 2) {
MessageBox(hwndMain,
"Could not find the correct version of WinSock",
"Error", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
WSACleanup();
ReturnValue = FALSE;
}
}
if (ReturnValue)
return &WsaData;
return(NULL);
} // InitWS2()
/*<---------------------------------------------------------------------->*/
#define NUM_TOOLBAR_BUTTONS 14
/* --- The following code comes from e:\lcc\lib\wizard\creatToolbar1.tpl. */
HWND CreateAToolBar(HWND hwndParent)
{
HWND hwndTB;
TBADDBITMAP tbab;
TBBUTTON tbb[NUM_TOOLBAR_BUTTONS];
int index;
// Ensure that the common control DLL is loaded.
InitCommonControls();
// Create a toolbar that the user can customize and that has a
// tooltip associated with it.
hwndTB = CreateWindowEx(0, TOOLBARCLASSNAME, (LPSTR) NULL,
WS_CHILD|WS_BORDER|CCS_ADJUSTABLE,
0, 0, 0, 0, hwndParent, (HMENU) ID_TOOLBAR, hInst, NULL);
// Send the TB_BUTTONSTRUCTSIZE message, which is required for
// backward compatibility.
SendMessage(hwndTB, TB_BUTTONSTRUCTSIZE,
(WPARAM) sizeof(TBBUTTON), 0);
// Add the bitmap containing button images to the toolbar.
tbab.hInst = HINST_COMMCTRL;
tbab.nID = IDB_STD_SMALL_COLOR;
SendMessage(hwndTB, TB_ADDBITMAP, (WPARAM) NUM_TOOLBAR_BUTTONS,(LPARAM) &tbab); // clean memory before using it
memset(tbb,0,sizeof tbb);
// Add the strings
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Undo");
tbb[0].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Replace");
tbb[1].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Redo");
tbb[2].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Properties");
tbb[3].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Print preview");
tbb[4].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Print");
tbb[5].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Paste");
tbb[6].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Help");
tbb[7].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Find");
tbb[8].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Open");
tbb[9].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"New");
tbb[10].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Delete");
tbb[11].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Cut");
tbb[12].iString = index;
index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Copy");
tbb[13].iString = index;
// Button "Undo"
tbb[0].iBitmap = STD_UNDO;
tbb[0].idCommand = IDM_EDITUNDO;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
// Button "Replace"
tbb[1].iBitmap = STD_REPLACE;
tbb[1].idCommand = IDM_EDITREPLACE;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = TBSTYLE_BUTTON;
// Button "Redo"
tbb[2].iBitmap = STD_REDOW;
tbb[2].idCommand = IDM_EDITREDO;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = TBSTYLE_BUTTON;
// Button "Properties"
tbb[3].iBitmap = STD_PROPERTIES;
tbb[3].idCommand = IDM_PROPERTIES;
tbb[3].fsState = TBSTATE_ENABLED;
tbb[3].fsStyle = TBSTYLE_BUTTON;
// Button "Print preview"
tbb[4].iBitmap = STD_PRINTPRE;
tbb[4].idCommand = IDM_PRINTPRE;
tbb[4].fsState = TBSTATE_ENABLED;
tbb[4].fsStyle = TBSTYLE_BUTTON;
// Button "Print"
tbb[5].iBitmap = STD_PRINT;
tbb[5].idCommand = IDM_PRINT;
tbb[5].fsState = TBSTATE_ENABLED;
tbb[5].fsStyle = TBSTYLE_BUTTON;
// Button "Paste"
tbb[6].iBitmap = STD_PASTE;
tbb[6].idCommand = IDM_EDITPASTE;
tbb[6].fsState = TBSTATE_ENABLED;
tbb[6].fsStyle = TBSTYLE_BUTTON;
// Button "Help"
tbb[7].iBitmap = STD_HELP;
tbb[7].idCommand = IDM_HELP;
tbb[7].fsState = TBSTATE_ENABLED;
tbb[7].fsStyle = TBSTYLE_BUTTON;
// Button "Find"
tbb[8].iBitmap = STD_FIND;
tbb[8].idCommand = IDM_FIND;
tbb[8].fsState = TBSTATE_ENABLED;
tbb[8].fsStyle = TBSTYLE_BUTTON;
// Button "Open"
tbb[9].iBitmap = STD_FILEOPEN;
tbb[9].idCommand = IDM_OPEN;
tbb[9].fsState = TBSTATE_ENABLED;
tbb[9].fsStyle = TBSTYLE_BUTTON;
// Button "New"
tbb[10].iBitmap = STD_FILENEW;
tbb[10].idCommand = IDM_NEW;
tbb[10].fsState = TBSTATE_ENABLED;
tbb[10].fsStyle = TBSTYLE_BUTTON;
// Button "Delete"
tbb[11].iBitmap = STD_DELETE;
tbb[11].idCommand = IDM_EDITDELETE;
tbb[11].fsState = TBSTATE_ENABLED;
tbb[11].fsStyle = TBSTYLE_BUTTON;
// Button "Cut"
tbb[12].iBitmap = STD_CUT;
tbb[12].idCommand = IDM_EDITCUT;
tbb[12].fsState = TBSTATE_ENABLED;
tbb[12].fsStyle = TBSTYLE_BUTTON;
// Button "Copy"
tbb[13].iBitmap = STD_COPY;
tbb[13].idCommand = IDM_EDITCOPY;
tbb[13].fsState = TBSTATE_ENABLED;
tbb[13].fsStyle = TBSTYLE_BUTTON;
SendMessage(hwndTB,TB_ADDBUTTONS,14,(LPARAM)&tbb);
ShowWindow(hwndTB,SW_SHOW);
return hwndTB;
}/*<---------------------------------------------------------------------->*/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
MSG msg;
HANDLE hAccelTable; hInst = hInstance;
if (!InitApplication())
return 0;
hAccelTable = LoadAccelerators(hInst,MAKEINTRESOURCE(IDACCEL));
if ((hwndMain = CreateaaaaWndClassWnd()) == (HWND)0)
return 0;
CreateSBar(hwndMain,"Ready",1);
hwndToolBar = CreateAToolBar(hwndMain);
ShowWindow(hwndMain,SW_SHOW);
WsaData = InitWS2();
if (WsaData == NULL)
return 0;
while (GetMessage(&msg,NULL,0,0)) {
/* --- The following code comes from e:\lcc\lib\wizard\mdimain.tpl. */
if (!TranslateMDISysAccel(hwndMDIClient, &msg))
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
TranslateMessage(&msg); // Translates virtual key codes
DispatchMessage(&msg); // Dispatches message to window
}
}
WSACleanup();
return msg.wParam;
}
不如"Dev-C++"好!
http://www.cs.princeton.edu/software/lcc/
!!!!!!!!!!!! !!!!!!!!!! !!!! !!!!
!!! !!!! !!! !!!! !!!!
!!! !!! !!!!!!!!!! !!!! !!!!
!!! !!! !!!!!!!!!! !!!! !!!!
!!! !!!! !!! !!!!!!!
!!!!!!!!!!!! !!!!!!!!!! !!!!!
几年前就有了,唉,没有类库。