home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
msg_spy
/
droppad.frm
next >
Wrap
Text File
|
1994-05-22
|
5KB
|
143 lines
VERSION 2.00
Begin Form frmDragDrop
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Drop Pad"
ClientHeight = 2676
ClientLeft = 168
ClientTop = 1560
ClientWidth = 5592
Height = 3120
Icon = DROPPAD.FRX:0000
Left = 108
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 2676
ScaleWidth = 5592
Top = 1176
Width = 5712
Begin MsgSpy MsgSpy1
Left = 4560
MessageNumber = 563
SpyMode = 1 'Single Message
Top = 2100
End
Begin Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "with the file ready to view or edit."
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 7.8
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 312
Index = 3
Left = 180
TabIndex = 3
Top = 2160
Width = 5232
End
Begin Image Image1
Height = 516
Left = 180
Picture = DROPPAD.FRX:0442
Top = 120
Width = 4236
End
Begin Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "(or its icon if minimized). Notepad will then be loaded"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 7.8
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 312
Index = 2
Left = 180
TabIndex = 2
Top = 1740
Width = 5232
End
Begin Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Use File Manager to drop text files onto this window"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 7.8
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 312
Index = 1
Left = 180
TabIndex = 1
Top = 1320
Width = 5232
End
Begin Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Message Spy Custom Control Demo Application"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 7.8
FontStrikethru = 0 'False
FontUnderline = -1 'True
Height = 312
Index = 0
Left = 180
TabIndex = 0
Top = 840
Width = 5232
End
End
'-------------------------------------------------
'
' DropPad - a Message Spy Custom Control demo
'
' Copyright (c) 1992-1994 Anton Software Limited.
'
'-------------------------------------------------
Option Explicit
Declare Sub DragAcceptFiles Lib "shell" (ByVal hWnd As Integer, ByVal fAccept As Integer)
Declare Function DragQueryFile Lib "shell" (ByVal hDrop As Integer, ByVal iFile As Integer, ByVal lpszFile As String, ByVal cb As Integer) As Integer
Declare Sub DragFinish Lib "shell" (ByVal hDrop As Integer)
Sub Form_Load ()
' Centre the logo.
Image1.Left = (frmDragDrop.Width - Image1.Width) / 2
' Subclass the main form.
MsgSpy1 = frmDragDrop.hWnd
' Tell Windows it can accept dropped files
' from File Manager.
DragAcceptFiles frmDragDrop.hWnd, 1
End Sub
Sub MsgSpy1_MsgReceived (hWnd As Integer, Msg As Integer, WParam As Integer, LParam As Long)
' Get the file name.
Const BUFFER_SIZE = 126
Dim Filename As String * BUFFER_SIZE
Dim Result As Integer
Result = DragQueryFile(WParam, 0, Filename, BUFFER_SIZE)
DragFinish WParam
' And invoke Notepad to edit/view it.
Result = Shell("notepad.exe " & Filename, 1)
End Sub