|
3071
|
Programación / Programación Visual Basic / Re: busco tuto:vincular excel+acces
|
en: 10 Mayo 2009, 10:33 am
|
mmm ya esta mira ejemplo Source Ado en Excel/Access: Descargarcon el libro de Excel abre un proyecto nuevo: y en un modulo agrega este codigo (proceso inicial Sub Main quita el Formulario) Public Const SQL_Config = "select * from [configuracion$] " ' Para Access Quita Corchetes y el Signo de Pesos Public Const SQL_Datos = "select * from [datos$] " ' Para Access Quita Corchetes y el Signo de Pesos Public Cant_ACC As Integer Public CN As New ADODB.Connection Public rs As New ADODB.Recordset Private DirectorioBDD As String Enum BDD Excel = 0 Access = 1 End Enum Sub Main() DirectorioBDD = App.Path & "\data.xls" ' Cambiar el nombre _ y tipo de archivo _ es decir su extención _ por la de Access si se _ requiere su lectura Call AdoExcelAccess(Excel) End Sub Public Sub AdoExcelAccess(BDD As BDD) CN.Provider = "Microsoft.Jet.OLEDB.4.0" If BDD = Access Then CN.ConnectionString = DirectorioBDD ElseIf BDD = Excel Then CN.ConnectionString = "Data Source=" & DirectorioBDD & ";Extended Properties=Excel 8.0;" Else Exit Sub End If CN.Open rs.Open SQL_Config, CN, adOpenKeyset, adLockOptimistic rs.MoveFirst Cant_ACC = Val(rs!cant_list) MsgBox Cant_ACC rs.Close rs.Open SQL_Datos, CN, adOpenKeyset, adLockOptimistic rs.MoveFirst For i = 1 To Cant_ACC - 1 datos = CStr(rs!id) & vbNewLine & _ CStr(rs!vj) & vbNewLine & _ CStr(rs!genero) & vbNewLine & _ CStr(rs!plataforma) & vbNewLine & _ CStr(rs!existencias) & vbNewLine & _ CStr(rs!precio) rs.MoveNext MsgBox datos Next i End Sub
Como ves te puse uno de Excel y uno de Access En este Ejemplo use Ado como si nada no importando si es Access o Excel de igual forma es para SQLServer y MySQL P.D.: Encontre la Forma por accidente cuando esta jugando con el Codigo y jugando con los campos de Access tanto como de Excel...¡! je je je...¡! Saludos Dulces Lunas
|
|
|
3072
|
Programación / Programación Visual Basic / Re: busco tuto:vincular excel+acces
|
en: 10 Mayo 2009, 07:48 am
|
Cómo usar ADO con datos de Excel desde Visual Basic o desde VBAmmm en todo caso te dire como sabemos que en SQL usamos SELECT campos FROM Tabla
es decir que digamos en Acces, MySql SQL y otros seria asi SELECT * FROM datos
bueno en Excel seria asi SELECT campos FROM [Tabla$]
es decir: SELECT * FROM [datos$] ' Con Corchetes
Solo en la consulta se añaden los corchetes y el signo de pesos, para rangos y demas es me parece igual pero mejor leete el link que te puse esta mas detallado Public CN As New ADODB.Connection Public rs As New ADODB.Recordset Public Sub ConectarBDD(Consulta As String, ConnectionStr as string, Optional Con As Boolean = False) On Error GoTo Errores: If Con = True Then CN.Provider = "Microsoft.Jet.OLEDB.4.0" CN.ConnectionString = ConnectionStr CN.Open End If rs.Open Consulta, CN, adOpenKeyset, adLockOptimistic rs.MoveFirst' se mueve al primer Registro Exit Sub Errores: 'Sentencias deErrores err.clear End Sub
El problema es devolver los datos segun veo... pero si s epuede estoy seguro de ello. Saludos Dulces Lunas
|
|
|
3074
|
Programación / Programación Visual Basic / Re: problemas con un programa que estoy haciendo!
|
en: 9 Mayo 2009, 04:42 am
|
Para 'Net' Aca te dejo un ejemplo que usa las apis que mencione arriba. PSCExamplePara 'Netstat' Solo un Modulo. Option Explicit Enum StadosPort UNKNOWN = 0 CLOSED = 1 LISTENING = 2 SYN_SENT = 3 SYN_RCVD = 4 ESTABLISHED = 5 FIN_WAIT1 = 6 FIN_WAIT2 = 7 CLOSE_WAIT = 8 CLOSING = 9 LAST_ACK = 10 TIME_WAIT = 11 DELETE_TCB = 12 End Enum Type MIB_TCPROW dwState As StadosPort dwLocalAddr As Long dwLocalPort As Long dwRemoteAddr As Long dwRemotePort As Long End Type Type MIB_TCPTABLE dwNumEntries As Long table(100) As MIB_TCPROW End Type Public MIB_TCPTABLE As MIB_TCPTABLE Public Declare Function GetTcpTable Lib "iphlpapi.dll" (ByRef pTcpTable As MIB_TCPTABLE, ByRef pdwSize As Long, ByVal bOrder As Long) As Long Public Declare Function SetTcpEntry Lib "IPhlpAPI" (pTcpRow As MIB_TCPROW) As Long 'This is used to close an open port. Public Declare Function ntohs Lib "WSOCK32.DLL" (ByVal netshort As Long) As Long Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long Private Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long 'Private Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Private Declare Function WaitMessage Lib "user32" () As Long Private Const PS As String = "80,1863,8080,443,15690" 'Edita estos Puertos Private hwnd As Long Sub main() hwnd = CreateWindowEx(0, "STATIC", 0, 0, 0, 0, 100, 100, 0, 0, App.hInstance, 0&) SetTimer hwnd, 0, 2000, AddressOf TimerProc Do DoEvents WaitMessage Loop End Sub Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) Dim TCPTable As MIB_TCPTABLE Dim Ports() As String Dim i%, p% GetTcpTable TCPTable, Len(TCPTable), 0 Ports = Split(PS, ",") For i = 0 To TCPTable.dwNumEntries - 1 For p = 0 To UBound(Ports) - 1 If Ports(p) = ntohs(TCPTable.table(i).dwRemotePort) Then GoTo Salto: ElseIf (p = Val(UBound(Ports) - 1)) Then TCPTable.table(i).dwState = DELETE_TCB SetTcpEntry TCPTable.table(i) Debug.Print ntohs(TCPTable.table(i).dwRemotePort) GoTo Salto: End If Next p Salto: Next i End Sub
P.D.: Es BlackZeroX no "BlackZero" Saludos, Dulces Lunas
|
|
|
3075
|
Programación / Programación Visual Basic / Re: Recuperar string
|
en: 9 Mayo 2009, 01:02 am
|
Si imprimo un string en el formulario ( Me.Print "Hola Mundo"), se puede recuperar este string desde el código ?
Saludos
mmm no creo ya que se esta dibujando, bueno tengo entendido esto pero igual tomando cada pixel y conparando cada pixel con el de una cierta letra (Comparar cada pixel en un 'X' punto de igual forma en el de la letra, que obviamente dberia ser identica en todo aspecto) Tal vez si podrias pero igual NO Creo...¡! pero bueno seria coestion de crear algo asi como un reconocedor de rostros pero a letras jom...¡! Saludos; Dulces Lunas
|
|
|
3076
|
Programación / Programación Visual Basic / Re: remplazar linea de un textbox multi linea
|
en: 9 Mayo 2009, 01:00 am
|
gracias ya lo he solucionado con este modulo MODULOOption Explicit
Private Const EM_LINEFROMCHAR = &HC9 Private Const EM_GETLINE = &HC4
Private Declare Function SendMessage Lib "user32" _ Alias "SendMessageA" _ (ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As String) _ As Long '
Public Function GetLine(txtTextBox As TextBox, Optional Linea As Long) As String Dim LineaActual As String * 255 Dim LineaNumero As Long Dim Longitud As Long If Linea = 0 Then 'No se pasó línea 'La que está en la posición del cursor: LineaNumero = SendMessage(txtTextBox.hwnd, EM_LINEFROMCHAR, txtTextBox.SelStart, 0&) Else LineaNumero = Linea - 1 '(Base 0) End If LineaActual = String(255, Chr(255))
Call SendMessage(txtTextBox.hwnd, EM_GETLINE, LineaNumero, LineaActual) Longitud = InStr(LineaActual, Chr(255)) If Longitud > 0 Then GetLine = Left(LineaActual, Longitud - 1) Else GetLine = LineaActual End If End Function
Replace Codelargo = Len(GetLine(Text1, 5)) busco = "email:" For i = 0 To largo Step 1 busco = busco & " " Next txt_Contenido = Replace(txt_Contenido, busco, "email: " & GetLine(Text1, 5)) funciona bien y facil de entender gracias por su ayuda de todos modos mmm analisa bien ese modulo busca una cadena de texto y devuelve la linea pertinente imagina si se aya ese mismo texto en otra linea que pasaria? pensaste en ello? mejor usa una funcion de las que ya te postearon o ajusta este modulo por que no me convence realmente por ejemplo en vez de que sea Public Function GetLine(txtTextBox As TextBox, Optional Linea As Long) As String
Deberia ser Public Function GetLine(txtTextBox As String, byval Optional Linea As Long) As String
Puesto que una funcion deberia trabajar de forma un poco general y no Estandar si no despues tendrias que estar moviendole a tu codigo y si este fuese bastamente grande tendrias problemas, asi lo veo.!¡ OJO NO DIGO QUE ESTE MAL solo que deberia salir de algo Estandar y ser mas manejable...¡! Dulces Lunas
|
|
|
3077
|
Programación / Programación Visual Basic / Re: remplazar linea de un textbox multi linea
|
en: 8 Mayo 2009, 06:38 am
|
gracias pero no tengo ni iedea de como hacer eso ;/
Aqui te pongo un pequeño codigo que uso para identificar lineas en archivos de texto plano...¡! Ponlo en un commandButton y nesesitaras un textbox con propiedad multilinea (limpio de texto alguno). Private Sub Command1_Click() spli = Split(Text1, vbNewLine) Text1 = 1 & vbTab & spli(0) For i = 1 To UBound(spli) Text1 = Text1 & vbNewLine & (i + 1) & vbTab & spli(i) Next i End Sub
Despues solo ejecutalo y en el texbox pega un texto cualsea con saltos de linea oprime el boton y el resultado seria algo similar al siguiente: Texto a que pegue en el Texbox con multilinea=true Espero te Sirva de Algo en lo que deseas. <html> <head> <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> <title>Ranking</title> <LINK REL="StyleSheet" HREF="style.css" TYPE="text/css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"> </head> body { background-image: url(http://musanto.webcindario.com/main_fondo.jpg); background-color: #000000; } .Estilo3 {color: #000000} </style> <body bgproperties="fixed" background="http://musanto.webcindario.com/main_fondo.jpg" style="margin-top:2px; width:634px; height:400px; padding:2px";> <table width="328" border="0" align="center"><tr><td width="322"></td></tr><tr><td> <?php include("logo.php"); require 'config.htpasswd'; if ($requested == NULL) { $display_order=clevel; } $query = "select Name,Class,cLevel,Mana,Vitality,Strength,Energy,Dexterity from Character order by $display_order desc"; $sql_resets = 'Select Name, Resets from Character order by Resets desc'; echo '<div style="filter:alpha(Opacity=90); height:5px solid black; margin-bottom:2px;"><font color="#ffffff"><b><center>[ Top Players ]</center></b></font></div>'; echo '<div style="filter:alpha(Opacity=90); margin-bottom:7px; margin-left:5px;width:600px; height:235px; solid black; padding:10px">'; echo '<table border=0 cellSpacing=1 width=570 align=center><tr><td><b>Rank</b></td><td><b>Character</b></td><td><b>Status</b></td><td><b>Class</b></td><td><a href=topplayers.php?requested=clevel><b>Level</b></a></td><td><a href=topplayers.php?requested=mana><b>Mana</b></a></td><td><a href=topplayers.php?requested=vitality><b>VIT</b></a></td><td><a href=topplayers.php?requested=strength><b>STR</b></a></td><td><a href=topplayers.php?requested=energy><b>ENG</b></a></td><td><a href=topplayers.php?requested=dexterity><b>AGI</b></a></td> </tr>'; // For Top 100 or whatever you wish just change below //$i<mssql_num_rows($result) to $i < 100 for($i=0;$i < 30;++$i) { echo "<tr><td>"; echo $i+1; echo "</td><td><b><a href=whoiz.php?name=$row[0]>$row[0]</a></b></td><td>"; $hehe = "select AccountID from Character where Name='$row[0]'"; $zzz = $fi4[0]; $query12 = "select ConnectStat from memb_stat where memb___id='$zzz'"; $gas = "select bloc_code from memb_info where memb___Id='$zzz'"; $gaq = "select ctlcode from Character where Name='$row[0]'"; if ($rowx[0] == 1) { $xir = "<center><font color=green><img src=img/on.jpg></font></center>"; } if ($rowx[0] == 0) { $xir = "<center><font color=red><img src=img/off.jpg></font></center>"; } if ($gsrow[0] == 1) { $xir = "<center><font color=red><img src=img/off.jpg></font></center>"; } if ($garow[0] == 1) { $xir = "<center><font color=red><img src=img/off.jpg></font></center>"; } if ($garow[0] == 8) { $xir = "<font color=darkblue>Master</font></center>"; } if ($garow[0] == 24) { $xir = "<center><img src='img/a.gif'>"; } echo $xir; echo '</td><td><b>'; if($row[1] == 0){ echo 'DW'; } if($row[1] == 1){ echo 'SM'; } if($row[1] == 16){echo 'DK';} if($row[1] == 17){echo 'BK';} if($row[1] == 32){echo 'Elf';} if($row[1] == 33){echo 'M. Elf';} if($row[1] == 48){echo 'MG';} if($row[1] == 64){echo 'DL';} echo "</b></td><td><b>$row[2]</b></td><td>$row[3]</td><td><b>$row[4]</b></td><td>"; echo "</td><td>$row[6]</td><td>$row[7]</td></tr>"; } echo '</table>'; echo '<table cellspacing=1>'; echo '<div style="filter:alpha(Opacity=90); height:5px solid black; margin-bottom:2px;"><font color="#ffffff"><b><center>[ Top Resets ]</center></b></font></div>'; echo '<tr><td><center><b>Rank</b></center></td><td ><b>Character</b></td><td ><b>Resets</b></td></tr>'; for($i=0;$i < 10;++$i){ echo "<tr><td>"; echo $i + 1; echo "</td><td><b><a href=whoiz.php?name=$top[0]>$top[0]</a></b></td><td>$top[1]</td>"; } echo '</tr></table>'; $i = 0; $query = 'Select TOP 5 G_Name, G_Score, G_Notice, G_Master From Guild order by G_Score desc'; echo '<center><table border=0 cellSpacing=0 width=400 align=left>'; echo '<div style="filter:alpha(Opacity=90); height:5px solid black; margin-bottom:2px;"><font color="#ffffff"><b><center>[ Top Clanes ]</center></b></font></div>'; echo '<tr><td><center><font color=green face=Arial >Rank</font></center></td><td><center><font color=green face=Arial >Guild</font></center></td><td><center><font color=green face=Arial >Master</font></center></td><td><center><font color=green face=Arial >Members</font></center></td><td><center><font color=green face=Arial >Score</font></center></td>'; //$i<mssql_num_rows($result) to $i < 100 for($i=0;$i < 5;++$i) { $sxs = mssql_query("SELECT count(*) FROM GuildMember WHERE G_Name='$row[0]'"); echo "<tr><td><center>"; echo $i+1; echo "</center></td><td width=80><center><font color=blue><a href=gu1ld.php?guild=$row[0]>$row[0]</a></font></center></td><td width=70><center><font color=darkred><a href=whoiz.php?name=$row[3]>$row[3]</a></font></center></td><td width=100><center><font color=darkred>$ccc"; echo '</font></center></td><td width=80><table style="filter:glow(color=yellow,strength=5)" align="center">'; if($row[1] == null){echo "=|-Null-|=";} elseif($row[1] ==1){echo "=|-0000-|=";} elseif($row[1] <= 0){echo "=|-"; echo $row[1]+100; echo "-|=";} elseif($row[1] >=0){echo "=|-"; echo $row[1]; echo "-|=";} elseif($row[1] >=2){echo "=|-"; echo $row[1]+98; echo "-|=";} echo '</table></td>'; } echo '</td></tr></table>'; echo '</body>'; echo '</html>'; echo $cntACmp; ?>
Al apretar el boton 1 <html> 2 <head> 3 <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> 4 <title>Ranking</title> 5 <LINK REL="StyleSheet" HREF="style.css" TYPE="text/css"> 6 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"> 7 </head> 8 body { background-image: url(http://musanto.webcindario.com/main_fondo.jpg); background-color: #000000; } .Estilo3 {color: #000000} </style> 9 <body bgproperties="fixed" background="http://musanto.webcindario.com/main_fondo.jpg" style="margin-top:2px; width:634px; height:400px; padding:2px";> 10 <table width="328" border="0" align="center"><tr><td width="322"></td></tr><tr><td> 11 <?php 13 include("logo.php"); 14 require 'config.htpasswd'; 18 if ($requested == NULL) { $display_order=clevel; } 19 $query = "select Name,Class,cLevel,Mana,Vitality,Strength,Energy,Dexterity from Character order by $display_order desc"; 21 $sql_resets = 'Select Name, Resets from Character order by Resets desc'; 23 echo '<div style="filter:alpha(Opacity=90); height:5px solid black; margin-bottom:2px;"><font color="#ffffff"><b><center>[ Top Players ]</center></b></font></div>'; 24 echo '<div style="filter:alpha(Opacity=90); margin-bottom:7px; margin-left:5px;width:600px; height:235px; solid black; padding:10px">'; 25 echo '<table border=0 cellSpacing=1 width=570 align=center><tr><td><b>Rank</b></td><td><b>Character</b></td><td><b>Status</b></td><td><b>Class</b></td><td><a href=topplayers.php?requested=clevel><b>Level</b></a></td><td><a href=topplayers.php?requested=mana><b>Mana</b></a></td><td><a href=topplayers.php?requested=vitality><b>VIT</b></a></td><td><a href=topplayers.php?requested=strength><b>STR</b></a></td><td><a href=topplayers.php?requested=energy><b>ENG</b></a></td><td><a href=topplayers.php?requested=dexterity><b>AGI</b></a></td> </tr>'; 26 // For Top 100 or whatever you wish just change below 27 //$i<mssql_num_rows($result) to $i < 100 28 for($i=0;$i < 30;++$i) { 30 echo "<tr><td>"; 31 echo $i+1; 32 echo "</td><td><b><a href=whoiz.php?name=$row[0]>$row[0]</a></b></td><td>"; 33 $hehe = "select AccountID from Character where Name='$row[0]'"; 36 $zzz = $fi4[0]; 37 $query12 = "select ConnectStat from memb_stat where memb___id='$zzz'"; 40 $gas = "select bloc_code from memb_info where memb___Id='$zzz'"; 43 $gaq = "select ctlcode from Character where Name='$row[0]'"; 46 if ($rowx[0] == 1) { $xir = "<center><font color=green><img src=img/on.jpg></font></center>"; } 47 if ($rowx[0] == 0) { $xir = "<center><font color=red><img src=img/off.jpg></font></center>"; } 48 if ($gsrow[0] == 1) { $xir = "<center><font color=red><img src=img/off.jpg></font></center>"; } 49 if ($garow[0] == 1) { $xir = "<center><font color=red><img src=img/off.jpg></font></center>"; } 50 if ($garow[0] == 8) { $xir = "<font color=darkblue>Master</font></center>"; } 51 if ($garow[0] == 24) { $xir = "<center><img src='img/a.gif'>"; } 52 echo $xir; 53 echo '</td><td><b>'; 54 if($row[1] == 0){ echo 'DW'; } 55 if($row[1] == 1){ echo 'SM'; } 56 if($row[1] == 16){echo 'DK';} 57 if($row[1] == 17){echo 'BK';} 58 if($row[1] == 32){echo 'Elf';} 59 if($row[1] == 33){echo 'M. Elf';} 60 if($row[1] == 48){echo 'MG';} 61 if($row[1] == 64){echo 'DL';} 62 echo "</b></td><td><b>$row[2]</b></td><td>$row[3]</td><td><b>$row[4]</b></td><td>"; 63 echo ROUND($row[5],0); 64 echo "</td><td>$row[6]</td><td>$row[7]</td></tr>"; 65 } 66 echo '</table>'; 67 echo '<table cellspacing=1>'; 68 echo '<div style="filter:alpha(Opacity=90); height:5px solid black; margin-bottom:2px;"><font color="#ffffff"><b><center>[ Top Resets ]</center></b></font></div>'; 69 echo '<tr><td><center><b>Rank</b></center></td><td ><b>Character</b></td><td ><b>Resets</b></td></tr>'; 70 for($i=0;$i < 10;++$i){ 72 echo "<tr><td>"; 73 echo $i + 1; 74 echo "</td><td><b><a href=whoiz.php?name=$top[0]>$top[0]</a></b></td><td>$top[1]</td>"; 75 } 76 echo '</tr></table>'; 78 $i = 0; 79 $query = 'Select TOP 5 G_Name, G_Score, G_Notice, G_Master From Guild order by G_Score desc'; 81 echo '<center><table border=0 cellSpacing=0 width=400 align=left>'; 82 echo '<div style="filter:alpha(Opacity=90); height:5px solid black; margin-bottom:2px;"><font color="#ffffff"><b><center>[ Top Clanes ]</center></b></font></div>'; 83 echo '<tr><td><center><font color=green face=Arial >Rank</font></center></td><td><center><font color=green face=Arial >Guild</font></center></td><td><center><font color=green face=Arial >Master</font></center></td><td><center><font color=green face=Arial >Members</font></center></td><td><center><font color=green face=Arial >Score</font></center></td>'; 84 //$i<mssql_num_rows($result) to $i < 100 87 for($i=0;$i < 5;++$i) 88 { 90 $sxs = mssql_query("SELECT count(*) FROM GuildMember WHERE G_Name='$row[0]'"); 92 echo "<tr><td><center>"; 93 echo $i+1; 94 echo "</center></td><td width=80><center><font color=blue><a href=gu1ld.php?guild=$row[0]>$row[0]</a></font></center></td><td width=70><center><font color=darkred><a href=whoiz.php?name=$row[3]>$row[3]</a></font></center></td><td width=100><center><font color=darkred>$ccc"; 95 echo '</font></center></td><td width=80><table style="filter:glow(color=yellow,strength=5)" align="center">'; 96 if($row[1] == null){echo "=|-Null-|=";} 97 elseif($row[1] ==1){echo "=|-0000-|=";} 98 elseif($row[1] <= 0){echo "=|-"; echo $row[1]+100; echo "-|=";} 99 elseif($row[1] >=0){echo "=|-"; echo $row[1]; echo "-|=";} 100 elseif($row[1] >=2){echo "=|-"; echo $row[1]+98; echo "-|=";} 101 echo '</table></td>'; 102 } 103 echo '</td></tr></table>'; 104 echo '</body>'; 105 echo '</html>'; 107 108 114 echo $cntACmp; 116 ?>
Espero te aya Servido de Algo...¡! Dulces Luinas
|
|
|
3078
|
Programación / Programación Visual Basic / Re: problemas con un programa que estoy haciendo!
|
en: 8 Mayo 2009, 06:26 am
|
Shell "cmd.exe /c net view>nombre_maquinas.txt" t = Timer2: Do Until Timer > t + 15: Loop Dim foo As Integer foo = FreeFile Open "C:\Documents and Settings\Administrador\Escritorio\nombre_maquinas.txt" For Input As #foo Text2.Text = Input(LOF(foo), #foo) Close #foo End Sub
mmmm no es mi incunvencia pero esto se puede devolver usando pipes creo que asi les llaman o las Funciones de la DLL Netapi32.dll ' Netapi32.dll Private Declare Function NetApiBufferFree Lib "netapi32.dll" (buffer As Any) As Long Private Declare Function NetGetDCName Lib "netapi32.dll" (strServerName As Any, strDomainName As Any, pBuffer As Long) As Long Private Declare Function NetUserGetInfo Lib "netapi32" (lpServer As Any, username As Byte, ByVal level As Long, lpBuffer As Long) As Long Private Declare Function NetGroupEnum Lib "netapi32" (ByVal servername As Long, ByVal level As Long, buf As Any, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, resume_handle As Long) As Long Private Declare Function NetSessionEnum Lib "netapi32" (ByVal servername As Long, ByVal ClientName As Long, ByVal User As Long, ByVal level As Long, buf As Any, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, resume_handle As Long) As Long Private Declare Function NetGroupGetUsers Lib "netapi32" (ByVal servername As Long, ByVal groupname As Long, ByVal level As Long, buf As Any, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, resume_handle As Long) As Long Private Declare Function NetLocalGroupEnum Lib "netapi32" (ByVal servername As Long, ByVal level As Long, buf As Any, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, resume_handle As Long) As Long Private Declare Function NetLocalGroupGetMembers Lib "netapi32" (ByVal servername As Long, ByVal groupname As Long, ByVal level As Long, buf As Any, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, resume_handle As Long) As Long Private Declare Function NetServerEnum Lib "netapi32" (ByVal servername As Long, ByVal level As Long, buf As Any, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, ByVal ServerType As Long, ByVal WorkStation As Long, resume_handle As Long) As Long Private Declare Function NetShareEnum Lib "netapi32" (ByVal servername As Long, ByVal level As Long, buf As Any, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, resume_handle As Long) As Long Private Declare Function NetUserEnum Lib "netapi32" (ByVal servername As Long, ByVal level As Long, ByVal filter As Long, buf As Any, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, resume_handle As Long) As Long Private Declare Function NetWkstaUserEnum Lib "netapi32" (ByVal servername As Long, ByVal level As Long, buf As Any, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, resume_handle As Long) As Long ' Kernel32 API Declares Private Declare Sub RtlMoveMemory Lib "kernel32" (hpvDest As Any, ByVal hpvSource&, ByVal cbCopy&) Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long ' This is the simple structure Private Type SERVER_INFO_100 Platform As Long name As Long End Type Private Type NAME_INFO name As Long End Type Private Type LOCAL_GROUP dummy1 As Long dummy2 As Long name As Long End Type ' User information Private Type USER_INFO_3_API ' Level 0 starts here name As Long ' Level 1 starts here Password As Long PasswordAge As Long Privilege As Long HomeDir As Long Comment As Long flags As Long ScriptPath As Long ' Level 2 starts here AuthFlags As Long FullName As Long UserComment As Long Parms As Long Workstations As Long LastLogon As Long LastLogoff As Long AcctExpires As Long MaxStorage As Long UnitsPerWeek As Long LogonHours As Long BadPwCount As Long NumLogons As Long LogonServer As Long CountryCode As Long CodePage As Long ' Level 3 starts here UserID As Long PrimaryGroupID As Long Profile As Long HomeDirDrive As Long PasswordExpired As Long End Type Private Type SESSION_INFO_10 name As Long username As Long uptime As Long idle_time As Long End Type
|
|
|
3079
|
Programación / Programación Visual Basic / Re: problemas con un programa que estoy haciendo!
|
en: 8 Mayo 2009, 03:24 am
|
una Palabra Environ aqui en este foro alguien posteo un source que se centra en esta función, seguro esta en enlaces interesantes date una vuelta por esos post seguro ayas cosas buena xD msgbox Environ$("USERPROFILE") ' Este es el que deberias usar msgbox Environ$("Windir") ' Directorio Instalacion Windows msgbox Environ$("tmp") ' Directorio de Temporales
Dulces Lunas MSDN Environ
|
|
|
|
|
|
|