
作者共發了21篇帖子。
![]() |
窗口佈局:
![]() |
![]() |
Ctrl + D鍵設置的Tab鍵訪問順序:
![]() 一定要把第一個文本框的號碼設為比其他TAB可切換控件的號碼小,這樣程序啟動後光標才能默認落在第一個文本框中。 |
![]() |
最後一個文本框的Read Only(只讀)要設置為True:
![]() |
![]() |
![]() 這是給文本框綁定變量的方法。 |
![]() |
![]() Category要選擇Value類型,變量類型為CString,變量名為mString1。 窗口上其他的文本框類似。 設置後程序中就可以直接讀取文本框中的內容了。 UpdateData();是把文本框中的內容更新到變量中。 UpdateData(false);是把變量中的內容顯示到文本框中。 |
![]() |
![]() 程序屬性值 |
![]() |
![]() |
![]() |
|
![]() |
可以用C語言庫函數把insert函數改寫成更簡單且更容易理解的版本:
#include <stdio.h> #include <stdlib.h> #include <string.h> void insert(char *s1, const char *s2) { int len1 = strlen(s1); int len2 = strlen(s2); int pos; char *ch = strchr(s1, *s2); if (ch == NULL) // when not found memcpy(s1 + len1, s2, len2 + 1); // including '\0' at the end else { pos = *ch - *s1; memmove(ch + len2 - 1, ch, len1 - pos + 1); // including '\0' at the end memcpy(ch, s2, len2); } } int main(int argc, char *argv[]) { char str[50] = "abcdefgh"; char s2[5] = "d45"; insert(str, s2); puts(str); strcpy(str, "abcdef"); strcpy(s2, "45"); insert(str, s2); puts(str); strcpy(str, "definition"); strcpy(s2, "desk"); insert(str, s2); puts(str); return 0; } |
![]() |
回復20樓 @巨大八爪鱼 的內容:可以用C語言庫函數把insert函數改寫成更簡單且更容易理解的版本:
#include <stdio.h> #include <stdlib.h> #incl... #include <stdlib.h>
這句話可以不要 |