?
Solved

Showing a image outside a window.

Posted on 1998-09-18
3
Medium Priority
?
148 Views
Last Modified: 2010-04-30
Hi,
   I want to make a screenmate if anyone knows what that is.  Basicallly I want to show an animtated image that will move across the top of a task bar from one side of the screen to the other.  It would be simply a person walking across the taskbar.  Also you should be able to see it when theres a program open or not.
0
Comment
Question by:cide
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:VBDesigns
ID: 1435604
A simple way to do this would be to get the ScreenDC and BLT directly to it.  However, if you don't 'clean up' after each BLT, it can mess things up.  You can also run into other issues with screen savers, and applications.  However, I think it would be a good starting point!  Simply BitBlt to the ScreenDC (GetDC of 0) your sprite images.  Remember to ReleaseDC when you're done!
0
 

Author Comment

by:cide
ID: 1435605
And how do I do this?  This aren't commands, or atleast I can't seen to use them.  Could you give me some example code?
0
 
LVL 14

Accepted Solution

by:
waty earned 200 total points
ID: 1435606
Use the followin function :

Option Explicit

' *** Arrange icons on desktop
Private Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lparam As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const GW_CHILD = 5
Private Const LVA_ALIGNLEFT = &H1
Private Const LVM_ARRANGE = &H1016

' *** Draw on the Desktop
Private Declare Function CreateDCAsNull Lib "GDI32" Alias "CreateDCA" (ByVal lpDriverName As String, lpDeviceName As Any, lpOutput As Any, lpInitData As Any) As Long
Private Declare Function DeleteDC Lib "GDI32" (ByVal hDC As Long) As Long

Private Type RECT
   Left As Long
   Top As Long
   Right As Long
   Bottom As Long
End Type
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Declare Function GetTextColor Lib "GDI32" (ByVal hDC As Long) As Long
Private Declare Function SetTextColor Lib "GDI32" (ByVal hDC As Long, ByVal crColor As Long) As Long

Public Sub DrawDesktopDC(sText As String, nPosX As Long, nPosY As Long, color As OLE_COLOR)
   ' *** Draw on the Desktop
   
   Dim hDC  As Long
   Dim tR   As RECT
   Dim lCol As Long

   sText = "Have you ever dance with me"
   color = vbGreen

   ' First get the Desktop DC:
   hDC = CreateDCAsNull("DISPLAY", ByVal 0&, ByVal 0&, ByVal 0&)

   ' Draw text on it:
   tR.Left = nPosX
   tR.Top = nPosY
   tR.Right = nPosX + Printer.TextWidth(sText)
   tR.Bottom = nPosY + Printer.TextHeight(sText)
   lCol = GetTextColor(hDC)
   SetTextColor hDC, color
   DrawText hDC, sText, Len(sText), tR, 0
   SetTextColor hDC, lCol

   ' Make sure you do this to release the GDI
   ' resource:
   DeleteDC hDC

End Sub


0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question