Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating a new File Type Remotely

Posted on 1999-07-20
8
Medium Priority
?
181 Views
Last Modified: 2010-05-02
I want to know if it is possible to create a new File Type on a PC (NT or 9x) using a custom ActiveX DLL on the server side (remotely). This has to be done manually (and locally!) until now and with many client machines this is not very practical.
0
Comment
Question by:psiegers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1526233
Can't you just create a new registry entry
0
 

Author Comment

by:psiegers
ID: 1526234
How do I do that? I know that a normal VB setup can do the job, so it must be possible, although the difference is that I need to do this REMOTELY from a browser window. So any sample which accomplishes this will qualify, is does not have to be an ActiveX DLL, but since I already have one, I think it is more easy to implement.
0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1526235
use regcreatekey
RegCreateKey

Declare Function RegCreateKey& Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal _
hKey As Long, ByVal lpSubKey As String, phkResult As Long)
Parameter      Type/Description
hKey      Long—Handle of an open key or one of the standard key names (see chapter text).
lpSubKey      String—Name of the new subkey to create. You can create multiple keys at once by separating them with backslashes, for example, level1\level2\newkey.
phkResult      Long—A variable to load with a handle to the new subkey.
Return Value


you'll need to create a .myext key under HKEY_CLASSES_ROOT with a default like MyFile, then create another key called MyFile with the default being the path of your app.  

use regsetkey to set the default values:

Declare Function RegSetValue& Lib "advapi32.dll" Alias "RegSetValueA" (ByVal _
hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As _
String, ByVal cbData As Long)




0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:psiegers
ID: 1526236
As a whole it seems a good solution. i suppose this has to run on the client computer?
I would appreciate it a lot if you could give a sample procedure, since I'm not very well in the subject.
Suppose I want to create a new file type using the extension GPC, which points to the executable located in "C:\Fotoeditor6\VBexe\", could you give me an example of the 'public sub' of the DLL?
0
 
LVL 2

Accepted Solution

by:
BeedleGuis earned 400 total points
ID: 1526237
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Const REG_SZ = 1
Private Const KEY_SET_VALUE = &H2
Private Const HKEY_CLASSES_ROOT = &H80000000

Private Sub Command1_Click()
Dim keyhandle As Long
Dim retval As Long
Dim strApp As String
strApp = "C:\Fotoeditor6\VBexe\vbexe.exe %1"
retval = RegCreateKey(HKEY_CLASSES_ROOT, "GPCType\shell\Open\command", keyhandle)
retval = RegSetValue(keyhandle, vbNullString, REG_SZ, strApp, LenB(strApp))
retval = RegCloseKey(keyhandle)
strApp = "GPCType"
retval = RegCreateKey(HKEY_CLASSES_ROOT, ".GPC", keyhandle)
retval = RegSetValue(keyhandle, vbNullString, REG_SZ, strApp, LenB(strApp))
retval = RegCloseKey(keyhandle)

End Sub

0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1526238
hmm ..  can't believe that worked so well..my first time using reg api calls  :-)
0
 

Author Comment

by:psiegers
ID: 1526239
BeedleGuis, you have done it again!
Congratulations, you won 100 points!
0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1526240
thnx .. actually 400 quality points .. due to the A!  Thanks again.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question