Hola Skl tanto tiempo, aca tenes una funcion para abrir una url usando DDE
Option Explicit
'--------------------------------------
'Autor: Leandro Ascierto
'Web: www.leandroascierto.com.ar
'Date: 06/05/2010
'--------------------------------------
Private Declare Function DdeInitialize Lib "user32" Alias "DdeInitializeA" (pidInst As Long, ByVal pfnCallback As Long, ByVal afCmd As Long, ByVal ulRes As Long) As Integer
Private Declare Function DdeCreateStringHandle Lib "user32" Alias "DdeCreateStringHandleA" (ByVal idInst As Long, ByVal psz As String, ByVal iCodePage As Long) As Long
Private Declare Function DdeConnect Lib "user32" (ByVal idInst As Long, ByVal hszService As Long, ByVal hszTopic As Long, pCC As Any) As Long
Private Declare Function DdeFreeStringHandle Lib "user32" (ByVal idInst As Long, ByVal hsz As Long) As Long
Private Declare Function DdeUninitialize Lib "user32" (ByVal idInst As Long) As Long
Private Declare Function DdeFreeDataHandle Lib "user32.dll" (ByVal hData As Long) As Long
Private Declare Function DdeDisconnect Lib "user32.dll" (ByVal hConv As Long) As Long
Private Declare Function DdeCreateDataHandle Lib "user32" (ByVal idInst As Long, pSrc As Byte, ByVal cb As Long, ByVal cbOff As Long, ByVal hszItem As Long, ByVal wFmt As Long, ByVal afCmd As Long) As Long
Private Declare Function DdeClientTransaction Lib "user32" (ByVal pData As Long, ByVal cbData As Long, ByVal hConv As Long, ByVal hszItem As Long, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, pdwResult As Long) As Long
Private Const XCLASS_FLAGS = &H4000
Private Const XTYP_EXECUTE = (&H50 Or XCLASS_FLAGS)
Private Const CP_WINANSI As Long = 1004
Private Const FIREFOX As String = "firefox"
Private Const OPERA As String = "opera"
Private Const IEXPLORER As String = "iexplore"
Private Function BrowserOpenURL(ByVal sServer As String, ByVal sURL As String) As Boolean
Dim hServer As Long
Dim hTopic As Long
Dim hItem As Long
Dim hConv As Long
Dim hData As Long
Dim idInst As Long
Dim aURL() As Byte
Const sTopic = "WWW_OpenURL"
Const sItem = "0xFFFFFFFF"
If DdeInitialize(idInst, 0, 0, 0) <> 0 Then Exit Function
hServer = DdeCreateStringHandle(idInst, sServer, CP_WINANSI)
hTopic = DdeCreateStringHandle(idInst, sTopic, CP_WINANSI)
hItem = DdeCreateStringHandle(idInst, sItem, CP_WINANSI)
hConv = DdeConnect(idInst, hServer, hTopic, ByVal 0&)
If hConv Then
If InStr(UCase(sURL), "HTTP://") = 1 And sServer = OPERA Then
sURL = Mid(sURL, 8)
End If
aURL = StrConv(sURL, vbFromUnicode)
hData = DdeCreateDataHandle(idInst, aURL(0), Len(sURL), 0&, 0&, 0&, 0&)
If hData <> 0 Then
If DdeClientTransaction(hData, -1, hConv, 0, 0, XTYP_EXECUTE, 1000, 0) = 0 Then
BrowserOpenURL = True
End If
DdeFreeDataHandle hData
End If
DdeDisconnect hConv
End If
DdeFreeStringHandle idInst, hServer
DdeFreeStringHandle idInst, hTopic
DdeFreeStringHandle idInst, hItem
DdeUninitialize idInst
End Function
Private Sub Form_Load()
Call BrowserOpenURL(IEXPLORER, "http://www.leandroascierto.com.ar")
Call BrowserOpenURL(OPERA, "http://www.leandroascierto.com.ar")
Call BrowserOpenURL(FIREFOX, "http://www.leandroascierto.com.ar")
End Sub
hice algunas correciones en la primera función para obtener las url.