本文介绍了使用c ++中的资源文件名更改保存对话框中的过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Private Sub Button1_Click ( ByVal sender As System 。 Object , ByVal e As System 。 EventArgs ) 句柄 Button1 。 单击
Dim pathname As String
Dim saveFileDialog1 As New SaveFileDialog ()
saveFileDialog1 。 Filter = " txt files(* .txt)| * .txt |所有文件(*。*)| *。*"
saveFileDialog1 。 FilterIndex = 2
saveFileDialog1 。 RestoreDirectory = True
如果 saveFileDialog1 。 ShowDialog () = DialogResult 。 确定 然后
PathName = saveFileDialog1 。 FileName
Dim b () As 字节 = 我的 。 Resources 。 Universe
系统 。 IO 。 文件 。 WriteAllBytes ( pathname , b )
End 如果
End Sub
此代码适用于vb,因此任何人都可以在c ++中更改我的代码
或如有任何疑问,请查看 此
感谢
解决方案
此代码适用于vb,因此任何人都可以在c ++中更改我的代码
或请参阅此以解决任何问题此
这是一个很好的例子,说明如何使用
C / C ++中的GetSaveFileName :
http://msdn.microsoft.com/en-us/library/windows/desktop/dd183519(v = vs.85).aspx
这里是第二个:
http://www.daniweb.com/software-development/cpp/code/217307/a-simple-getopenfilename-example
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pathname As String
Dim saveFileDialog1 As New SaveFileDialog()
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
saveFileDialog1.FilterIndex = 2
saveFileDialog1.RestoreDirectory = True
If saveFileDialog1.ShowDialog() = DialogResult.OK Then
PathName = saveFileDialog1.FileName
Dim b() As Byte = My.Resources.Universe
System.IO.File.WriteAllBytes(pathname, b)
End If
End Sub
this code works for vb so anyone could change that code for me in c++
or see this for any questions also this
thanks
解决方案
this code works for vb so anyone could change that code for me in c++
or see this for any questions also this
Here is a nice example on how to use
GetSaveFileName in C/C++:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd183519(v=vs.85).aspx
Here a 2nd one:
http://www.daniweb.com/software-development/cpp/code/217307/a-simple-getopenfilename-example
这篇关于使用c ++中的资源文件名更改保存对话框中的过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!