Solved

Showing a image outside a window.

Posted on 1998-09-18
3
142 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
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 100 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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