BitBlt (nothing shows up)
BitBlt (nothing shows up)
BitBlt (nothing shows up)
BitBlt (nothing shows up)
BitBlt (nothing shows up)
BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up)
BitBlt (nothing shows up) BitBlt (nothing shows up)
BitBlt (nothing shows up)
Go Back  Xtreme Visual Basic Talk > > > BitBlt (nothing shows up)


Reply
 
Thread Tools Display Modes
  #1  
Old 07-24-2005, 10:29 PM
jkarnacki jkarnacki is offline
Newcomer
 
Join Date: Jul 2005
Posts: 6
Default BitBlt (nothing shows up)


Hi, I want my pic1 picturebox to show up somewhere on top of the screen (which displays over EVERYTHING). My project file is attached. I have been trying to figure this one out for some time now.

Thanks in advance.
Attached Files
File Type: zip BitBlt.zip (578.5 KB, 11 views)
Reply With Quote
  #2  
Old 07-24-2005, 10:50 PM
TeraBlight's Avatar
TeraBlightBitBlt (nothing shows up) TeraBlight is offline
Captain Convoluted

* Expert *
 
Join Date: Jun 2005
Posts: 1,918
Default

Uhhh okay, I got it working.
  • Firstly, you need to switch on your timer (set the interval > 0)
  • Then, you need to declare ALL the APIs you are using, not just BitBlt (GetDC, ReleaseDC).
  • Next, you cannot name a module the same as a function you are using, so you need to rename your code module.
  • vbHimetric seems to work in the ScaleXY functions, but I think vbTwips would be the correct setting.
  • Finally, ReleaseDC takes two parameters (hWnd, hDC) so it should be "ReleaseDC 0, hScreenDC"
__________________
"To learn without thinking is to labour in vain" - Confucius
Reply With Quote
  #3  
Old 07-26-2005, 11:44 PM
DrFire DrFire is offline
Newcomer
 
Join Date: Sep 2004
Posts: 17
Default

Here, I wrote a little code that will put what ever is in pic1 directly centered on to the desktop.

Quote:
Option Explicit

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 GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long

Dim DesktopDC As Long, ScreenHeight As Long, ScreenWidth As Long

Private Sub Command1_Click()

BitBlt DesktopDC, ScreenWidth / 2 - pic1.ScaleWidth / 2, ScreenHeight / 2 - pic1.ScaleHeight / 2, ScreenWidth / 2 - pic1.ScaleWidth / 2, ScreenHeight / 2 - pic1.ScaleHeight / 2, pic1.hDC, 0, 0, vbSrcCopy

End Sub

Private Sub Form_Load()

DesktopDC = GetWindowDC(GetDesktopWindow)
ScreenHeight = Screen.Height / Screen.TwipsPerPixelY
ScreenWidth = Screen.Width / Screen.TwipsPerPixelX

pic1.AutoRedraw = True
pic1.AutoSize = True
pic1.BorderStyle = 0
pic1.ScaleMode = 3

End Sub
And if you want it to be something full screen and start from the very top and/or left, use this:

Quote:
Option Explicit

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 GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long

Dim DesktopDC As Long, ScreenHeight As Long, ScreenWidth As Long

Private Sub Command1_Click()

BitBlt DesktopDC, 0, 0, ScreenWidth / 2 - pic1.ScaleWidth / 2, ScreenHeight / 2 - pic1.ScaleHeight / 2, pic1.hDC, 0, 0, vbSrcCopy

End Sub

Private Sub Form_Load()

DesktopDC = GetWindowDC(GetDesktopWindow)
ScreenHeight = Screen.Height / Screen.TwipsPerPixelY
ScreenWidth = Screen.Width / Screen.TwipsPerPixelX

pic1.AutoRedraw = True
pic1.AutoSize = True
pic1.BorderStyle = 0
pic1.ScaleMode = 3

End Sub
By the way, to use it, you'll need to add a Command1...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
BitBlt (nothing shows up)
BitBlt (nothing shows up)
BitBlt (nothing shows up) BitBlt (nothing shows up)
BitBlt (nothing shows up)
BitBlt (nothing shows up)
BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up) BitBlt (nothing shows up)
BitBlt (nothing shows up)
BitBlt (nothing shows up)
 
BitBlt (nothing shows up)
BitBlt (nothing shows up)
 
-->