Click here to Skip to main content
6,932,415 members and growing! (18,066 online)
Email Password   helpLost your password?
Languages » VBScript » General     Intermediate License: The Code Project Open License (CPOL)

Drag Window - Without Using API

By parinit

This article describes how to move a window having no frame without using any API call.
VB6, VBScript, Windows, Dev
Revision:2 (See All)
Posted:11 Aug 2005
Views:17,686
Bookmarked:6 times
printPrint Friendly   add Share
      Discuss Discuss   Broken Article?Report  
8 votes for this article.
Popularity: 2.71 Rating: 3.00 out of 5
2 votes, 25.0%
1
1 vote, 12.5%
2

3
1 vote, 12.5%
4
4 votes, 50.0%
5

Introduction

In this article, you can learn how to drag a window having no title bar without using Windows API or other functions.

This article is useful to those of my fellow programmers who are tired of the ever to move no frame window on the screen. Well, here is something that might give you relief from that... something for a change!!! I had written this code some time back and hope some of you will find some use for it.

Background

While making one of my applications, I needed some functions which could move the window. But Visual Studio doesn't provide us with any such tools. So I wrote all the functions on my own because I did not want to use any of the APIs.

Using the Code

Mouse Events

MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)     
MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Variables

  • CurrX, CurrY as Single

Function

Private Function DragWindow(Button As Integer, X As Single, Y As Single)
If Button = 1 Then
    Me.Left = Me.Left + (X - CurrX)
    Me.Top = Me.Top + (Y - CurrY)
End If
End Function

History

  • 12-Aug-2005 - Initial release of the article

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

parinit


Member

Occupation: Web Developer
Location: India India

Other popular VBScript articles:

 
Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
  (Refresh) 
-- There are no messages in this forum --

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.

PermaLink | Privacy | Terms of Use
Last Updated: 11 Aug 2005
Editor: Deeksha Shenoy
Copyright 2005 by parinit
Everything else Copyright © CodeProject, 1999-2010
Web19 | Advertise on the Code Project