zoukankan      html  css  js  c++  java
  • Tools

     1. DebugView,输出调试信息(不能F5,而是要Ctrl + F5,F5输出到VC的debug窗口)

     1 void DbgPrint(char* pFMT, ...)
     2 {
     3     char szBuf[1024] = {0};
     4     va_list lst;
     5     va_start(lst, pFMT);
     6     vsprintf(szBuf, pFMT, lst);
     7     va_end(lst);
     8     
     9     OutputDebugString(szBuf);
    10 }

     2. C语言,拼接字符串

     1 //使用后要free
     2 char* split(char* a, char* b) 
     3 {  
     4     char* c = (char*)malloc(strlen(a) + strlen(b) + 1);
     5     if (c == NULL) 
     6     {
     7         return NULL;
     8     }
     9     
    10     char* tempc = c;
    11     while (*a != '') 
    12     {  
    13         *tempc++ = *a++;  
    14     }  
    15     while ((*tempc++ = *b++) != '');
    16     
    17     return c;
    18 }

     3. 响应 WM_DROPFILES 消息(#define WM_DROPFILES 0x0233)

    1)MFC版

     1 void CTestDlg::OnDropFiles(HDROP hDropInfo) 
     2 {
     3     char szPath[MAX_PATH] = {0};
     4     
     5     DragQueryFile(hDropInfo, NULL, szPath, sizeof(szPath) / sizeof(*szPath));
     6     DragFinish(hDropInfo);
     7     
     8     SetDlgItemText(IDC_EDT_PATH, szPath);
     9 
    10     CDialog::OnDropFiles(hDropInfo);
    11 }

     2)SDK版

     1 case WM_DROPFILES:
     2 {
     3     char szPath[MAX_PATH] = {0};
     4 
     5     DragQueryFileA((HDROP)wParam, NULL, szPath, sizeof(szPath) / sizeof(*szPath));
     6     DragFinish((HDROP)wParam);
     7 
     8     HWND hEdit = GetDlgItem(hwnd, IDC_EDT_PATH);
     9     SetWindowTextA(hEdit, szPath);
    10     
    11     break;
    12 }
  • 相关阅读:
    8常用控件
    7对话框
    6控件
    5Lambda表达式
    4自定义信号和槽函数
    3信号与槽
    2指定父对象
    springboot整合activemq
    springboot整合springtask
    jvm与tomcat启动优化配置
  • 原文地址:https://www.cnblogs.com/luzhiyuan/p/4361889.html
Copyright © 2011-2022 走看看