|
This might be a better way. Ignore the bits about saving it to the database. It converts a file to a Byte Array. I am currently saving pictures to a database in this way. It works great.
http://support.microsoft.com/kb/316887[^]
Shawn
|
|
|
|
|
Thanks for ur reply....
Actually i just know the code from BitMapToString, but i dont know how to use this to convert it from FileToString...
So, any suggestion for this function....
Public Function BitmapToString(ByVal sImagePath As String) As String
Try
Dim data As String
Dim ms As MemoryStream = New MemoryStream
Dim bmp As Bitmap = New Bitmap(sImagePath)
' Save as PNG format (IMHO, much better!
// )
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png)
data = Convert.ToBase64String(ms.ToArray())
Return data
Catch ex As Exception
Return String.Empty
End Try
End Function
|
|
|
|
|
You might want to try some of the code I have in a project I posted on this board about 2 weeks ago. It is using a MySql file but I think the streamreader code might work.
http://www.codeproject.com/useritems/WavfilesInDatabases.asp
Dim b() As Byte
Try
b = DBSelectCmd.ExecuteScalar()
Dim K As Long
K = UBound(b)
Dim WriteFs As New FileStream(strOutFile, FileMode.Create, FileAccess.Write)
WriteFs.Write(b, 0, K)
WriteFs.Close()
MessageBox.Show("Wav file has been retrieved and written to application folder")
Catch oExcept As Exception
MessageBox.Show(oExcept.Message)
End Try
If this doesn't work, I found some other similar code in MSDN that I think might work but I don't have it on this computer and I will have to wait until Monday to get it from my work computer.
Let me know if this either does or doesn't work.
|
|
|
|
|
hai.. thanks for ur reply...
Actually, i do many testing in filestream, but the results are just can convert the file(.txt file) to string.
my friend told to me that this is can't to convert the (.exe file) to string.
Is true?
|
|
|
|
|
See if this code might work. I don't know if you can "rebuild" data from a table back into a .exe, but I don't know of any reason why you shouldn't. If you FTP a file it is basically being "read" in binary, sent as a binary stream of data and then basically rebuild on the receiving end.
Anyway check this out.
Do While fdRead.Read()
'strTmp = fdRead.GetString(0)
strProgramFile = fdRead.GetString(0)
strOtherData = fdRead.GetString(1)
strOtherData2 = fdRead.GetString(2)
' Create a file to hold the output.
strFileOut = "progrname.exe" 'Me.TextBox2.Text & ".wav"
fs = New FileStream(strFileOut, FileMode.OpenOrCreate, FileAccess.Write)
bw = New BinaryWriter(fs)
startIndex = 0
' Read bytes into outbyte() and retain the number of bytes returned.
retval = fdRead.GetBytes(1, startIndex, outbyte, 0, bufferSize)
' Continue reading and writing while there are bytes beyond the size of the buffer.
Do While retval = bufferSize
bw.Write(outbyte)
bw.Flush()
' Reposition the start index to the end of the last buffer and fill the buffer.
startIndex += bufferSize
retval = fdRead.GetBytes(1, startIndex, outbyte, 0, bufferSize)
Loop
' Write the remaining buffer.
Try
bw.Write(outbyte, 0, retval - 1)
Catch
End Try
bw.Flush()
' Close the output file.
bw.Close()
fs.Close()
Loop
fdRead.Close()
Let me know if this works or not.
|
|
|
|
|
hai,
i have set my program as a .msi window installed file, when i type
the following command in command prompt
msiexec /i xxxxxxx.msi /qn
the .msi file will ran in silent install mode.
So, the problem is i want to start the silent install mode without manually
key in the command like above one.
how to when we start install and then will auto run silent install command....
Thanks....;P
|
|
|
|
|
You must use the command line parameters to get the silent mode install. You can either do this from a .CMD batch file or shell launch the command from another program you create for the purpose, such as your own Setup.EXE.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello ,
I am writing an application that gets a password and a user name from the user I need to send these information to a web site to check wheter these information is correct or not then the web site should respond to my application with the result.
How can I send these information to the web site and how can I get the result from it.
|
|
|
|
|
Hello Mohsen,
your question is way general. as we don't know are you using web services or simple aspx mechanism. or is your application a windows app that refrences a web service.
I suggest you try the TaskVision sample from the MSDN or download it from http://www.windowsforms.com/[^].
It should give you a great insight on how to use webservices to get what you want done.
Cheers
It is Illogical to define an inventor by his invention
|
|
|
|
|
Hi, got a problem that no search seems to help with. I have a PictureBox control (VB.NET) on a form (181*136 in size) in which I am loading selected pictures from an OpenFileDialog.
The majority of the pictures are going to be the average 3*4 aspect ratio but there are going to be some that are either longer or taller than this.
The Stretch Property is great in the fact that it sizes down the pictures to fit, but the ones that are not to the 3*4 aspect ratio are too stretched.
How can I keep the aspect ratio of a picture and at the same time get it to fit into the PictureBox control?
Many thanks for the help.
Shawn
|
|
|
|
|
Hi, I need to build an application in VB.Net which select the font from one folder in windows exploere and install it to the font directory. I have an idea but I don't know how to start from it. Can any one give me the clue on how to do that???
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
This is some code I found on the internet and it worked fine for me.
Module Main
#Region "InstallFont"
Declare Function WriteProfileString Lib "kernel32" Alias "WriteProfileStringA" _
(ByVal lpszSection As String, ByVal lpszKeyName As String, _
ByVal lpszString As String) As Integer
Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _
ByVal lParam As Integer) As Integer
Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" _
(ByVal lpFileName As String) As Integer
Const WM_FONTCHANGE As Integer = &H1D
Const HWND_BROADCAST As Integer = &HFFFF
Private Function InstallFontIfNeeded() As Boolean
'
' Check for font
'
Dim bFound As Boolean
For Each ff As FontFamily In FontFamily.Families
If ff.Name = "barcoding" Then bFound = True
Next
If Not bFound Then
' If bFound Then
Dim intReturn As Integer
'
' Copy font to fonts folder
'
Dim fi As New System.IO.FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location)
Dim strWindows As String = Environment.GetEnvironmentVariable("WINDIR")
Dim strPath As String = String.Format("{0}\barcoding.ttf", fi.DirectoryName)
Dim strFont As String = String.Format("{0}\Fonts\barcoding.ttf", strWindows)
System.IO.File.Copy(strPath, strFont, True)
'
'Add font
'
intReturn = AddFontResource(strFont)
Trace.WriteLine(String.Format("Add Font {0}", intReturn))
'
' Tell operating system font installed
'
SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
'
' Store the new font settings
'
intReturn = WriteProfileString("fonts", "Barcoding (TrueType)", "barcoding.ttf")
Trace.WriteLine(String.Format("Write profile {0}", intReturn))
End If
Return bFound
End Function
#End Region
Public Sub main()
If InstallFontIfNeeded() Then
Application.Run(New Form1)
Else
Process.Start("barcode.exe")
End If
End Sub
End Module
Let me know if it works for you or not.
|
|
|
|
|
Thank you very much for your comment. I will try to do it and let you know if it is working or not.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
I am working on a project EL-SOL Solar Energy Project to control the application panel by Stepper Motor through Parallel Port on my PC using Visual Basic 6.0.
Please help me to move the motor forwared reverse and angular direction.
How it can be possible.
Shaikh Zia Ullah alias SHAIKHOO
|
|
|
|
|
Shaikhoo wrote:
Please help me to move the motor forwared reverse and angular direction.
Moving the motor is a very hardware specific issue, with little to do with VB. You'll have much better luck if you search Yahoo or Google for specific projects. Try searching for "VB6 stepper motor parallel".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
may be your question was unclear.
did you mean how to work with parallel port in vb?
or how to move the motor?
if you want to work with parallel port? so I can help you...
please reply or contact me on my email.
OmarMallat
|
|
|
|
|
OmarMallat wrote:
may be your question was unclear
That's because I DIDN'T ASK ONE!
I know exactly what he's talking about. It can be done, but Code Project is not the proper forum for such a project. There are pitfalls that must be considered outside the real of programming, such as current draw that could exceed the limits of the port supplying the power...
Next time, check the message that your replying to. This is the second time you've posted an answer to the wrong person. Now, because you replied to my post, the person that is actually looking for an answer will NOT get an email stating that you replied to HIS POST.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm so sorry, this is the first time I use this forum. the 2 reply I wrote, was at the same time. I didn't know that the I should reply to the first person who ask the question.
also i'm so sorry.
please don't be angree
OmarMallat
|
|
|
|
|
I have to move stepper motor in all direction through my PC which is connected through the parallel port. And I have to do it by using VB6
Zia Ullah
|
|
|
|
|
I need to move stepper motor through parallel port attached to my PC in VB6 application.
|
|
|
|
|
hello,
is it possibile to make a peer to peer application on pocket pc? if yes, is there any useful links or code?
Thanks in Advance
Mahmoud Manasrah
|
|
|
|
|
Youe question really belongs in the Embedded/Mobile Forum[^]. The .NET Compact Framework doesn't have the full support of the full framework and those issues are better handled in the other forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi dears,
i want to write a program which can add a button in the toolbar of ms outlook. can someone help me to accomplish this task. can i do this in vb6. i shall be very thankful.
|
|
|
|
|
I would like to develop a a full screen application in Pocket PC. The meaning of "full screen" is the app. will cover the whole physical screen including "Start" button of Windows in PPC.
Sorry, i 'm new to PPC programming. I saw a PPC application in market. Once the PPC is switch on, it will open the app. directly with full screen. Then the user are not able go to windows but only the program itself. The 4 shortcut button is dedicated for the functions of the application.
Thus, the users are no chance to access windows setting, other programs and so on.
they called it as KIOSK mode...is there any sample code inteads of buying "Spb Kiosk Engine".
I tried to search in google but most of the website introduce "Spb Kiosk Engine".
Any API or Library for VB.net for KIOSK?
Thanks for help.
|
|
|
|
|
Your question really has nothing to do with VB.NET, or any other language for that matter. What your asking is specific to the Pocket PC platform, and therefore really belongs in the Embedded/Mobile Forum[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|