Hello. I got this source from here or planet source code, and it makes a picture into a clock. I used it to create a custom clock and it drags around just fine on my computer. I am running 98se. But when I send it to my friends, it won't drag around their desktop. Can someone help me sort this out? Thanks.
You need one form with form color set to &H00FF00FF&: picture on the form, a picturebox: blank, a label, and a timer with interval of 10. I posted the code for the form and the module is an attachment. Make sure you put the blank picturebox on top of the graphics that will show, it is what closes the window, that is if you want to see it in action.
Form Code
Vb Code Code:
Private Sub Form_Load()
AutoFormShape clock, RGB(255, 0, 255)
clock.Show 1
End Sub
Private Sub Image1_Click()
End
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
I just sent them an exe. It didn't work because it wasn't a registered window? I would hate for it to be a complicated procedure just to share a cool looking clock with my friends. Any help will be appreciated.
It does not need to be a complicated procedure.. unless you intentionally make it complicated, they will simply install the program just like any other.
Ok, it makes sense. But how do I know what files to include? The only external files I used was a bmp, and that was compiled into the exe and worked on the other computers. What files will I need to include to make it drag around, some vb runtime dlls or something? Also, will it work if I don't add a registry entry or use a self extracting exe? I read the post but it was a little vague on which files to include. Thanks.
If you load a picture file at design time, it is complied into your program, and does not need to be distributed separately.
The files you need to distribute are the ones that are external to your executable (eg: if you load pictures with code), as well as vb runtime DLL's etc.
You probably don't need to worry about what the DLLs etc are, as the program you use to create the installation package should work it all out for you (as long as it is set up for VB6). The Package & Deployment Wizard that comes with VB will do it, even tho it isn't the best (see the Deployment FAQ for links to 'issues') it is probably the easiest to use.
You don't need to add registry entries etc, as the installation package will do that for you.
As you included values in your code (rather than constants as would be advised) I compared them to a working example, and found that you are using unusual values.
Thanks. I did not write that code, but that snippet you gave me above will be saved for future reference. When I get home from work this afternoon, I will try it on my xp computer.
Well I tried to use the code you gave me. I updated the form code above with it, I put it where I thought it would go, and I even made an installer from it, but it still doesn't drag on xp. Maybe I put it in the wrong place?
Instead of using the MouseDown event, you should be using MouseMove.
Here is a full example:
Code:
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "User32" ()
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim lngReturnValue As Long
If Button = 1 Then
'Release capture
Call ReleaseCapture
'Send a 'left mouse button down on caption'-message to our form
lngReturnValue = SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
End Sub
Private Sub Form_Paint()
Me.Print "Click on the form, hold the mouse button and drag it"
End Sub
Hey thanks si! It works like a charm now, and I don't even need to make an install for it. I just copied the exe to my zip drive and it ran on my xp computer from it just fine. Now I can start with the custom windows I had in mind. I'd give you more rep but it won't let me, seems you are one of the few that actually answer my questions. I will pass you some rep when I can.
I don't even need to make an install for it. I just copied the exe to my zip drive and it ran on my xp computer from it just fine.
You do need to make an install for it.. but as you have already installed the required files on that computer, you are currently in a situation where you can get away with this.
Whenever you add new components/references, you will almost certainly need to install it on that computer.
When you want to use the program on other computers, you should install it.
I will pass you some rep when I can.
Thanks, but there's no need - knowing I helped solve the problem (along with your thanks) is enough for me.