今天重头开始学学vc,,写个windows入门的程序

WinMain.cpp

`````````````

 

#include <windows.h>

#include <stdio.h>

 

LRESULT CALLBACK WinSunProc(

HWND hwnd, //handle to windows

UINT uMsg, //message identifier

WPARAM wParam, //first message parameter

LPARAM lParam //second message parameter

);

 

int WINAPI WinMain(HINSTANCE hInstance, //handle to current instance

  HINSTANCE hPreInstance, //handle to previous instance

  LPSTR lpCmdLine, //command line

  int nShowCmd //show state

)

{

//设计一个窗口类

WNDCLASS wndcls;

wndcls.cbClsExtra=0;

wndcls.cbWndExtra=0;

wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);

wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);

wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION);

wndcls.hInstance=hInstance;

wndcls.lpfnWndProc=WinSunProc;

wndcls.lpszClassName="2010";

wndcls.lpszMenuName=NULL;

wndcls.style=CS_VREDRAW | CS_HREDRAW;

RegisterClass(&wndcls);

 

//创建窗口,定义一个变量保存成功创建窗口后返回的句柄

HWND hwnd;

hwnd=CreateWindow("2010","biaoti",WS_OVERLAPPEDWINDOW,0,0,600,400,NULL,NULL,hInstance,NULL);

 

//显示及刷新窗口

ShowWindow(hwnd,SW_SHOWNORMAL);

UpdateWindow(hwnd);

 

//定义消息结构体,开始消息循环

MSG msg;

while (GetMessage(&msg,hwnd,0,0))

{

TranslateMessage(&msg);

DispatchMessage(&msg);

}

return msg.wParam;

}

 

 

//窗口过程函数

LRESULT CALLBACK WinSunProc(

HWND hwnd, //handle to windows

UINT uMsg, //message identifier

WPARAM wParam, //first message parameter

LPARAM lParam //second message parameter

)

{

switch(uMsg)

{

case WM_CHAR:

char szchar[20];

sprintf(szchar,"char code is %d",wParam);

MessageBox(hwnd,szchar,"char",0);

break;

case WM_LBUTTONDOWN:

MessageBox(hwnd,"mouse clicked","message",0);

HDC hdc;

hdc=GetDC(hwnd);

TextOut(hdc,0,50,"程序员之家",strlen("程序员之家"));

ReleaseDC(hwnd,hdc);

break;

case WM_PAINT:

HDC hDC;

PAINTSTRUCT ps;

hDC=BeginPaint(hwnd,&ps);

TextOut(hDC,0,0,"http://blog.youkuaiyun.com/dddgon",strlen("http://blog.youkuaiyun.com/dddgon"));

EndPaint(hwnd,&ps);

   break;

case WM_CLOSE:

if (IDYES == MessageBox(hwnd,"是否真的结束?","message",MB_YESNO))

{

DestroyWindow(hwnd);

}

   break;

case WM_DESTROY:

PostQuitMessage(0);

break;

default:

return DefWindowProc(hwnd,uMsg,wParam,lParam);

}

return 0;

}

可管理VS别名和启动优化等。 1、VSTweak is a small windows application that can be used to modify a number of hard to find settings. Using this small utility you can configure dynamic help, most recent lists, command aliases, file extensions, and more. This overview will walk through each of the various tabs and cover what settings can be manipulated from that tab. 2、The first tab contains an odd assortment of Visual Studio settings. The first section on this tab is the Help Settings section which provides an interface to enable or disable two parts of dynamic help. Dynamic Help is the name given to the feature that will automatically suggest help topics based on the context of what you are doing. Dynamic Help can be a great feature, but it also tends to slow down the IDE. If you don’t find that you benefit from dynamic help then disabling it here can speed up the IDE. 3、The second section, Import or Export Keyboard Bindings, is an easy to use interface for the management of keyboard bindings. Simply select the keyboard bindings that you want to export, click the export button, than select where to save the file. After saving the file you will then need to copy it to your new system, where you can then open VSTweak, click the Import button, and select your keyboard bindings file. Using this method you can move your configured keyboard bindings from system to system. 4、The last section on this tab, Clear History, can be used to clear a number of different history lists that exist in Visual Studio. These include the command list, browser history list, find history, as well as the replace history.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值