最近發生一件事情,用VisualStudio 2017開發windows form應用程式,
 
在windows 11環境下執行時會自動閃退,
 

me1237guy 發表在 痞客邦 留言(0) 人氣()

image
點選新增SQL Server獨立安裝可以指定具名, 或是直接採用預設執行個體參考資料1. Microsoft® SQL Server® 2014 Express

me1237guy 發表在 痞客邦 留言(0) 人氣()

image
Visual Studio 2015 新增了許多功能, 以下為支援開發Win10 通用視窗App的語言1. C# 與 XAML(Extensible Application Markup Language)2. VB與 XAML3. C++與 XAML4. Javascript與HTML5在所有語言中, Visual Studio 都可以結合Blend用於設計精美的使用者介面(UI),依照自己熟悉的語言進行開發^_^(1) 程式進入點(Entry points)C#程式進入點會是在App.xmal.cs寫在OnLaunched事件  

me1237guy 發表在 痞客邦 留言(0) 人氣()

image
Common Tool for Visual C++ 2015Win 8.1 SDK and Universal CRT SDKOops,  it requires up to 3 GB for update!

me1237guy 發表在 痞客邦 留言(0) 人氣()

image
先確認有安裝IIS
新增移除程式->開啟或關閉Windows功能

勾選Internet Information Services

me1237guy 發表在 痞客邦 留言(0) 人氣()

image
Download Microsoft XNA Game Studio 4.0 ============================================================================Microsoft® Surface® 2.0 SDK and Runtime

me1237guy 發表在 痞客邦 留言(0) 人氣()

image
在之前Visual Studio 2010, 可以找到Windows Form應用程式

但是, 在新版Visual Stuio 2012竟然找不到!
在Visual Studio 2012 選擇CLR Empty Project

me1237guy 發表在 痞客邦 留言(0) 人氣()

image
專案設定Common Language Runtime Support預設值為No Common Language Runtime Support改選擇支援Common Language Runtime(/clr)設定clr完成後編輯程式才會自動出現對應的提示字,否則會不認得namespace System及System::IO
 1: // WriteFileDemo4.cpp : Defines the entry point for the console application.
 2: //
 3:  
 4: #include "stdafx.h"
 5: using namespace System;
 6: using namespace System::IO;
 7:  
 8: int _tmain(int argc, _TCHAR* argv[])
 9: {
 10: // 寫入檔案
 11: String^ path = "test.txt";
 12: StreamWriter^ sw = File::CreateText(path);
 13: String^ line = "我要寫入4";
 14: sw->WriteLine(line);
 15: sw->Close();
 16:  
 17: // 讀取檔案
 18: StreamReader^ sr = File::OpenText(path);
 19: String^ s = "";
 20: if( s = sr->ReadLine())
 21: {
 22: Console::WriteLine( s );
 23: }
 24: Console::ReadLine();
 25: return 0;
 26: }

me1237guy 發表在 痞客邦 留言(0) 人氣()

image
CRT(C執行時期函式庫)在編譯前須先設定preprocessor, 加入_CRT_SECURE_NO_WARNINGSCRT安全版: 增加參數驗證, 緩衝區大小檢查, 格式化參數驗證功能寫入fprintf_s讀取fscanf_s
 1: #include "stdafx.h"
 2: #include <cstdio>
 3: #include <iostream>
 4:  
 5: int _tmain(int argc, _TCHAR* argv[])
 6: {
 7: // 寫入檔案
 8: char msg[] = "我要寫入3";
 9: FILE *fp;
 10: printf_s("寫入檔案:\n%s\r\n", msg);
 11: fopen_s(&fp, "test.txt", "w");
 12: fprintf_s(fp, "%s\n", msg);
 13: fclose(fp);
 14:  
 15: // 讀取檔案
 16: fopen_s(&fp, "test.txt","r");
 17: char line[256];
 18: fscanf_s(fp, "%s", line, 256);
 19: printf_s("讀取檔案: \n%s\r\n", line);
 20: fclose(fp);
 21: system("pause");
 22: return 0;
 23: }
 24:  

me1237guy 發表在 痞客邦 留言(0) 人氣()

利用ofstream寫入檔案, ifstream讀入檔案
很明顯用標準函式庫比上一篇(Windows API WriteFile and ReadFile)使用Windows API語法簡單易懂多了!!!

me1237guy 發表在 痞客邦 留言(0) 人氣()

使用WindowsAPI進行WriteFile 和 ReadFile應用程式  ---> Windows API –—> Windows 作業系統
 1: #include "stdafx.h"
 2: #include <Windows.h>
 3: #include <iostream>
 4:  
 5: using namespace std;
 6:  
 7: int _tmain(int argc, _TCHAR* argv[])
 8: {
 9: // 寫入檔案
 10: HANDLE hFile;
 11: DWORD nBytes;
 12: hFile = CreateFile( _T("test.txt"), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
 13: char msg[] = "我要寫入1";
 14: if( hFile != INVALID_HANDLE_VALUE)
 15: {
 16: WriteFile(hFile, msg, sizeof(msg)-1, &nBytes, NULL);
 17: CloseHandle(hFile);
 18: cout << "寫入內容: " << msg << endl; 
 19: 
 20: cout << "寫入 " << nBytes << " Bytes" << endl;
 21: system("pause");
 22: }
 23: //-------------------------------------------------
 24: // 讀取檔案
 25: hFile = CreateFile( _T("test.txt"), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL);
 26: if(hFile != INVALID_HANDLE_VALUE )
 27: {
 28: char line[256] = {0};
 29: BOOL bResult;
 30: bResult = ReadFile(hFile, line, sizeof(line), &nBytes, NULL);
 31: if(nBytes!=0)
 32: {
 33: cout << "讀入內容: " << endl;
 34: cout << line << endl;
 35: }
 36: CloseHandle(hFile);
 37: system("pause");
 38: }
 39: return 0;
 40: }

me1237guy 發表在 痞客邦 留言(0) 人氣()

image
工具->選項->文字編輯器->所有語言->勾選<行號>

設定字體

me1237guy 發表在 痞客邦 留言(0) 人氣()

1 2 3 4
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。