刘总的笔记小站

生活常识,娱乐搞笑,编程技巧,智能家居,深度学习,网络神经,数据挖掘

MSDN visual c++ build tools

自己动手开始制作Microsoft Visual C++ Build Tools 2015(v14.0) 教程:

1,微软官网下载:VisualCppBuildTools.exe在线安装程序,只有3兆大小

2,命令行启动:visualcppbuildtools_full.exe /layout D:/vc2015,建议别加静默无界面参数,巨慢看着妥当

3,经过漫长的等待自我配置,开始了下载旅程,网速大概7~10兆左右,总共1.7G大小

4,下载完成之后会退出,进入下载路径,关闭网络,点击安装,即可安装成功,本机是win7 SP1 企业版本


5,期间遇到win 7弹出需要激活,显示非正版,然后下载各种激活.exe还被流氓了,安装各种流氓软件,

最蛋疼的莫过于注入chrome和IE的首页默认页面,怎么修改都是无效,各种方法都试了无果

无奈下载360安全卫士,以流氓治流氓,进行杀毒玩耍和首页锁定,人家又锁定了360为首页,厉害啊。

解锁之后,恢复正常,以前浏览器内部预设的首页终于回来,卸载360,重启手动清理卸载残留,搞定!!!


系统在这里期间,尝试各种激活码,激活失败,重启无意间发现已经是激活版了,赶紧装了个卡吧死机免费版


MSDN开发指导:

content:
visual c++ build tools 2010 2013 2015 2017 
http://landinghub.visualstudio.com/visual-cpp-build-tools


Writing a servicemain function
https://docs.microsoft.com/zh-cn/windows/desktop/Services/writing-a-servicemain-function

Installing a Service
https://docs.microsoft.com/zh-cn/windows/desktop/Services/installing-a-service

detail:
Using Services
To create and control services, use the following sample code.
Service Program Tasks

Writing a Service Program's main Function
Writing a ServiceMain Function
Writing a Control Handler Function
Service Configuration Program Tasks

Installing a Service
Deleting a Service
Changing a Service's Configuration
Querying a Service's Configuration
Service Control Program Tasks

Starting a Service
Stopping a Service
Modifying the DACL for a Service
Related topics

About Services
The Complete Service Sample


MSDN示例代码:

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

#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>

#pragma comment(lib, "Gdi32.Lib")
#pragma comment(lib, "User32.Lib")
#pragma comment(lib, "Ws2_32.lib")
#pragma comment(lib, "AdvAPI32.Lib")


// Global variables

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

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

HINSTANCE hInst;

#define IDB_ONE     3301    
#define IDB_TWO     3302    

//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
    PAINTSTRUCT ps;
    HDC hdc;
    TCHAR greeting[] = _T("Hello, World!");

    switch (message) {
        
        
    case WM_CREATE:
        {
            HINSTANCE button = 0;
            CreateWindow("Button", "ButtonOne", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
                35, 100, 400, 60, hWnd, (HMENU)IDB_ONE, button, NULL);    
                  
            CreateWindow("Button", "ButtonTwo", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
                35, 180, 400, 60, hWnd, (HMENU)IDB_TWO, button, NULL);
        }
        return 0;
           
    case WM_COMMAND:
        {
            switch(LOWORD(wParam))    
            {    
            case IDB_ONE:    
                SendMessage((HWND)lParam, WM_SETTEXT, (WPARAM)NULL, (LPARAM)"OneClicked");
                break;
                  
            case IDB_TWO:
                SendMessage((HWND)lParam, WM_SETTEXT, (WPARAM)NULL, (LPARAM)"TwoClicked");    
                break;
            default:
                break;
            }    
        }    
        return 0; 
        
        
    case WM_PAINT:
        hdc = BeginPaint(hWnd, &ps);

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

        EndPaint(hWnd, &ps);
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
        break;
    }

    return 0;
}


int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow) {
    WNDCLASSEX wcex;

    wcex.cbSize         = sizeof(WNDCLASSEX);
    wcex.style          = CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc    = WndProc;
    wcex.cbClsExtra     = 0;
    wcex.cbWndExtra     = 0;
    wcex.hInstance      = hInstance;
    wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
    wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
    wcex.lpszMenuName   = NULL;
    wcex.lpszClassName  = szWindowClass;
    wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));

    if (!RegisterClassEx(&wcex)) {
        MessageBox(NULL, _T("Call to RegisterClassEx failed!"), _T("Win32 Guided Tour"), NULL);
        return 1;
    }

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

    // The parameters to CreateWindow explained:
    // szWindowClass: the name of the application
    // szTitle: the text that appears in the title bar
    // WS_OVERLAPPEDWINDOW: the type of window to create
    // CW_USEDEFAULT, CW_USEDEFAULT: initial position (x, y)
    // 500, 100: initial size (width, length)
    // NULL: the parent of this window
    // NULL: this application dows not have a menu bar
    // hInstance: the first parameter from WinMain
    // NULL: not used in this application
    HWND hWnd = CreateWindow(
        szWindowClass,
        szTitle,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT,
        800, 600,
        NULL,
        NULL,
        hInstance,
        NULL );

    if (!hWnd) {
        MessageBox(NULL, _T("Call to CreateWindow failed!"), _T("Win32 Guided Tour"), NULL);
        return 1;
    }

    // The parameters to ShowWindow explained:
    // hWnd: the value returned from CreateWindow
    // nCmdShow: the fourth parameter from WinMain
    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

    // Main message loop:
    MSG msg;
    while (GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    return (int) msg.wParam;
}


Learn_WinC_day_14.rar


发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
搜索
«   2024年9月   »
1
2345678
9101112131415
16171819202122
23242526272829
30
网站分类
最新留言
文章归档
网站收藏
友情链接
图标汇集
Powered by Z-BlogPHP

  • Copyright ©2021 @liuzong All rights reserved.
  • 陕ICP备17016542号