2020年6月18日 星期四

[BCB]messagebox


AnsiString str = BoolToStr( o_chkTXT->Checked );
Application->MessageBox(s.c_str(), "Test", 32+3);

 char* c_str()

 AnsiString str = "Hello World!";
  MessageBox(NULL,str.c_str(),"",MB_OK);   //顯示一個消息框

2020年4月9日 星期四

git常用指令

git 指令筆記

git clone + clone網址


git fetch
git pull origin


git status

git diff
(關閉案q)


git add --all
git commit
    enter + i
    編輯完畢後 esc + wq


git push origin head

(edit commit)-----

git commit --amend
git push -f


2019年11月25日 星期一

[工具]Visual studio 初始化 (回到初始設定)

在windows中找到安裝目錄"Visual Studio Tools"下的 "vs2xxx開發人員命令"

並輸入以下 注意空白鍵
devenv.exe /setup /resetuserdata /resetsettings

2019年10月22日 星期二

[C++]MFC按鈕添加提示文字

宣告在 *.h
CToolTipCtrl m_ctrlTT;

定義內容: *.cpp
BOOL SerialDlg::OnInitDialog() 
{
        ......
 //prompt
 EnableToolTips(TRUE);//enable use it
 m_ctrlTT.Create(this);
 m_ctrlTT.Activate(TRUE);
 m_ctrlTT.SetDelayTime(150);//delayTime
 //IDC_BUTTON_SEND2 為要添加的控建IDC ,"Hello"為想添加的提示
 m_ctrlTT.AddTool(GetDlgItem(IDC_BUTTON_SEND2), (LPCTSTR)"Hello");

 return TRUE;  
}

添加虛擬函示(ClassWizard中選擇虛擬函式 PreTranslateMessage)

BOOL SerialDlg::PreTranslateMessage(MSG* pMsg)
{
 // TODO: 在此加入特定的程式碼和 (或) 呼叫基底類別
 m_ctrlTT.RelayEvent(pMsg);
 return CDialog::PreTranslateMessage(pMsg);
}


測試環境 MFC VC2015

2019年9月1日 星期日

[C++]獲取系統ip

#include"stdio.h"
#include"string.h"
#include"Winsock2.h"
#pragma comment(lib,"WS2_32.lib")

printf("********************************\n");
 printf("IP OUTPUT\n");
 WSADATA wsaData;
 if (WSAStartup(MAKEWORD(2, 2), &wsaData) == SOCKET_ERROR)
 {
  exit(0);
 }
 int nLen = 256;
 char hostname[20];
 gethostname(hostname, nLen);
 hostent *pHost = gethostbyname(hostname);
 LPSTR lpAddr = pHost->h_addr_list[0];
 struct in_addr inAddr;
 memmove(&inAddr, lpAddr, 4);
 printf("有線IP地址:%s\n", inet_ntoa(inAddr));
 memmove(&inAddr, lpAddr + 4, 4);
 printf("無線IP地址:%s\n", inet_ntoa(inAddr));
 memmove(&inAddr, lpAddr + 8, 4);
 printf("環回IP地址:%s\n", inet_ntoa(inAddr));
 memmove(&inAddr, lpAddr + 12, 4);
 printf("虛擬機1 IP地址:%s\n", inet_ntoa(inAddr));
 memmove(&inAddr, lpAddr + 16, 4);
 printf("虛擬機2 IP地址:%s\n", inet_ntoa(inAddr));
 
printf("********************************\n");

可先參考 cmd  輸入ipconfig  確認ip


測試環境 :MFC 2015

[C++]隱藏游標 鼠標 光標

::ShowCursor(true);//顯示滑鼠

如果要 不顯示則

::ShowCursor(false);//不顯示滑鼠






測試環境:MFC 2015

[Windows]註冊密技,快捷指令

提供以下步驟,可以快速知道Windows的註冊狀況 與 註冊

打開cmd : (右鍵 "最高權限")

查詢windows註冊:

slmgr.vbs -xpr



===============================================


步驟1.解除windows註冊:
slmgr.vbs /upk


步驟2.輸入版本註冊序號:
專業版ex: (slmgr /ipk ______)
slmgr /ipk VK7JG-NPHTM-C97JM-9MPGT-3V66T



專業版:VK7JG-NPHTM-C97JM-9MPGT-3V66T

企業版:XGVPP-NMH47-7TTHJ-W3FW7-8HV2C

教育版:YNMGQ-8RYV3-4PGQ3-C8XTP-7CFBY

專業版N:2B87N-8KFHP-DKV6R-Y2C8J-PKCKT

企業版N:WGGHN-J84D6-QYCPR-T7PJ7-X766F

教育版N:84NGF-MHBT6-FXBX8-QWJK7-DRR8H

企業版S:FWN7H-PF93Q-4GGP8-M8RF3-MDWWW



步驟3.修改狀態:
slmgr /skms zh.us.to

步驟4.確認註冊:
slmgr /ato

==============================================

測試環境 win10 pro



引用來源

[SQL]顯示千分位與小數顯示

  CONVERT ( data_type [ ( length ) ] , expression [ , style ] ) CONVERT style參數說明 1  (expression為 money 或 smallmoney型別): 0 : 預設,保留小數位後兩位,並四捨...