what's the error msg?

解决方案 »

  1.   

    My need:  Interval=1000 but Result: interval is nothing !
      

  2.   

    感谢您使用微软产品。
     
    在MSDN中,GetPrivateProfileString函数的原型如下:
    DWORD GetPrivateProfileString(
      LPCTSTR lpAppName,        // section name
      LPCTSTR lpKeyName,        // key name
      LPCTSTR lpDefault,        // default string
      LPTSTR lpReturnedString,  // destination buffer
      DWORD nSize,              // size of destination buffer
      LPCTSTR lpFileName        // initialization file name
    );
    其中返回值及参数nSize的类型都为DWORD,为32位的无符号整数。而在C#中,long表示64位符号整数,uint表示32位无符号整数。因此在您的程序中的long都必须改为uint,程序才会运行正常。如下所示:[DllImport("kernel32.dll")]
    public static extern uint GetPrivateProfileString(
    string lpAppName,        // section name
    string lpKeyName,        // key name
    string lpDefault,        // default string
    StringBuilder lpReturnedString,  // destination buffer
    uint nSize,              // size of destination buffer
    string lpFileName   // initialization file name
    ); 
    - 微软全球技术中心 VC技术支持
     
    本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款
    (http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
    为了为您创建更好的讨论环境,请参加我们的用户满意度调查
    (http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。