Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Tastiera gaming MSI GK600 TKL: switch hot-swap, display LCD e tre modalità wireless
Tastiera gaming MSI GK600 TKL: switch hot-swap, display LCD e tre modalità wireless
MSI FORGE GK600 TKL WIRELESS: switch lineari hot-swap, tripla connettività, display LCD e 5 strati di fonoassorbimento. Ottima in gaming, a 79,99 euro
DJI Osmo Pocket 4: la gimbal camera tascabile cresce e ha nuovi controlli fisici
DJI Osmo Pocket 4: la gimbal camera tascabile cresce e ha nuovi controlli fisici
DJI porta un importante aggiornamento alla sua linea di gimbal camera tascabili con Osmo Pocket 4: sensore CMOS da 1 pollice rinnovato, gamma dinamica a 14 stop, profilo colore D-Log a 10 bit, slow motion a 4K/240fps e 107 GB di archiviazione integrata. Un prodotto pensato per i creator avanzati, ma che convince anche per l'uso quotidiano
Sony INZONE H6 Air: il primo headset open-back di Sony per giocatori
Sony INZONE H6 Air: il primo headset open-back di Sony per giocatori
Il primo headset open-back della linea INZONE arriva a 200 euro con driver derivati dalle cuffie da studio MDR-MV1 e un peso record di soli 199 grammi
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 17-11-2002, 19:02   #1
DanieleC88
Senior Member
 
L'Avatar di DanieleC88
 
Iscritto dal: Jun 2002
Città: Dublin
Messaggi: 5989
[VB] Associare ad estensione, come ?

Come faccio ad associare un programma all'estensione che voglio io ?
__________________

C'ho certi cazzi Mafa' che manco tu che sei pratica li hai visti mai!
DanieleC88 è offline   Rispondi citando il messaggio o parte di esso
Old 17-11-2002, 20:36   #2
xegallo
Member
 
Iscritto dal: Jan 2001
Città: PATAVIUM
Messaggi: 280
Codice:
Public Type mnuCommands
    Captions As New Collection
    Commands As New Collection
End Type
Public Type filetype
    Commands As mnuCommands
    Extension As String
    ProperName As String
    FullName As String
    ContentType As String
    IconPath As String
    IconIndex As Integer
End Type
Public Const REG_SZ = 1
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Declare Function RegCloseKey Lib "advapi32.dll" _
    (ByVal hKey As Long) As Long
Public Declare Function RegCreateKey Lib "advapi32" _
    Alias "RegCreateKeyA" (ByVal hKey As Long, _
    ByVal lpszSubKey As String, phkResult As Long) As Long
Public Declare Function RegSetValueEx Lib "advapi32" _
    Alias "RegSetValueExA" (ByVal hKey As Long, _
    ByVal lpszValueName As String, _
    ByVal dwReserved As Long, ByVal fdwType As Long, _
    lpbData As Any, ByVal cbData As Long) As Long
'Codice del modulo:
'Aggiungi il seguente codice ad un modulo
Public Sub CreateExtension(newfiletype As filetype)
    Dim IconString As String
    Dim Result As Long, Result2 As Long, ResultX As Long
    Dim ReturnValue As Long, HKeyX As Long
    Dim cmdloop As Integer
    IconString = newfiletype.IconPath & "," & newfiletype.IconIndex
    If Left$(newfiletype.Extension, 1) <> "." Then newfiletype.Extension = "." & newfiletype.Extension
    RegCreateKey HKEY_CLASSES_ROOT, newfiletype.Extension,Result
    ReturnValue = RegSetValueEx(Result, "", 0, REG_SZ, ByVal newfiletype.ProperName, LenB(StrConv(newfiletype.ProperName, vbFromUnicode)))
    ' Imposta il tipo di contenuto
    If newfiletype.ContentType <> "" Then
        ReturnValue = RegSetValueEx(Result, "Content Type", 0, REG_SZ, ByVal CStr(newfiletype.ContentType), LenB(StrConv(newfiletype.ContentType, vbFromUnicode)))
    End If
    RegCreateKey HKEY_CLASSES_ROOT, newfiletype.ProperName, Result
    If Not IconString = ",0" Then
        RegCreateKey Result, "DefaultIcon", Result2 'Create The Key of "ProperName\DefaultIcon"
        ReturnValue = RegSetValueEx(Result2, "", 0, REG_SZ, ByVal IconString, LenB(StrConv(IconString, vbFromUnicode)))
        ' Imposta il valore predefinito per la chiave
    End If
    ReturnValue = RegSetValueEx(Result, "", 0, REG_SZ, ByVal newfiletype.FullName, LenB(StrConv(newfiletype.FullName, vbFromUnicode)))
    RegCreateKey Result, ByVal "Shell", ResultX
    ' Crea le sottochiavi necessarie per ogni comando
    For cmdloop = 1 To newfiletype.Commands.Captions.Count
        RegCreateKey ResultX, ByVal newfiletype.Commands.Captions(cmdloop), Result
        RegCreateKey Result, ByVal "Command", Result2
        Dim CurrentCommand$
        CurrentCommand = newfiletype.Commands.Commands(cmdloop)
        ReturnValue = RegSetValueEx(Result2, "", 0, REG_SZ, ByVal CurrentCommand$, LenB(StrConv(CurrentCommand$, vbFromUnicode)))
        RegCloseKey Result
        RegCloseKey Result2
    Next
    RegCloseKey Result2
End Sub

'Codice
'Poi usa questo codice per creare associazioni:
Dim myfiletype As filetype
myfiletype.ProperName = "MioFile"
myfiletype.FullName = "Mio Tipo di File"
myfiletype.ContentType = "Tipo MIME"
myfiletype.Extension = ".IMF"
myfiletype.Commands.Captions.Add "Apri"
myfiletype.Commands.Commands.Add "c:\windows\notepad.exe ""%1"""
myfiletype.Commands.Captions.Add "Stampa"
myfiletype.Commands.Commands.Add "c:\windows\notepad.exe ""%1"" /P"
CreateExtension myfiletype
__________________
Salva il Pianeta
xegallo è offline   Rispondi citando il messaggio o parte di esso
Old 19-11-2002, 18:08   #3
DanieleC88
Senior Member
 
L'Avatar di DanieleC88
 
Iscritto dal: Jun 2002
Città: Dublin
Messaggi: 5989
Grazie !
__________________

C'ho certi cazzi Mafa' che manco tu che sei pratica li hai visti mai!
DanieleC88 è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Tastiera gaming MSI GK600 TKL: switch hot-swap, display LCD e tre modalità wireless Tastiera gaming MSI GK600 TKL: switch hot-swap, ...
DJI Osmo Pocket 4: la gimbal camera tascabile cresce e ha nuovi controlli fisici DJI Osmo Pocket 4: la gimbal camera tascabile cr...
Sony INZONE H6 Air: il primo headset open-back di Sony per giocatori Sony INZONE H6 Air: il primo headset open-back d...
Nutanix cambia pelle: dall’iperconvergenza alla piattaforma full stack per cloud ibrido e IA Nutanix cambia pelle: dall’iperconvergenza alla ...
Recensione Xiaomi Pad 8 Pro: potenza bruta e HyperOS 3 per sfidare la fascia alta Recensione Xiaomi Pad 8 Pro: potenza bruta e Hyp...
Annunciata la tuta di volo di Vast che s...
Vast presenta il nuovo Large Docking Ada...
Una denuncia getta ombre sulle batterie ...
DJI Avata 2 Fly Smart Combo a 526€: il d...
Alla guida della nuova auto elettrica ci...
GeForce RTX 3060 12 GB a giugno di nuovo...
Apple Music sarà sponsor ufficiale di Po...
The Mandalorian & Grogu: trailer fin...
Fedeltà record: Apple blinda gli utenti,...
Volkswagen ID.3 Neo: fino a 630 km di au...
GPU-Z mette i dati personali a rischio? ...
La PS6 potrebbe essere retrocompatibile ...
Amazfit Cheetah 2 Pro arriva in Italia: ...
Duolingo ammette l'errore dopo un anno: ...
Samsung Galaxy Tab S10 Lite a 249€: il t...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 05:13.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Served by www3v