VC 技術小點點

2022-02-28 14:28:59 字數 3407 閱讀 8219

1、關於巨集定義

code

1//巨集定義  當巨集定義多於一行時,每行須以乙個 \ 結束,必須的。 

2//最後乙個}後那個沒有也能編譯成功。

3intmuxdebuglevel;

4#define

dbgprint(lev, fmt)\

5\11

}\2、如何控制combo box的下拉長度

<1. 首先要知道兩點:一、那就是在設計介面裡,點選一下combo box的下拉箭頭,此時出現的調整框就是combo box的下拉調整框。

<2. 屬性裡有個 no integral height 鉤選項,表示最大長度為設計長度,如果實際內容比設計長度多,就出現滾動條,少就以實際長度顯示。

3、向listbox,edit發訊息

sendmessagea(getdlgitem(hwndcontent,idc_list1),lb_addstring,(wparam)0,(lparam)"執行緒傳送訊息");

//注意:其中第二個引數:lb_addstring可以有很多種。這是新增。

setwindowtext(getdlgitem(hwndcontent,idc_edit1),tempstr);

4、建立執行緒

t_currthread = createthread(null, 0, mysendmessage,&pstrucssshmmsgack, 0, null);

5、讀ini檔案

itemscount=getprivateprofileint("codedef","num",0,config_file);

//說明:從config_file指定的檔案中取得codedef節點下num=後面的int值;

getprivateprofilestring("codedef","stationname","未定義",item_info[iposi].citemname,60-1,config_file);

//說明:從config_file指定的檔案中取得codedef節點下stationname的值給變數item_info[iposi].citemname。

6、獲取combobox選取的item的值

getwindowtext(getdlgitem(hdlg,idc_cbx_sendto),szinfo,100);

//說明:hdlg為combobox型別控制項idc_cbx_sendto的父容器。取idc_cbx_sendto的值給變數szinfo。

7、三個分別是什麼意思(lpctstr,lptstr,lpcstr)

lpctstr解析為:long pointer const tchar string。       

tchar的定義是:如果   unicode巨集被定義,它就是乙個wchar_t寬字元型別, 否則就是乙個unsigned   char無符號字元型別。   

lpctstr   就是乙個指向tchar型別的const指標,也就是代表乙個null結尾的c風格字串。   

其它的類推。lpstr==  long 的指向string的指標   

lpcstr== long 的指向const   string的指標   

lpwstr== long 的指向word   string的指標  

lpcstr:  pointer to a constant null-terminated string of 8-bit windows (ansi) characters.     

lpctstr: an lpcwstr if unicode is defined, an lpcstr otherwise.     

lpcwstr: pointer to a constant null-terminated string of 16-bit unicode characters.       

lptstr:  an  lpwstr if unicode is defined,an lpstr otherwise.     

lpstr  : pointer to a null-terminated string of 8-bit windows (ansi)  characters.       

lpwstr : pointer to a null-terminated string of 16-bit unicode characters. 

這些資料型別在多個標頭檔案中定義,以下是mapidefs.h中的定義:   

typedef   word wchar;   

#ifdef   unicode   

typedef   wchar tchar;   

#else   

typedef   char tchar;   

#endif   

typedef   wchar   far   * lpwstr;   

typedef   const   wchar   far   * lpcwstr;   

typedef   tchar   far   * lptstr;   

typedef   const   tchar   far   * lpctstr;   

typedef   byte   far   * lpbyte;   

實際上,它們都是char   或   wchar_t型別或該型別的指標:   

word   :   typedef   unsigned   short   word;   2   bytes   

lpctstr   :   typedef   const   tchar   *lpctstr;   

tchar   :   typedef   wchar_t   tchar;   2   bytes   

lptstr   :   typedef   tchar   *lptstr;   

lpcstr   :   typedef   const   char   *lpcstr;   

char   :   typedef   char   char;   1   byte   

說到底,就是1個位元組和兩個位元組的問題~也就是ansi和unicode:   

char   (1   byte)   :type char is an integral   type   that usually contains members of the execution   character set  —  in microsoft c++, this is ascii. (8-bit windows (ansi) characters)   

__wchar_t(2 bytes) :a variable of   __wchar_t   designates a wide-character or multibyte character   type.  by default, wchar_t  is a typedef for unsigned short. (16-bit unicode characters)      

資料庫小點點

0.1.oracle語法查詢 裝了oracle之後,在 oracle ora92 安裝的主目錄 jdbc lib下面的 classes12.jar 或者 classes12.zip裡面這個是9i的,還有10g 也在同樣的目錄下。比如我的10g的 f oracle product 10.2.0 db ...

js中的小點點

算術運算子 運算子是加號 算術運算子的優先順序 比較運算子 等於 不等於 絕對等於 和絕對不等於 當訪問物件的屬性時 如果該屬性不存在時,則訪問結果為 undefined 2.當訪問物件的屬性時 如果該物件不存在時,則訪問結果則會出錯。分析 1.這裡的a雖然進行了宣告,但充其量是乙個原始類性的資料,...

流技術小結

按照資料流的方向分,分為輸入流和輸出流 按照處理資料的單位來分,分為位元組流和字元流 按照功能來分,分為節點流和處理流 inputstream 位元組輸入流,實現類 fileinputstream outputstream 位元組輸出流,實現類 fileoutputstream file file ...