antares2001
asked on
How use MsPaint.exe in VB5 to open PNG picture and save it in BMP ?
Hi,
I have a VB5 project that I use for display some JPG and GIF images
FotoBrowser is an Image object on my form
I include is a part of my VB code:
...i can display my PICTURES.
The problem is that PNG pictures are not supported.
So: MsPaint.exe is able to open PNG files and save it AS BMP files.
The question is: How can I do it in VB? VB can use ms paint.exe as application, pass it a png file and have as result a bmp file?
I have a VB5 project that I use for display some JPG and GIF images
FotoBrowser is an Image object on my form
I include is a part of my VB code:
...i can display my PICTURES.
The problem is that PNG pictures are not supported.
So: MsPaint.exe is able to open PNG files and save it AS BMP files.
The question is: How can I do it in VB? VB can use ms paint.exe as application, pass it a png file and have as result a bmp file?
Dim img As Picture
fotoBrowser.Picture = Nothing
Private Sub imageLoadAdjCenter(img As Picture)
...omissis load jpg or gif file in img
End sub
fotoBrowser.Picture = img
ASKER
Ok,
but for my application, png converted in bmp is sufficient, (low level user public image viewer).
In any case I'm glad to undestood MsPaint interfacing in visual basic..... if is possible
thank
but for my application, png converted in bmp is sufficient, (low level user public image viewer).
In any case I'm glad to undestood MsPaint interfacing in visual basic..... if is possible
thank
good morning....
u can open image file using paint in vb
check this one...
Private Sub Command3_Click()
Dim myPath As String
myPath = "C:\xxx.bmp"
Debug.Print myPath
Shell "C:\WINDOWS\system32\mspai
End Sub
this snippet will show the image in mspaint...
i hope this give u and idea...
game-master
ASKER
Hi,
this is the first part of my job....
then I have to save the file opened.....
In other word, visual basic have to do:
- run MsPaint
- open "picture.png" with MsPaint
case 1
- "save as" "picture.bmp" using MsPaint
or if case1 is impossible
case 1
- select all "picture" from MsPaint
- paste "picture" in vb image control (image1.picture = "mspaint-picture)
is possible that?
regards
this is the first part of my job....
then I have to save the file opened.....
In other word, visual basic have to do:
- run MsPaint
- open "picture.png" with MsPaint
case 1
- "save as" "picture.bmp" using MsPaint
or if case1 is impossible
case 1
- select all "picture" from MsPaint
- paste "picture" in vb image control (image1.picture = "mspaint-picture)
is possible that?
regards
why to do u need to saveas the image on the paint?
if your goal is to saveas the image to the specific location,
well it think u can use the filesystemobject to copy the specific image
to your desired location..
and then showed it using the mspaint...
game-master
ASKER
Sorry,
I try to be more clear:
I have a VB application that was written time ago from a consultant. It shows BMP, JPG and GIF pictures in special mode... but PNG are not supported, because IMAGE control of VB5/6 don't support PNG.
MsPaint is able to open PNG and SAVE AS BMP 24 bit.
My goal is to made a simple modify to my VB application with a new procedure that "preload PNG by way of MsPaint (or other way), save it AS BMP and then continue my application with normal run.
I'm novice programmer, and this is a simple way... but I can't do it.
More ideas?
I try to be more clear:
I have a VB application that was written time ago from a consultant. It shows BMP, JPG and GIF pictures in special mode... but PNG are not supported, because IMAGE control of VB5/6 don't support PNG.
MsPaint is able to open PNG and SAVE AS BMP 24 bit.
My goal is to made a simple modify to my VB application with a new procedure that "preload PNG by way of MsPaint (or other way), save it AS BMP and then continue my application with normal run.
I'm novice programmer, and this is a simple way... but I can't do it.
More ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
game-master,
I 'm running on your path and my job is in progress, but not ended....
please help me to save MsPaint opened file ( complete ?????? code)
Thank you
I 'm running on your path and my job is in progress, but not ended....
please help me to save MsPaint opened file ( complete ?????? code)
Thank you
' MAIN
' Open a PNG image using MsPaint (ok)
'_______ this command is same to: Run MsPaint -> Open FIle C:\italy1.png)
call OpenPngInMsPaint()
' Save MsPaint opened picture AS BMP format
'______ (this command is same to: From running MsPaint -> Save As C:\italy1.bmp)
call SaveMsPaintOpenedFileAsBmp()
' END OF MAIN
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Private Sub OpenPngInMsPaint()
Dim myPath As String
myPath = "C:\italy1.png"
Debug.Print myPath
Shell "C:\WINDOWS\system32\mspaint.exe" & " " & myPath, vbMaximizedFocus
End Sub
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Private Sub SaveMsPaintOpenedFileAsBmp()
??????????
??????????
??????????
??????????
End Sub
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ASKER
A file png format
italy1.PNG
italy1.PNG
ASKER
The file PNG opened from MsPaint and saved as BMP (from windows - I have to do it from VB)
italy1.bmp
italy1.bmp
good afternoon...
i try this code and works fine on me...
Private Sub Command3_Click()
Dim myPath As String
myPath = "C:\italy1.PNG"
Debug.Print myPath
Shell "C:\WINDOWS\system32\mspai
Debug.Print "C:\WINDOWS\system32\mspai
'i use this code to copy the png file to my "Drive C" and saved the image as "myTest.bmp"
FileCopy myPath, "c:\myTest.bmp"
'i just used this message box to know if the program runs through my code.
MsgBox "OK"
End Sub
i hope will give u some idea..
game-master
ASKER
Sorry!
Your code create a file xxx.bmp ... but this is a png file.
italy1.png size 21kb - header 0PNG.......
xxx.bmp size 21kb - header 0PNG.......
If I do it fro ms paint with command SAVE AS BMP I have this:
italy1.bmp size 262kb - header BMî.........
Your code create a file xxx.bmp ... but this is a png file.
italy1.png size 21kb - header 0PNG.......
xxx.bmp size 21kb - header 0PNG.......
If I do it fro ms paint with command SAVE AS BMP I have this:
italy1.bmp size 262kb - header BMî.........
yes...
i been working for your question...
i am also new to that instance...
lets both work it out...
game-master
ASKER
Hi all
more info?
more info?
good morning...
i'm sorry...
i was out on the office for how many days..
i heard u can use the api function "shellexecute"
here is the declaration..
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'this is a sample way to use it..
sub <your procedure name for example>
ShellExecute Me.hwnd, vbNullString, "mailto:KPDTeam@Allapi.net
end sud
ASKER
Hi,
I'm in confusion... ;-()
Are you rure that this sample "make" SAVE AS BMP from MsPaint?
I'm in confusion... ;-()
Are you rure that this sample "make" SAVE AS BMP from MsPaint?
what i am imposing on my posted comment is that,
that is how to use the shellexecute...but that is not the
code to save a bitmap...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry, nobody answer my question:
How use MsPaint.exe in VB5 to open PNG picture and save it in BMP ?
How use MsPaint.exe in VB5 to open PNG picture and save it in BMP ?
You could use GDI+ to load a PNG and then convert to StdPicture but this won't work on Win98 without installing GDI+ on that Platform. aicAlphaImage control works on Win98 without the need to install GDI+.