有谁知道如何获得该文本(“是”,“否”,“取消”等)?解决方法 感谢您使用Snarfblam链接的答案,我可以弄清楚其余部分.
class Program {[Dllimport("user32.dll",CharSet = CharSet.auto)]static extern int LoadString(IntPtr hInstance,uint uID,StringBuilder lpBuffer,int nBufferMax);[Dllimport("kernel32")]static extern IntPtr Loadlibrary(string lpfilename);private const uint OK_CAPTION = 800;private const uint CANCEL_CAPTION = 801;private const uint ABORT_CAPTION = 802;private const uint RETRY_CAPTION = 803;private const uint IGnorE_CAPTION = 804;private const uint YES_CAPTION = 805;private const uint NO_CAPTION = 806;private const uint CLOSE_CAPTION = 807;private const uint HELP_CAPTION = 808;private const uint TRYAGAIN_CAPTION = 809;private const uint CONTINUE_CAPTION = 810;static voID Main(string[] args) { StringBuilder sb = new StringBuilder(256); IntPtr user32 = Loadlibrary(Environment.SystemDirectory + "\User32.dll"); LoadString(user32,OK_CAPTION,sb,sb.Capacity); string ok = sb.ToString(); LoadString(user32,CANCEL_CAPTION,sb.Capacity); string cancel = sb.ToString(); LoadString(user32,ABORT_CAPTION,sb.Capacity); string abort = sb.ToString(); LoadString(user32,RETRY_CAPTION,sb.Capacity); string retry = sb.ToString(); LoadString(user32,IGnorE_CAPTION,sb.Capacity); string ignore = sb.ToString(); LoadString(user32,YES_CAPTION,sb.Capacity); string yes = sb.ToString(); LoadString(user32,NO_CAPTION,sb.Capacity); string no = sb.ToString(); LoadString(user32,CLOSE_CAPTION,sb.Capacity); string close = sb.ToString(); LoadString(user32,HELP_CAPTION,sb.Capacity); string help = sb.ToString(); LoadString(user32,TRYAGAIN_CAPTION,sb.Capacity); string tryAgain = sb.ToString(); LoadString(user32,CONTINUE_CAPTION,sb.Capacity); string cont = sb.ToString();}总结
以上是内存溢出为你收集整理的c# – 如何获取MessageBox按钮标题?全部内容,希望文章能够帮你解决c# – 如何获取MessageBox按钮标题?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)