|
-
Oct 20th, 2000, 04:20 PM
#1
Thread Starter
New Member
PLEASE HELP ME OR WRITE ME HOW CAN I SOLVE MY 3 QUESTIONS!!!
1) HOW CAN I SAVE THE SCREEN IMAGE,NOT ONLY THE WALLPAPER BUT ALL I CAN SEE ON MONITOR,ON A JPG FILE???
2) HOW CAN I CONVERT/SAVE A BMP FILE IN JPG WITHOUT ANY EXTERNAL OBJECTS OF VB???
3) HOW CAN I PUT AN IMAGE ON WINDOWS WALLPAPER???
HELP ME THANKS
-
Oct 20th, 2000, 06:22 PM
#2
Addicted Member
A vague answer for number 1!
If you want to print out what's on the screen, use the print screen key on the keyboard. If you want to do this in a program, just find the code that operates the print screen key. I'm not sure how to do this off hand, but the print screen key can be read using vbkeyprint in a keypress/keydown rountine. I think it saves the screen image to the clip board. Can you not access the clip board using VB?
Not much help, I know, but it's a start!?!
Steve.
Sent by: Steve Barker
E-mail: [email protected]
P.S. I KNOW 1 is not a prime!
See this thread: http://forums.vb-world.net/showthread.php?threadid=26485
-
Oct 20th, 2000, 06:48 PM
#3
transcendental analytic
Heres for capturing the screen
Code:
'In declarations
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
'To use
BitBlt hdc, 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, GetDC(0), 0, 0, vbSrcCopy
Just set autoredraw to true before you do the capture, also if you don't want to have the form in the way, you can hide it while blitting and then show it again.
For saving in JPG, I have some code that does that, i could send you.
For putting an image on the walpaper, you could use a picturebox, use Setparent method to release it from your form:
Code:
'in declaraions:
Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
'to use:
Setparent picture1.hwnd, 0
'to set it back on the form:
Setparent picture1.hwnd, form1.hwnd
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 20th, 2000, 07:39 PM
#4
A way for capturing the screen and saving it to a file:
Code:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const VK_SNAPSHOT = &H2C
Public Function SaveScreen(ByVal theFile As String) As Boolean
On Error Resume Next
'To get the Entire Screen
Call keybd_event(vbKeySnapshot, 1, 0, 0)
'To get the Active Window
'Call keybd_event(vbKeySnapshot, 0, 0, 0)
SavePicture Clipboard.GetData(vbCFBitmap), theFile
SaveScreen = True
Exit Function
End Function
Usage
Call SaveScreen("C:\Windows\Desktop\screen.bmp")
And then you can use the code (which is a great code) that kedaman is going to send you to make it a jpg file .
-
Oct 20th, 2000, 09:48 PM
#5
By the way,
Q3: HOW CAN I PUT AN IMAGE ON WINDOWS WALLPAPER???
Code:
Public Declare Function WritePrivateProfileString _
Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal _
lpApplicationName As String, ByVal lpKeyName As Any, ByVal _
lpString As Any, ByVal lpFileName As String) As Long
Public Sub WriteINI(strsection As String, strkey As String, strkeyvalue As String, strfullpath As String)
Call WritePrivateProfileString(strsection$, UCase$(strkey$), strkeyvalue$, strfullpath$)
End Sub
Usage
Call WriteINI("Desktop", "Wallpaper", "C:\myimage.bmp", "C:\Windows\Win.ini")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|