鱼C论坛

 找回密码
 立即注册
查看: 1828|回复: 2

求助!

[复制链接]
发表于 2016-6-8 17:08:04 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
有没有c++的作品啊,win32的
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2016-6-8 17:27:39 | 显示全部楼层
小甲鱼有
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-6-8 18:04:01 | 显示全部楼层
   
     共同学习  !!!!!!!!!!!!!!!!11
360截图20160608180325514.jpg

  1. // GT_HelloWorldWin32.cpp
  2. // compile with: /D_UNICODE /DUNICODE /DWIN32 /D_WINDOWS /c

  3. #include <windows.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <tchar.h>

  7. // Global variables

  8. // The main window class name.
  9. static TCHAR szWindowClass[] = _T("win32app");

  10. // The string that appears in the application's title bar.
  11. static TCHAR szTitle[] = _T("Win32 Guided Tour Application");

  12. HINSTANCE hInst;

  13. // Forward declarations of functions included in this code module:
  14. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

  15. int WINAPI WinMain(HINSTANCE hInstance,
  16.                    HINSTANCE hPrevInstance,
  17.                    LPSTR lpCmdLine,
  18.                    int nCmdShow)
  19. {
  20.     WNDCLASSEX wcex;

  21.     wcex.cbSize = sizeof(WNDCLASSEX);
  22.     wcex.style          = CS_HREDRAW | CS_VREDRAW;
  23.     wcex.lpfnWndProc    = WndProc;
  24.     wcex.cbClsExtra     = 0;
  25.     wcex.cbWndExtra     = 0;
  26.     wcex.hInstance      = hInstance;
  27.     wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
  28.     wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
  29.     wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
  30.     wcex.lpszMenuName   = NULL;
  31.     wcex.lpszClassName  = szWindowClass;
  32.     wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));

  33.     if (!RegisterClassEx(&wcex))
  34.     {
  35.         MessageBox(NULL,
  36.             _T("Call to RegisterClassEx failed!"),
  37.             _T("Win32 Guided Tour"),
  38.             NULL);

  39.         return 1;
  40.     }

  41.     hInst = hInstance; // Store instance handle in our global variable

  42.     // The parameters to CreateWindow explained:
  43.     // szWindowClass: the name of the application
  44.     // szTitle: the text that appears in the title bar
  45.     // WS_OVERLAPPEDWINDOW: the type of window to create
  46.     // CW_USEDEFAULT, CW_USEDEFAULT: initial position (x, y)
  47.     // 500, 100: initial size (width, length)
  48.     // NULL: the parent of this window
  49.     // NULL: this application does not have a menu bar
  50.     // hInstance: the first parameter from WinMain
  51.     // NULL: not used in this application
  52.     HWND hWnd = CreateWindow(
  53.         szWindowClass,
  54.         szTitle,
  55.         WS_OVERLAPPEDWINDOW,
  56.         CW_USEDEFAULT, CW_USEDEFAULT,
  57.         500, 100,
  58.         NULL,
  59.         NULL,
  60.         hInstance,
  61.         NULL
  62.     );

  63.     if (!hWnd)
  64.     {
  65.         MessageBox(NULL,
  66.             _T("Call to CreateWindow failed!"),
  67.             _T("Win32 Guided Tour"),
  68.             NULL);

  69.         return 1;
  70.     }

  71.     // The parameters to ShowWindow explained:
  72.     // hWnd: the value returned from CreateWindow
  73.     // nCmdShow: the fourth parameter from WinMain
  74.     ShowWindow(hWnd,
  75.         nCmdShow);
  76.     UpdateWindow(hWnd);

  77.     // Main message loop:
  78.     MSG msg;
  79.     while (GetMessage(&msg, NULL, 0, 0))
  80.     {
  81.         TranslateMessage(&msg);
  82.         DispatchMessage(&msg);
  83.     }

  84.     return (int) msg.wParam;
  85. }

  86. //
  87. //  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
  88. //
  89. //  PURPOSE:  Processes messages for the main window.
  90. //
  91. //  WM_PAINT    - Paint the main window
  92. //  WM_DESTROY  - post a quit message and return
  93. //
  94. //
  95. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  96. {
  97.     PAINTSTRUCT ps;
  98.     HDC hdc;
  99.     TCHAR greeting[] = _T("Hello, World!");

  100.     switch (message)
  101.     {
  102.     case WM_PAINT:
  103.         hdc = BeginPaint(hWnd, &ps);

  104.         // Here your application is laid out.
  105.         // For this introduction, we just print out "Hello, World!"
  106.         // in the top left corner.
  107.         TextOut(hdc,
  108.             5, 5,
  109.             greeting, _tcslen(greeting));
  110.         // End application-specific layout section.

  111.         EndPaint(hWnd, &ps);
  112.         break;
  113.     case WM_DESTROY:
  114.         PostQuitMessage(0);
  115.         break;
  116.     default:
  117.         return DefWindowProc(hWnd, message, wParam, lParam);
  118.         break;
  119.     }

  120.     return 0;
  121. }
复制代码
  
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-18 07:21

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表