GetLastError()获取未知错误(Getting Unknown Error By GetLastError())

   IT问题网   2021-01-24 00:00:00

问 题

嗨,

我使用以下函数来查找错误:

 {
dword err = getlasterror() ;

lpvoid lpmsgbuf;

formatmessage(
format_message_allocate_buffer |
format_message_from_system |
format_message_ignore_inserts,
null,
getlasterror(),
makelangid(lang_neutral, sublang_default), // 默认语言
(lptstr)amp; lpmsgbuf,
0
null
);
messagebox(null,(lpctstr)lpmsgbuf,f2,mb_ok | mb_iconinformation);


// 释放缓冲区。
localfree(lpmsgbuf);
}


我收到以下错误:

http://fxturn.com/error/error.jpg[ ^ ]



这个错误是什么意思?

问候,

解决方案

在formatmessage的参数中,您再次调用getlasterror。这不会给你一个关于你的错误值的消息,错误。它很可能会让你感到奇怪,因为在调用formatmessage之前你已经调用了getlasterror。 :)



[编辑]

 formatmessage(
format_message_allocate_buffer |
format_message_from_system |
format_message_ignore_inserts,
null,
err,
makelangid(lang_neutral,sublang_default),//默认语言
(lptstr)amp; lpmsgbuf,
0,
null
);


您可能需要传入要为其发送消息的实际错误值。 :)

嗨,

我曾经使用过一次,但我又遇到了同样的错误。

问候,

嗨,

我也做了同样的错误但同样的错误。

问候,

标签:获取获得未知错误过错毛病谬误



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

在MS Word 2007中禁用对话框(Disabling dialog in MS Word 2007)

problem hi, when wpd(word perfect document) ...

移动SQL Server Bak文件时出错(Error in moving SQL Server Bak file)

problem hi, i have created a backup file programmaticaly ...

如何制作待办事项清单?(How to make a To-Do list )

problem i am a beginner at vb.net and am usin ...

在asp.net网站上的sqlite as beckend(sqlite as beckend in asp.net website)

problem hello, we can embade sqlite as beckend and it wo ...

如何使用datagridview插入,更新数据到sql server中的表?(How to insert,update data to table in sql server using datagridview)

problem hi all visitors i have 1 table(salesdetail) in sq ...

如何从GetDate获取时间()(How to get only Time from GetDate())

problem how to get only time from getdate(). format is hh ...

使用Windows服务时出现问题(A problem in working with windows service)

problem hi, i have created a windows service ...

Windows窗体应用程序中跟踪栏的代码(code for trackbar in windows form application)

problem hi, there is a trackbar in my window ...

Prism女士和域名服务银光(Ms Prism and Domain services with silverlight)

problem hi, how can i work with microsoft pri ...

使用Python访问我的.dll文件(Access my .dll file using Python)

problem i am currently planning to access my mfc dialog b ...

从另一个Windows服务调用Windows服务(Call windows service from another windows service)

problem is it possible to call windows service from anoth ...

创建会计程序(creating accounting program)

problem hi all, can any one guide me how to creat acco ...

c sharp regex替换任何单词的第一个或最后一个字符(c sharp regex replace first or last character of any word)

problem want to remove first and last charact ...

用于检查字符串数组是否为空的代码(Code for checking whether string array is empty or not)

problem hi, please send me the code for checking whether ...

消息在try catch块中不起作用(Message is not working in try catch block)

problem showing a modal dialog box or form wh ...

循环如何从开始日期算起5天(How loop to count for 5 days from the start date)

problem hi i have a starting date, now i nee ...

如何绑定diffirent windows窗体中使用的相同用户控件组合框的两个数据源(how to bind two data sources for same user control combo box used in diffirent windows forms)

problem lt;pre lang="c#"gt;lt;/pregt; i want to bind two ...

是他们的任何querybuilder工具(Is Their any querybuilder tool)

problem i want to know that is dere any gui q ...

我希望从gridview获得一个链接来搜索报告页面(i want to have a link from a gridview that will search a report page)

problem can someone help me i want to search fromgridview ...

存储文本框值时无法获得正确的输出(not getting correct output when storing textbox values)

problem i keep getting the output in messagebox as ''0'' ...