VS 2008 修改C++文件默认模板

1.找到目录..\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcprojectitems 下的newc++file.cpp文件;

2.用管理员身份运行记事本程序打开该文件(win7中直接打开无法修改);

3.修改该模板文件,成功。

newc++file.cpp
 1 /*

 2 Author: [email protected]

 3 */

 4 #include "D3D9_Utility.h"

 5 

 6 /*

 7 * Globals

 8 */

 9 

10 IDirect3DDevice9* Device = 0;

11 

12 /*

13 * Framework Functions

14 */

15 

16 bool Setup()

17 {

18     // Nothing to setup in this sample.

19     return true;

20 }

21 

22 void Cleanup()

23 {

24     // Nothing to cleanup in this sample.

25 }

26 

27 bool Display(float timeDelta)

28 {

29     if ( Device )

30     {

31         // Instruct the device to set each pixel on the back buffer black -

32         // D3DCLEAR_TARGET: 0x00000000 (black) - and to set each pixel on

33         // the depth buffer to a value of 1.0 - D3DCLEAR_ZBUFFER: 1.0f.

34         Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0);

35 

36         // Swap the back and front buffers.

37         Device->Present(0, 0, 0, 0);

38 

39     }

40     return true;

41 }

42 

43 /*

44 * WndProc

45 */

46 

47 LRESULT CALLBACK D3D9::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

48 {

49     switch( msg)

50     {

51     case WM_DESTROY:

52         PostQuitMessage(0);

53         break;

54     case WM_KEYDOWN:

55         if (wParam == VK_ESCAPE)

56             DestroyWindow(hwnd);

57         break;

58     }

59     return DefWindowProc(hwnd, msg, wParam, lParam);

60 }

61 

62 /*

63 * WinMain

64 */

65 

66 int WINAPI WinMain(HINSTANCE hinstance,

67                    HINSTANCE prevInstance,

68                    PSTR cmdLine,

69                    int showCmd)

70 {

71     if ( !D3D9::InitD3D(hinstance,

72         Width, Height, true, D3DDEVTYPE_HAL, &Device) )

73     {

74         MessageBox(0, TEXT("InitD3D() - FAILED"), 0, 0);

75         return 0;

76     }

77 

78     if (!Setup())

79     {

80         MessageBox(0, TEXT("Setup() - FAILED"), 0, 0);

81         return 0;

82     }

83 

84     D3D9::EnterMsgLoop( Display );

85 

86     Cleanup();

87 

88     Device->Release();

89 

90     return 0;

91 }

 

 

你可能感兴趣的:(2008)