Create Shortcut By Dragging From Listview
Was wondering if someone could show me an example of creating a windows shortcut by dragging an item out of a listview control and say onto the desktop.
When creating the shortcut I would like to link to a specifix .exe, but use what was dragged out as part of the command line parameters.
Thanks in advance
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dragging And Dropping Shortcut? (still Ned Help)
Is it possible, to drag a file (lets say from your desktop) onto your application you made, and the application will put the file you dragged into a specific folder on your hard drive?
If its possible, ever more specifically, is it possible to drag it into like a box on your application, and have 2 boxes that will put the file in 2 different folder, depending on what box you drop it into?
If this is all possible, plzplzplz tell me how.
I have been fooling around with VB for the past 2 hours trying to figure this out, but I cant find anything.
Can it be done with code?
ListView DRAGGING
How can I select multiple items by clicking and then dragging over the amount of records that are there?
thanks...
Listview - Turning Off Dragging
I'm in one of my old apps and noticed that for some reason I used a listview control when a listbox "might" have done the job. My comments aren't as good as they should be (lesson learned). Anyway, since I'm not sure why I used a listview instead of a listbox I'm not willing to replace it. I don't have the time.
So... Is there a property (that I can't find) that turns off dragging of items in the listview control?
Thanks,
Bernie
Dragging Listview Items
How to drag Listview Item to another form with the same format of Listview.??? hElp please??
Listview Dragging Item
Hello, Jusk asking if there is a possible way to drag item in the listview??
it goes like this:
Listview populate with;
Item 1
Item 2
Item 3
When I drag Item 3 to the position of Item2, it goes like this;
Item 1
Item 3
Item 2
is this possible?? if not?? what should I do??
ListView And Turning Off Dragging
I have Listview with a number of items and I want a user to be able to select an item by clicking on it. Currently, if they click and drag then the icon and text go flying all over the window. How do you keep them from being able to click and drag on the icons messing up the entire list view but still allow them to click and select one? There are a number of related posts but noone seems to have a straightforward answer and this seems easy. Help please!
Thanks.
Listview: Disabling User Dragging
Is there a way to disable the user from dragging items in a listview. My listview.view=lvwIcon and has to stay that way (e.g. I need the nice large icons)
Thanks in advance,
Listview Setting No Column Dragging
Hi all
you know how with the listview columns you can drag them?
howdo i stop this or get it to resize as soon as the user drags it so its kind of asking howto set the drag to be undraggable
Tom
Dragging Multiple Items From A Listview
i have some code to let users drag an item from a listview onto a treeview node, which works fine, but now i want to let them drag multiple items.
the problem is that when then select a bunch of items, then drag them to the treeview, it leaves only the last item they clicked on selected (as if they selected them, then just left-clicked one of them). is there a way to keep them all selected?
also, just out of interest, is there a way to make the drag icon include some text from each selected listview item along with an icon (like when you drag multiple files in windows explorer)?
thanks for any help
Problem With ListView Control And Dragging
I'm trying to drag an item from one ListView control to another but whenever I click on any of the items the first item is selected no matter which I have clicked on. The drag outline does appear over the selected object though. The ListView control is in report view and all the other relevant code is below, can anyone suggest what I've done wrong?
Many thanks
Geoff
Setting up control:
Dim itmX As ListItem
lsvEvents.ListItems.Clear
lsvEvents.ColumnHeaders.Clear
lsvEvents.ColumnHeaders.Add , "Event", "Event", lsvEvents.Width / 2
lsvEvents.ColumnHeaders.Add , "Time", "Time", lsvEvents.Width / 2
lsvEvents.SmallIcons = imlLog
For each record in a recordset:
Set itmX = lsvEvents.ListItems.Add()
itmX.Text = !Name
itmX.Tag = !EventID
itmX.SubItems(1) = !OpenTime
Select Case !EventType
Case Is = "<Project File>"
itmX.SmallIcon = "Project"
Case Is = "<Resource File>"
itmX.SmallIcon = "Resource"
Case Is = "<Issue>"
itmX.SmallIcon = "Issue"
End Select
MouseDown:
Private Sub lstEvents_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim DY ' Declare variable.
DY = TextHeight("A") ' Get height of one line.
lblDrag.Move lstEvents.Left, lstEvents.Top + y - DY / 2, lstEvents.Width,
DY
lblDrag.Drag ' Drag label outline.
End Sub
Problem With ListView Control And Dragging
I'm trying to drag an item from one ListView control to another but whenever I click on any of the items the first item is selected no matter which I
have clicked on. The drag outline does appear over the selected object though. The ListView control is in report view and all the other relevant code is below, can anyone suggest what I've done wrong?
Many thanks
Geoff
Setting up control:
Dim itmX As ListItem
lsvEvents.ListItems.Clear
lsvEvents.ColumnHeaders.Clear
lsvEvents.ColumnHeaders.Add , "Event", "Event", lsvEvents.Width / 2
lsvEvents.ColumnHeaders.Add , "Time", "Time", lsvEvents.Width / 2
lsvEvents.SmallIcons = imlLog
For each record in a recordset:
Set itmX = lsvEvents.ListItems.Add()
itmX.Text = !Name
itmX.Tag = !EventID
itmX.SubItems(1) = !OpenTime
Select Case !EventType
Case Is = "<Project File>"
itmX.SmallIcon = "Project"
Case Is = "<Resource File>"
itmX.SmallIcon = "Resource"
Case Is = "<Issue>"
itmX.SmallIcon = "Issue"
End Select
MouseDown:
Private Sub lstEvents_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim DY ' Declare variable.
DY = TextHeight("A") ' Get height of one line.
lblDrag.Move lstEvents.Left, lstEvents.Top + y - DY / 2, lstEvents.Width,
DY
lblDrag.Drag ' Drag label outline.
End Sub
Stop Item Dragging/moving In ListView
Is there any way you can stop the user from moving the item position in a listview?? I need them to stay the same as i added them first by code, with them being fixed for the user and not allowing any movement of item position!
thanks!
Please Double Check This Dragging From ListBox To ListView Code For Me
I want to drag an item from a listbox to a listview so starting with my lisbox code:
Private DragID As Integer
Private blnAmDragging As Boolean
Code:
Private Sub lstUnalloc_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
DragID = lstUnalloc.ItemData(lstUnalloc.ListIndex)
End If
End Sub
Code:
Private Sub lstUnalloc_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error GoTo errh
If Button = vbLeftButton Then
If lstUnalloc.ListIndex >= 0 Then
blnAmDragging = True
lstUnalloc.Drag vbBeginDrag
End If
End If
Exit Sub
errh:
errmsg "The following Exception occured : " & Err.Description & ", " & Err.Source & "", "Exception occured in frmMain.lstUnalloc_MouseMove ()"
End Sub
and now my listview:
Code:
Private Sub lvwPeople_DragOver(Source As Control, x As Single, y As Single, State As Integer)
On Error GoTo errh
If blnAmDragging = True Then
If State = vbLeave Then
Set lvwPeople.DropHighlight = Nothing
Else
Set lvwPeople.DropHighlight = lvwPeople.HitTest(x, y)
End If
End If
Exit Sub
errh:
errmsg "The following Exception occured : " & Err.Description & ", " & Err.Source & "", "Exception occured in frmMain.lstlist_DragOver()"
End Sub
Code:
Private Sub lvwPeople_DragDrop(Source As Control, x As Single, y As Single)
If Source = "lvwPeople" Then
Exit Sub
End If
Source.Drag vbEndDrag
Set lvwPeople.SelectedItem = lvwPeople.HitTest(x, y)
MsgBox lvwPeople.SelectedItem.Key
MsgBox DragID
End Sub
I just put 2 msgboxes to test. I have to write sql statements to assign the number to a person. I just need someone to check if I am doing the correct stuff for dragging and dropping.
Create Shortcut
I am using the code shown below to create a shortcut on the desktop. However, I'd like to create the shortcut in a folder that is specified in Cell B6 on Sheet1. Can someone please help me with this.
'VBA code for placing a shortcut on the desktop.
Code:
Declare Function SHGetSpecialFolderLocation Lib "Shell32" _
(ByVal hwnd As Long, ByVal nFolder As Long, ppidl As Long) As Long
Declare Function SHGetPathFromIDList Lib "Shell32" _
(ByVal pidl As Long, ByVal pszPath As String) As Long
Declare Function SetWindowPos Lib "User32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal uFlags As Long) As Long
Declare Function SetForegroundWindow Lib "User32" _
(ByVal hwnd As Long) As Long
Declare Function GetForegroundWindow Lib "User32" () As Long
Function Shortcut(Target As String, _
Optional Target_Type As Long) As Boolean
Dim hwnd As Long
Dim pidl As Long
Dim Bureau As String
If Dir(Target & IIf(Target_Type = vbDirectory, "", ""), _
Target_Type) = "" Then Exit Function
SHGetSpecialFolderLocation 0, 0, pidl
Bureau = Space(260)
SHGetPathFromIDList pidl, Bureau
Bureau = Left(Bureau, InStr(1, Bureau, vbNullChar) - 1)
hwnd = GetForegroundWindow
SetWindowPos hwnd, -1, 0, 0, 0, 0, 3
Shell "RunDLL32 AppWiz.Cpl,NewLinkHere " & Bureau & ""
SendKeys """" & Target & """~~", True
SetForegroundWindow hwnd
Shortcut = True
End Function
Sub Test()
' Creates a shortcut to the directory "C:Temp"
' MsgBox IIf(ShortCut("C:Temp", vbDirectory), _
' "Shortcut created", "Can't find the directory")
' Creates a shortcut to the file "C:Tempaza.xls"
MsgBox IIf(Shortcut("F:NormalPMC1Normal.dot"), _
"Shortcut created", "Can't find the file")
End Sub_
Create A Shortcut
i have a project that uses alote of diff files and i want the user to enter the name of the file in a inputbox and it make a shortcut to the desktop how would i do this
Create Shortcut...
hi, how do i create a shortcut of a file (my app) and place it in a specific folder??
thanks
Create Shortcut Help
is there a way i can code a command to create a shortcut of a given file and add parameteres??
please help
Create Shortcut.
Hi there,
I want to create a shortcut of my program at the first time I start my progam. Can you show me the code to do this.
Thanks in advanced.
Create Shortcut
how do i create a shortcut eg create one that links to c:myfile.exe and place the shortcut in c:somefile. in visual basic?
Create Shortcut
Can someone please post or link to an example of how to create a shortcut to a file (e.g. "G:Hello.exe") and place it automatically on the desktop? Thx!
Create Shortcut...
Hi !
My name is Karl-Erik, Sweden...
I've written a program in Visual Basic 6, and it works fine on my computer. Since I decided to give it to some friends, I tried to use VB6 Wizard for distribution and deployment of a program. But I found that to be very harmful to some older computers, because it changed some files in them, especially Oleaut32.dll, and therefor they got problems to start other programs. I confimed the problem on a reference computer I could use...After that I decided to make an own installing device for my program, that only places all belonging files in to a certain map, made up by the PC-owner, and work from there. A good solution on this particular problem ! End of this story !
This installing device also works just fine, but I know that some people are not so familiar with windows explorer and do not understand so much about moving files from one map to another. That's the reason for my decision to complete my install with creating a shortcut from the program on desktop, as a final move in the install sequence. That's all right on my computer (WindowsXP), but does'nt work at all on my reference computer, that use Windows98. I use the programming lines, showed in O'Reilly Windows DevCenter.com and written by Ron Petrusha.
Obviously my reference computer can't create a shortcut by ActiveX component. It says error n 429, and it means there is no license for it. I can certainly work that out to this very computer, but I would'nt do that... I've borrowed it and also I cannot travel around to install ActiveX on different
computers.
So, there is my problem. I'd like to make it easy for them who wants to install my program, but it makes it much harder for myself.
Solutions ! ?Someone....
Thanks in advance...
Karl-Erik
How Do I Create A Shortcut To This..
Hi all,
I have Internet Explorer Version: 6.0.2800.1106.xpsp2.030422-1633
I noticed that programs like Yahoo messenger, MSN Messenger, Weatherbug and a few others have been able to add short cuts along the address bar (See attachment for example) and was wondering how I would do that in VB for my program??
Thanks for the help.
Rudy
How Do I Create A Shortcut Through VB?
How can I creat a shortcut through vb code?
I want to have a button that will allow the user creat a shortcut to my app in the startup folder.
thanks,
Rudy
How To Create Shortcut ??
Hi all,
I was asked to write a program copy entire directory from one place to another and then create a shortcut and put it into start menu.
Anyone of you can guide me through this ??
Thanks a lot guys,
Create Shortcut In VB
How do I make a program create a shortcut to itself and place the shortcut on the desktop? This is useful for users who do not know how to use Explorer to create a shortcut and drag it to the desktop.
How To Create A Shortcut?
If I have an App, I need to create a shortcut of that app in the SendTo folder, how do I create the Shortcut?
Create Shortcut
I need to create a shortcut to my exe file and place it in
the desktop when the user clicks a button on a form?
Create Shortcut
How to create shortcut form VB code for current user, for all user?
Thanks.
Create Shortcut
I need to create shortcuts fo many reports(.rpt) files into
many folders. Please let me know how do we do it in VB.
CAN ANYONE PLEASE HELP CREATE A SHORTCUT ~
Hello everyone!!!!
I have users who need a shorcut to Outlook 2003 on a Terminal Server (need it on their desktop w/in their terminal session)...
Here is where the target is:
"M:Program FilesMicrosoft OfficeOFFICE11OUTLOOK.EXE"
Start in:
"M:Program FilesMicrosoft OfficeOFFICE11"
Their desktops are redirected to:
\apxcluster sprofiles$\%username%Desktop
Can anyone help me with a script that creates this???
I WILL OWE BIG!!
Thanks!
Brandon
Create Shortcut
can a shortcut be created with VB and placed on the desktop?
Create Folder Shortcut
i need to make a shortcut of a shared network folder and i cant find out how. i can probably use vbs to make a shortcut, but then i dont know how to change the target and icon. I cant find anything in VB either so im at a loss. plan now is maybe to just create a shortcut to notepad and then swap the icon and target to reflect the network share.
i think i used to know how to do this, but i remember having alot of trouble with it. Then again, since i code so little these days, heh, ive forgotten alot =P
anyone else have a better plan?
thanks in advance.
How To Create A Shortcut On Desktop?
Hi,
I have posted this thread before but till now i still don't have a clue as to how i can solve the problem.
The problem is i am working on a network computer. i have finished my program and i want to do a package and deployment for it. After doing everything, i tried installing the program on other PCs, BUT i couldnt because the setup file trys to add a link to the start>Programs which is under the ALL USERS profile. As i am not the administrator, there's really nothing i can do.
As the program is to be distributed to everyone in my company, i need to make it easiler for people to access, so i need to make a link somewhere.
What i was thinking of was to do away the link from the start menu and to add a shortcut to the desktop through the package and deployment. But i have no idea of doing so.
Please help.Thanks.
Best regards,
Create File Shortcut
Is there any way (or similar way) of creating a shortcut to an exe file from this code in vb6 ??
Thanks
If Exist- Create Shortcut
Hi
Im have created a form - i need some help.
what im after is - to look to see if a file exists - eg notepad.exe in a directory - if this file does exist then create a shortcut in the form - if not dont create a shortcut/link. I need to do this for about 20 files.
can anyway help ?
cheers Tony
Create Keyboard Shortcut In Vb?
I want users on the database to put in a quick keyboard shortcut like ctrl+L and it will lock the session until a password is reentered. I know how to do the locking and everything, I am just wondering whether it is possible to write an event that responds to a certain combination of keystrokes.
Create Shortcut In My Documents
The below code is of Bushmobile to create shortcuts. The original showed how to create shortcut onto desktop. I Tried to create shortcut in 'My Documents'. but this code always creates Shortcut only in Desktop????
Could somebody correct me where Iam wrong.
code Code:
Private Sub Create_ShortCut(ByVal sTargetPath As String, _
ByVal sShortCutPath As String, _
ByVal sShortCutName As String, _
Optional ByVal sArguments As String, _
Optional ByVal sWorkPath As String, _
Optional ByVal eWinStyle As WshWindowStyle = vbNormalFocus, _
Optional ByVal iIconNum As Integer)
' Requires reference to Windows Script Host Object Model
Dim oShell As IWshRuntimeLibrary.WshShell
Dim oShortCut As IWshRuntimeLibrary.WshShortcut
Set oShell = New IWshRuntimeLibrary.WshShell
Set oShortCut = oShell.CreateShortcut(oShell.SpecialFolders(sShortCutPath) & _
"" & sShortCutName & ".lnk")
With oShortCut
.TargetPath = sTargetPath
.Arguments = sArguments
.WorkingDirectory = sWorkPath
.WindowStyle = eWinStyle
.IconLocation = sTargetPath & "," & iIconNum
.Save
End With
Set oShortCut = Nothing: Set oShell = Nothing
End Sub
Private Sub Command1_Click()
Create_ShortCut "C:Program FilesCase MonitorCase Monitor.exe", "MyDocuments", "Case1", , , WshNormalFocus
End Sub
Create A Shortcut Key Thru Code!
Howdy!
How do I create a shortcut key for an existing .exe thru code.
I want to add Alt + H, but if you right-click on a .exe icon and go under properties, Windows defaults to Ctrl + AlT + H.
Let me know
Thanx!
Hyme
Create Desktop Shortcut
How do i create a desktop shortcut. In fCreateShellLink i dint see any possibilities of specifying the icon and start in directory. IShelllink interface seems to be too complex for me!!. Can u please help.
Happiness Forever
Bang123
Create Shortcut With Parameter
Hi,
I want my program to create a shortcut to itself with a parameter. I have used a lot of code from this forum, but it's all the same and it doesn't work for me. My computer shows there's harddisk activity but it doesn't create a shortcut. And it can't give a parameter. Does anyone knows how to create a shortcut to a program and place it in a custom place AND give it a parameter for my program.
tnx in advance
How To Create Uninstall Shortcut
Hello there,
I install an application of mine using the package & deployment wizard of visual studio. It created a shortcut from START(taskbar) / Programs / MyApp / MyApp.exe.
I want to know how can i make a shortcut of the UNINSTALL MyApp in the same way. eg. START(taskbar) / Programs / MyApp / UNINSTALL MyApp.
Can somebody give me any idea or maybe show me some codes.
thanks in advance.
|