vc的问题,哪里错了,,代码怎么改?
#include<windows.h>
#include <tchar.h>
#include<math.h>
#include<WinUser.h>
#include<stdlib.h>
#include "stdafx.h"
#include<tchar.h>
#define IDM_ADDMENU 15
#define IDM_DELMENU 16
#define IDM_EXIT 17
#define IDM_HELP 22
#define IDM_qiuhe 23
#define IDM_fangcha 24
#define IDM_pinjunzhi 25
#define IDM_junfangcha 26
HWND hwnd;
BOOLEAN IniWindowClass(HINSTANCE hInstance,int nCmdshow);
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MSG msg;
if(!IniWindowClass(hInstance,nCmdShow))
{ MessageBox(NULL,_T("创建失败"), _T("创建窗口"),NULL);
return 1;
}
HACCEL hAccel=LoadAccelerators(hInstance,_T("MYMENUACCEL"));
while(GetMessage(&msg,NULL,0,0))
{
if(!TranslateAccelerator(hwnd,hAccel,&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return(int) msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HMENU hmenu,haddmenu;
switch (message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDM_ADDMENU:
hmenu=GetMenu(hwnd);
haddmenu=CreateMenu();
AppendMenu(haddmenu,MF_ENABLED,IDM_qiuhe,L"求和");
AppendMenu(haddmenu,MF_ENABLED,IDM_fangcha,L"方差");
AppendMenu(haddmenu,MF_ENABLED,IDM_pinjunzhi,L"品均值");
AppendMenu(haddmenu,MF_ENABLED,IDM_junfanggen,L"均方差");
InsertMenu(hmenu,2,MF_POPUP|MF_BYPOSITION,(UINT)haddhmenu,L"统计计算(&C)");
EnableMenuItem(hmenu,IDM_ADDMENU,MF_GRAYED);
EnableMenuItem(hmenu,IDM_ADDMENU,MF_ENABLED);
DrawMenuBar(hwnd);
break;
case IDN_DELMENU:
hmenu=GetMenu(hwnd);
DeleteMenu(hmenu,2,MF_BYPOSITION);
EnableMenuItem(hmenu,IDM_ADDMENU,MF_GRAYED);
EnableMenuItem(hmenu,IDM_ADDMENU,MF_ENABLED);
DrawMenuBar(hwnd);
break;
case IDM_EXIT:
SendMessage(hwnd,WM_DESTROY,0,0);
break;
}
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return 0;
}
BOOLEAN IniWindowClass(HINSTANCE hInstance, int nCmdShow)
{
WNDCLASSEX wndclass;
TCHAR szWindowClass[] = _T("菜单窗口示例");
TCHAR szTitle[] = _T("菜单窗口示例");
//memset(&wndclass, 0, sizeof(WNDCLASSEX));
wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.style = 0;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = L"MYMENUANME";
wndclass.lpszClassName = szWindowClass;
wndclass.hIconSm = LoadIcon(wndclass.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
if (!RegisterClassEx(&wndclass))
return FALSE;
hwnd = CreateWindow(
szWindowClass,
szTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
if (!hWnd)
return FALSE;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
...全文
相关推荐
VC魔兽争霸3(war3)改键源代码
VC魔兽争霸3(war3)改键源代码
真正能用的VC版Base64解码代码,VC6专用
因为VC6没有Base64的API,所以这个只针对VC6版本,VC6以上的版本都自带了API。这个也是从API里面直接复制出来的,保证能用,之前在网上找了几个都不是很好用。 inline int DecodeBase64Char(unsigned int ch) throw() { // returns -1 if the character is invalid // or sho
魔兽改键助手源代码(VC6.0)
初步制作,基本功能。 1,一直显血,随便切换。 2,智能识别聊天模式,不用关闭改键即可正常聊天。 3,分开物品栏和技能改键。 4,其他有待开发。。。
从VC6到VC9代码移植的问题总结 从VC6.0到VC2008代码移植的问题总结
由于VC6.0和VC9.0即VC2008编译器的差别 代码移植会出现很多问题 本文对从VC6到VC9代码移植的问题进行了总结 从VC6.0到VC2008代码移植的问题总结
VC 对字符进行错切、翻转、倒置、对称处理
可以实现显示字符,对字符进行错切、翻转、倒置、对称处理等


