473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Problem with generating file shortcut in VB

I'm trying to generate a shortcut file from VB. The code below is a cutdown
version of some code I found on the net that is supposed to do the job

The compiler complains about "WshShell" in the 5th line below. It says
"Reference to a non-shared member requires an object reference". I'm not
sure what it's trying to tell me here.

thanks for any help

I'm using Visual Studio 2003. To get the IWshRuntimeLibrary, from the menu
bar: project/add references/com/Windows Script Host Object Model

Imports IWshRuntimeLibrary

Module Module3

Sub zzz()

Dim shortCut As IWshRuntimeLibrary.IWshShortcut

shortCut = CType(WshShell.CreateShortcut("C:\AAQQ.lnk"), _

IWshRuntimeLibrary.IWshShortcut)

End Sub
Apr 22 '06 #1
2 5300
Hello Mike,

shortCut = CType((New IWshRuntimeLibrary.WshShell).CreateShortcut("C:\AA QQ.lnk"), IWshRuntimeLibrary.IWshShortcut)

Regards.

"Mike" <mi******@hotmail.com> escribió en el mensaje news:12*************@corp.supernews.com...
| I'm trying to generate a shortcut file from VB. The code below is a cutdown
| version of some code I found on the net that is supposed to do the job
|
| The compiler complains about "WshShell" in the 5th line below. It says
| "Reference to a non-shared member requires an object reference". I'm not
| sure what it's trying to tell me here.
|
| thanks for any help
|
| I'm using Visual Studio 2003. To get the IWshRuntimeLibrary, from the menu
| bar: project/add references/com/Windows Script Host Object Model
|
|
|
| Imports IWshRuntimeLibrary
|
| Module Module3
|
| Sub zzz()
|
| Dim shortCut As IWshRuntimeLibrary.IWshShortcut
|
| shortCut = CType(WshShell.CreateShortcut("C:\AAQQ.lnk"), _
|
| IWshRuntimeLibrary.IWshShortcut)
|
| End Sub

Apr 23 '06 #2
Thanks Jose, that did the trick.

Mike

"José Manuel Agüero" <chema012 en hotmail.com> wrote in message
news:ek**************@TK2MSFTNGP03.phx.gbl...
Hello Mike,

shortCut = CType((New
IWshRuntimeLibrary.WshShell).CreateShortcut("C:\AA QQ.lnk"),
IWshRuntimeLibrary.IWshShortcut)

Regards.

"Mike" <mi******@hotmail.com> escribió en el mensaje
news:12*************@corp.supernews.com...
| I'm trying to generate a shortcut file from VB. The code below is a
cutdown
| version of some code I found on the net that is supposed to do the job
|
| The compiler complains about "WshShell" in the 5th line below. It says
| "Reference to a non-shared member requires an object reference". I'm not
| sure what it's trying to tell me here.
|
| thanks for any help
|
| I'm using Visual Studio 2003. To get the IWshRuntimeLibrary, from the menu
| bar: project/add references/com/Windows Script Host Object Model
|
|
|
| Imports IWshRuntimeLibrary
|
| Module Module3
|
| Sub zzz()
|
| Dim shortCut As IWshRuntimeLibrary.IWshShortcut
|
| shortCut = CType(WshShell.CreateShortcut("C:\AAQQ.lnk"), _
|
| IWshRuntimeLibrary.IWshShortcut)
|
| End Sub
Apr 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jack S. | last post by:
Hi all, I create a merge module using .Net 2003 Deploment project. I added a shortcut and used this merge module in InstallShield project. After installing the product, when click the...
3
by: Stanislaw Findeisen | last post by:
Does anyone know how to create file shortcuts in Windows? The only way I know is like: --------------------------------------------------------------- import win32com.client ...
1
by: Dom | last post by:
Hi, I have a problem in getting Access 2002 to read my workgroup file. I've created different groups and users and when the db is opened the user is prompted to enter a username and password...
2
by: mathieu cupryk | last post by:
I have problems with listboxes in the webform2.cs, the textboxes are working well when I do a click on next. I am missing something. It works with the textboxes. Here is the file: using System;...
2
by: David Krmpotic | last post by:
Hi All!! Could you please help me with three problems: 1. I would like to have a procedure that returned true if the file is writtable=deletable.. I tried everything but so far the only way...
3
by: TC | last post by:
I've written an application using VB.NET 2003 and packaged it with a deployment project. When I use the setup program to install the application, however, it doesn't work. More specifically, the...
4
by: Steve Jorgensen | last post by:
Generally, it is the case that space characters in the names of things can cause difficulties, and removing the spaces can make things work more smoothly, but I recently found a reverse case. I...
4
by: Steve | last post by:
Hi All I have a windows forms application written in VB.net 2005 which places a shortcut in All users desktop during installation, using MS setup and deployment Occasionally when a customer...
4
by: Salad | last post by:
I have a situation where some, not all, users get the message "Couldn't find file "F:\AccessApps\AppName.mdw". This file is required for startup". My app the users are attempting to access is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.