elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado:


  Mostrar Mensajes
Páginas: 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21] 22 23
201  Programación / Programación Visual Basic / Re: [Ayuda] DLL en VB en: 15 Octubre 2010, 18:27 pm
.
Como Dato:

Código
  1.  
  2. Private Function MTrim(ByVal s As String) As String
  3. Dim i As Long
  4. Dim res As String
  5.  
  6. For i = 1 To Len(s)
  7.    If Mid$(s, i, 1) <> Chr$(0) Then
  8.        res = res & Mid$(s, i, 1)
  9.    End If
  10. Next
  11.  
  12. MTrim = res
  13. End Function
  14.  
  15.  

Queda mejor asi!¡:

Código
  1.  
  2. Private Function NullTrim(ByVal vDataIn As String) As String
  3. Dim Lng_Pos                                 As Long
  4.    Lng_Pos = InStr(1, vDataIn, Chr(0)) - 1
  5.    If Lng_Pos > 0 Then NullTrim = Mid$(vDataIn, 1, Lng_Pos)
  6. End Function
  7.  
  8.  

Para quitar los chr(0) de los string (Unicode) solo se me ocurrre hacer esto en un array de bytes.

Código
  1.  
  2.    Dim arrbyte() As Byte
  3.    arrbyte() = StrConv("hola", VbStrConv.vbFromUnicode)
  4.    MsgBox Chr(arrbyte(0)) & Chr(arrbyte(1)) & Chr(arrbyte(2)) & Chr(arrbyte(3))
  5.  
  6.  

Dulces Lunas!¡.

Si la función en VB tiene vbFromUnicode, en C++, se me crashea, eso lo pensé y lo intenté pero sin resultados favorables. :)
Lo has probado?
202  Programación / Programación Visual Basic / Re: [Ayuda] DLL en VB en: 14 Octubre 2010, 21:34 pm
Hola, finalmente pude lograrlo.

Código de la DLL:

MIREN QUE HAY COSAS QUE LAS PUSE PARA HACER DEDUCCIONES Y PRUEBAS.

Código
  1. Option Explicit
  2.  
  3. Public Const DLL_PROCESS_DETACH = 0 ':El proceso descarga la DLL
  4. Public Const DLL_PROCESS_ATTACH = 1 ': Cuando un proceso carga la DLL
  5. Public Const DLL_THREAD_ATTACH = 2 ': El proceso está recargando una DLL
  6. Public Const DLL_THREAD_DETACH = 3 ':El proceso está descargando una Dll recargada
  7.  
  8. Public Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
  9.  
  10. Public Function DllMain(hInst As Long, fdwReason As Long, lpvReserved As Long) As Boolean
  11. Select Case fdwReason
  12.    Case DLL_PROCESS_DETACH
  13.        'No per-process cleanup needed
  14.    Case DLL_PROCESS_ATTACH
  15.        MsgBox "Project1.dll Injected!"
  16.        'MsgBox "End of Search!"
  17.        DllMain = True
  18.    Case DLL_THREAD_ATTACH
  19.        'No per-thread initialization needed
  20.    Case DLL_THREAD_DETACH
  21.        'No per-thread cleanup needed
  22. End Select
  23. 'DllMain = True
  24. End Function
  25.  
  26. Public Sub Mensaje()
  27. MessageBox 0&, "Test", "Mensaje", 0&
  28. End Sub
  29.  
  30. Public Function Suma(ByVal N1 As Long, ByVal N2 As Long) As Long
  31. Suma = N1 + N2
  32. 'MessageBox 0, Suma, "Resultado", 0
  33. End Function
  34.  
  35. 'Public Function Mensaje2(ByVal Msg As String) As String
  36. 'Mensaje2 = Msg
  37. 'End Function
  38. Public Function Mensaje2() As String
  39. ' Las cadenas de VB6 son Unicode y al usarla desde una DLL
  40. ' se hace un follón... así que debemos quitarles los Chr$(0)
  41. ' que tenga en medio
  42. 'Dim str As String * 4
  43.  
  44. 'str = "Hola"
  45.  
  46. 'Mensaje2 = str
  47. Mensaje2 = "Esto es una prueba."
  48. End Function
  49.  
  50. Public Function LenString(ByVal Cadena As String) As Integer
  51. LenString = Len(Cadena)
  52. End Function
  53.  
  54. Private Function MTrim(ByVal s As String) As String
  55. Dim i As Long
  56. Dim res As String
  57.  
  58. For i = 1 To Len(s)
  59.    If Mid$(s, i, 1) <> Chr$(0) Then
  60.        res = res & Mid$(s, i, 1)
  61.    End If
  62. Next
  63.  
  64. MTrim = res
  65. End Function
  66.  

En C++, lo pueden abrir desde VC++ 6.0 (Mi favorito) o del VS 2009, etc.

HAY MUCHO CÓDIGO PORQUE PROBÉ DEMASIADAS COSAS.

Código
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <string>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. typedef void (WINAPI*MsgFunction) ();
  9. typedef long (WINAPI*SumaFunction) (long,long);
  10.  
  11. void MyDLL();
  12. void MyDLL2();
  13. void MyDLL3();
  14. void MyDLL4();
  15.  
  16.  
  17. string MTrim(char *);
  18. string MTrim(char *, int);
  19. int tStrLen(char *);
  20. bool IsValid(char);
  21.  
  22. //Declaramos el ProcID de la dll
  23. //HINSTANCE hGetProcIDDLL = LoadLibrary("Project1.dll");
  24.  
  25. int main()
  26. {
  27. MyDLL4();
  28. /*
  29. MsgFunction MsgBox;
  30. SumaFunction Suma;
  31.  
  32. HINSTANCE hinstDLL = LoadLibrary("Project1.dll");
  33.  
  34. if(hinstDLL != 0)
  35. {
  36. printf("DLL LOADED.\n");
  37. MsgBox = (MsgFunction)GetProcAddress(hinstDLL,"Mensaje");
  38.  
  39. MsgBox();
  40.  
  41.  
  42.  
  43. Suma = (SumaFunction)GetProcAddress(hinstDLL,"Suma");
  44.  
  45. long x = Suma(6,6);
  46. if(x == 12)
  47. {
  48. cout << "Message Displayed!\n";
  49. }
  50.  
  51. // Unload DLL file
  52. FreeLibrary(hinstDLL);
  53. }
  54. else
  55. {
  56. printf("DLL NOT LOADED.\n");
  57. }
  58. */
  59. system("PAUSE");
  60. return 0;
  61. }
  62.  
  63. void MyDLL()
  64. {
  65. /* get handle to dll */
  66. HINSTANCE hGetProcIDDLL = LoadLibrary("Project1.dll");
  67.  
  68.  
  69. /* get pointer to the function in the dll*/
  70. FARPROC lpfnGetProcessID = GetProcAddress((HMODULE)hGetProcIDDLL,"Mensaje");
  71.  
  72. /*
  73.     Define the Function in the DLL for reuse. This is just prototyping
  74.     the dll's function. A mock of it. Use "stdcall" for maximum
  75.     compatibility.
  76. */
  77. typedef void (__stdcall * pICFUNC)(HWND);
  78. pICFUNC MyFunction;
  79.  
  80.    if (hGetProcIDDLL==NULL)
  81.    {
  82.        printf("Can not open the Library\n");
  83. }
  84. else
  85. {
  86. printf("CAN open the Library\n");
  87. }
  88. MyFunction = (pICFUNC)lpfnGetProcessID;
  89.  
  90. /* The actual call to the function contained in the dll */
  91. MyFunction(NULL);
  92.  
  93. /* Release the Dll */
  94. FreeLibrary(hGetProcIDDLL);
  95. }
  96.  
  97. void MyDLL2()
  98. {
  99. /* get handle to dll */
  100. HINSTANCE hGetProcIDDLL = LoadLibrary("Project1.dll");
  101.  
  102.  
  103. /* get pointer to the function in the dll*/
  104. FARPROC lpfnGetProcessID = GetProcAddress((HMODULE)hGetProcIDDLL,"Suma");
  105.  
  106. /*
  107.     Define the Function in the DLL for reuse. This is just prototyping
  108.     the dll's function. A mock of it. Use "stdcall" for maximum
  109.     compatibility.
  110. */
  111. typedef long (__stdcall * pICFUNC)(long,long);
  112. pICFUNC MyFunction;
  113.  
  114.    if (hGetProcIDDLL==NULL)
  115.    {
  116.        printf("Can not open the Library\n");
  117. }
  118. else
  119. {
  120. printf("CAN open the Library\n");
  121. }
  122. MyFunction = (pICFUNC)lpfnGetProcessID;
  123.  
  124. /* The actual call to the function contained in the dll */
  125. long x = MyFunction(5,5);
  126. //printf("Result: %l\n",x);
  127. cout <<"Resultado: ";
  128. cout << x;
  129. cout << '\n';
  130.  
  131. cout <<"Resultado: " << x <<'\n';
  132.  
  133. //cout <<"El valor decimal de número es:" << numero << '\n';
  134. //cout <<"El valor octal de número es:" << oct <<numero << '\n';
  135. //cout <<"El valor hexadecimal de número es:" << hex <<numero << '\n';
  136. //Si se hace otro cout de algun numero, lo muestra en hex, xq fue
  137. //el último que usamos
  138.  
  139. /* Release the Dll */
  140. FreeLibrary(hGetProcIDDLL);
  141. }
  142.  
  143. void MyDLL3()
  144. {
  145. /* get handle to dll */
  146. HINSTANCE hGetProcIDDLL = LoadLibrary("Project1.dll");
  147.  
  148.  
  149. /* get pointer to the function in the dll*/
  150. FARPROC lpfnGetProcessID = GetProcAddress((HMODULE)hGetProcIDDLL,"Mensaje2");
  151.  
  152. /*
  153.     Define the Function in the DLL for reuse. This is just prototyping
  154.     the dll's function. A mock of it. Use "stdcall" for maximum
  155.     compatibility.
  156. */
  157. typedef char * (__stdcall * pICFUNC)(); //LPCSTR
  158. //typedef void (CALLBACK* pICFUNC)();
  159.  
  160. pICFUNC MyFunction;
  161.  
  162.    if (hGetProcIDDLL==NULL)
  163.    {
  164.        printf("Can not open the Library\n");
  165. }
  166. else
  167. {
  168. printf("CAN open the Library\n");
  169. }
  170. MyFunction = (pICFUNC)lpfnGetProcessID;
  171.  
  172. /* The actual call to the function contained in the dll */
  173. //MessageBox(NULL, MyFunction(),"CAPTION",MB_OK);
  174.  
  175. char * ss = MyFunction();
  176. //cout << MTrim(ss) << "\n";
  177.  
  178. /* Release the Dll */
  179. FreeLibrary(hGetProcIDDLL);
  180. }
  181.  
  182. void MyDLL4()
  183. {
  184. /* get handle to dll */
  185. HINSTANCE hGetProcIDDLL = LoadLibrary("Project1.dll");
  186.  
  187.  
  188. /* get pointer to the function in the dll*/
  189. FARPROC lpfnGetProcessID = GetProcAddress((HMODULE)hGetProcIDDLL,"Mensaje2");
  190. FARPROC lpfnGetProcessID2 = GetProcAddress((HMODULE)hGetProcIDDLL,"LenString");
  191.  
  192. /*
  193.     Define the Function in the DLL for reuse. This is just prototyping
  194.     the dll's function. A mock of it. Use "stdcall" for maximum
  195.     compatibility.
  196. */
  197. typedef char * (__stdcall * pICFUNC)(); //LPCSTR
  198. typedef int (__stdcall * pICFUNC2)(char *); //LPCSTR
  199. //typedef void (CALLBACK* pICFUNC)();
  200.  
  201. pICFUNC MyFunction;
  202. pICFUNC2 MyFunction2;
  203.  
  204.    if (hGetProcIDDLL==NULL)
  205.    {
  206.        printf("Can not open the Library\n");
  207. }
  208. else
  209. {
  210. printf("CAN open the Library\n");
  211. }
  212.  
  213. MyFunction = (pICFUNC)lpfnGetProcessID;
  214. MyFunction2 = (pICFUNC2)lpfnGetProcessID2;
  215.  
  216. /* The actual call to the function contained in the dll */
  217. //MessageBox(NULL, MyFunction(),"CAPTION",MB_OK);
  218.  
  219.  
  220. char * ss = MyFunction();
  221.  
  222. cout << "Longitud: " << MyFunction2(ss) << "\n\n";
  223. cout << "Supuesta cadena: " << ss << "\n\n";
  224.  
  225. cout << "Forma Frutera: " << MTrim(ss) << "\n\n";
  226. cout << "A la gran Misery: " << MTrim(ss, MyFunction2(ss)) << "\n\n";
  227.  
  228. /* Release the Dll */
  229. FreeLibrary(hGetProcIDDLL);
  230. }
  231.  
  232. string MTrim(char * s)
  233. {
  234. long i;
  235. string res="";
  236. char chr = char(0);
  237.  
  238. //cout << "Longitud: " << tStrLen("Hola") << "\n";
  239. //cout << "Longitud: " << strlen(s) << "\n";
  240. //cout << "Longitud: " << sizeof(s) << "\n";
  241. //cout << "Longitud: " << s.length() << "\n";
  242.  
  243. for(i=0; i < 16 ;i++) //Testin'
  244. {
  245. if(s[i] != chr)
  246. {
  247. res = res + s[i];
  248. }
  249. }
  250. return res;
  251. }
  252.  
  253. string MTrim(char * s,int len)
  254. {
  255. long i;
  256. string res="";
  257. char chr = char(0);
  258. int acum=0;
  259. //cout << "Longitud: " << tStrLen("Hola") << "\n";
  260. //cout << "Longitud: " << strlen(s) << "\n";
  261. //cout << "Longitud: " << sizeof(s) << "\n";
  262. //cout << "Longitud: " << s.length() << "\n";
  263.  
  264. for(i=0; acum < len ;i++) //Testin'
  265. {
  266. if(IsValid(s[i]) == true && s[i] != chr)
  267. {
  268. res = res + s[i];
  269. acum++;
  270. }
  271. }
  272. return res;
  273. }
  274.  
  275. bool IsValid(char s)
  276. {
  277. char valid[] = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMÑOPQRSTUVWXYZ0123456789 ,.-!$%&/()=?¿*;_¬[]{}";
  278.  
  279. for(int i = 0; i < strlen(valid); i++)
  280. {
  281. if(valid[i] == s)
  282. {
  283. return true;
  284. }
  285. }
  286. return false;
  287. }
  288.  
  289. //Función que devuelve la longitud de una cadena
  290. int tStrLen(char * s)
  291. {
  292.  char *        s0= s;
  293.  while (*s++);
  294.  return s - s0 - 1;
  295. }
  296.  

Lo último que hice fue basado en el, MyDLL4().

Lo que hago es llamar a la función de que me retorna un STRING, luego con una misma funcion de la DLL obtengo la longitud del string, porque no podía obtener la logitud verdadera.

MyFunction es el Mensaje, osea, lo que retorna la CADENA.
Con MyFunction2 obtengo la longitud.

Después uso un MTrim re frutero que lo hice después de muchos intentos xD.

El MTrim con 2 parámetros es el que nos interesa.

Que le paso la cadena y la longitud, y ahí está como hice, osea sólo permito ciertos dígitos y luego voy contando cuantos caracteres fueron agregandose para saber si es la longitud de la cadena.

Código
  1. char * ss = MyFunction();
  2.  
  3. cout << "Longitud: " << MyFunction2(ss) << "\n\n";
  4. cout << "Supuesta cadena: " << ss << "\n\n";
  5.  
  6. cout << "Forma Frutera: " << MTrim(ss) << "\n\n";
  7. cout << "A la gran Misery: " << MTrim(ss, MyFunction2(ss)) << "\n\n";
  8.  

Bueno, desde ya muchísimas gracias a todos y a BlackZeroX por darme esa pista. :). Suerte.

PD: Obviamente está todo desprolijo y no optimizado, pero así estuve por más de 3 días. :)
PD2: Me falta hacer el pasaje del MessageBox.
203  Programación / Programación Visual Basic / Re: [Ayuda] DLL en VB en: 13 Octubre 2010, 19:56 pm
Interesante, pero como paso esto a C++?

Private Function MTrim(ByVal s As String) As String
Dim i As Long
Dim res As String

For i = 1 To Len(s)
    If Mid$(s, i, 1) <> Chr$(0) Then
        res = res & Mid$(s, i, 1)
    End If
Next

MTrim = res
End Function

Cuando lo tenga en C++, teoricamente tendría que funcionar? :O:O:O. Desde ya muchas gracias.
204  Programación / Programación C/C++ / Re: [Ayuda] C++ llamando Dll en: 13 Octubre 2010, 16:13 pm
Lo que pasa es que ese 0 equivale a ésto. Private Const MB_OK = &H0&

El problema es nativo del VB creo, hay que transformarlo para que en otro lenguaje lo pueda tomar, pero no sé como.
205  Programación / Programación Visual Basic / [Solucionado] DLL en VB en: 13 Octubre 2010, 12:40 pm
Hola, tengo un problema, yo por ej creo una DLL en VB que posee lo siguiente:

Código
  1. Option Explicit
  2.  
  3. Public Function Mensaje(ByVal Msg As String) As String
  4. Mensaje = Msg
  5. End Function
  6.  

Cuando lo llamo desde C++, por un MessageBox(NULL,MyFunction("Mensaje"),"CAPTION",MB_OK); me lo muestra vacío, alguna idea?

Y si tienen la solución a este Thread http://foro.elhacker.net/programacion_visual_basic/ayuda_callings_sub_y_functions-t307209.0.html sería un combo BOX  :laugh:
206  Programación / Programación C/C++ / Re: [Ayuda] C++ llamando Dll en: 12 Octubre 2010, 23:08 pm
Gracias, pero eso utiliza referencias, osea reutiliza el codigo de la dll, aca tengo la dll en la carpeta con esa función sola, para testear el programa y un proyecto en VC++ el cuál estoy tratando de llamar a esa funcion.

Lh: No hagas doble post, utiliza el botón modificar.

Pude lograr que no tire error, pero no me muestra el MsgBox "Mensaje!"

Código
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. typedef void (*MsgFunction) (void);
  7.  
  8. HINSTANCE hinstDLL;
  9.  
  10. int main()
  11. {
  12. MsgFunction MsgBox;
  13. hinstDLL = LoadLibrary("Project1.dll");
  14. if(hinstDLL != 0)
  15. {
  16. printf("DLL LOADED.\n");
  17. MsgBox = (MsgFunction)GetProcAddress(hinstDLL,"Mensaje");
  18.  
  19. if(MsgBox != 0)
  20. {
  21. printf("FUNCTION FOUND.\n");
  22. //Call Function
  23. MsgBox;
  24. }
  25. else
  26. {
  27. printf("FUNCTION NOT FOUND.\n");
  28. }
  29.  
  30. // Unload DLL file
  31. FreeLibrary(hinstDLL);
  32. }
  33. else
  34. {
  35. printf("DLL NOT LOADED.\n");
  36. }
  37. system("PAUSE");
  38. return 0;
  39. }
  40.  


Lh: Uniendo mensajes nuevamente, la próxima borro sin aviso. Utiliza el botón modificar.


Pude arreglar el problema, uno era en typedef, que le tenía que agregar WINAPI y otro en llamar a la función, para eso hice 2 funciones, una Mensaje y otra Suma, la Suma lo hace bien sin errores, pero a la hora de llamar a Mensaje, me muestra el mensaje ("Test") y luego crashea el programa tirando error ModName: msvbm60.dll. Alguna idea?

Acá les dejo todo el código:

Código
  1. Option Explicit
  2.  
  3. Public Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
  4.  
  5. Public Sub Mensaje()
  6. MessageBox 0, "Test", "Caption", 0
  7. End Sub
  8.  
  9. Public Function Suma(ByVal n1 As Long, ByVal N2 As Long) As Long
  10. Suma = n1 + N2
  11. End Function

Código
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. typedef void (WINAPI*MsgFunction) ();
  7. typedef long (WINAPI*SumaFunction) (long,long);
  8.  
  9. int main()
  10. {
  11. MsgFunction MsgBox;
  12. SumaFunction Suma;
  13.  
  14. HINSTANCE hinstDLL = LoadLibrary("Project1.dll");
  15.  
  16. if(hinstDLL != 0)
  17. {
  18. printf("DLL LOADED.\n");
  19. MsgBox = (MsgFunction)GetProcAddress(hinstDLL,"Mensaje");
  20.  
  21. MsgBox();
  22.  
  23.  
  24.  
  25. Suma = (SumaFunction)GetProcAddress(hinstDLL,"Suma");
  26.  
  27. long x = Suma(6,6);
  28. if(x == 12)
  29. {
  30. cout << "Message Displayed!\n";
  31. }
  32.  
  33. // Unload DLL file
  34. FreeLibrary(hinstDLL);
  35. }
  36. else
  37. {
  38. printf("DLL NOT LOADED.\n");
  39. }
  40.  
  41. system("PAUSE");
  42. return 0;
  43. }
207  Programación / Programación C/C++ / [Ayuda] C++ llamando Dll en: 12 Octubre 2010, 22:28 pm
Hola a todos, tengo una duda.

Tengo una Dll hecha en VB6,

Código
  1. Public Sub Mensaje()
  2. Msgbox "Mensaje!"
  3. End Sub
  4.  

Como llamo a esa funcion desde C++?, ya probé con LoadLibrary y me tira error,

Código
  1. // DLL function signature
  2. typedef double (*importFunction)(void);
  3.  
  4. importFunction MyFunction;
  5. // Load DLL file
  6. HINSTANCE hinstLib = LoadLibrary("Project1.dll");
  7. if (hinstLib == NULL)
  8. {
  9. MessageBox(0,"ERROR: unable to load DLL","Error",0);
  10. }
  11. else
  12. {
  13. // Get function pointer
  14. MyFunction = (importFunction)GetProcAddress(hinstLib, "Mensaje");
  15. if (MyFunction == NULL)
  16. {
  17. MessageBox(0,"ERROR: unable to find DLL function","Error",0);
  18. FreeLibrary(hinstLib);
  19. }
  20. else
  21. {
  22.  
  23. MyFunction();
  24.  
  25. // Unload DLL file
  26. FreeLibrary(hinstLib);
  27. }
  28. }
  29.  

alguna idea? Desde ya muchas gracias, si quieren subo los archivos.

Edit:
Es verdad  :laugh:, lo que pasa es que estaba muy desesperado xDDDDD, ahi lo etiqueté  ;-)
208  Programación / Programación Visual Basic / Re: [Ayuda] Callings Sub y Functions en: 11 Octubre 2010, 23:55 pm
Hola, quería saber si me podrían guiar con este tema:

Yo inyecto una dll en un programa, el programa tiene muchas funciónes y procedimientos, como hago para llamarlos desde la dll inyectada? alguna idea? Desde ya muchas gracias por resolver y aclarar mis dudas en los posts. :D ;-) :laugh: ;-) :laugh:

Ej: del ejecutable.

Option Explicit

Private Sub Command1_Click()
Dim var As Long

var = VarPtr(Valor(1, 1))

MsgBox var & " (" & Hex(var) & ")"
End Sub

Public Function Valor(ByVal v1 As Long, ByVal v2 As Long) As Long
Valor = v1 + v2
End Function

Esto hice para saber el address de la función.

lo que haces hay no es devolver la dirección del proceso, devuelves la dirrecion de variable de RESULTADO del Proceso

si quieres saber la dirrecion del Proceso, Funcion, u otra cosa similar

En un Modulo (Bas)

Código
  1.  
  2. Option Explicit
  3.  
  4. Sub main()
  5. Dim ThisAddress&
  6.    ThisAddress& = Adrs&(AddressOf procesoX)
  7.    MsgBox ThisAddress& & " - (" & Hex(ThisAddress&) & ")"
  8. End Sub
  9.  
  10. Public Function Adrs(ByVal Addrs As Long) As Long
  11.    Adrs& = Addrs&
  12. End Function
  13.  
  14. Public Function procesoX(ParamArray ParametrosX() As Variant) As String
  15.  
  16. End Function
  17.  
  18.  

Dulce Infierno Lunar!¡.


Y como puedo hacer ahora para llamar esta funcion desde una dll (Injected) :), desde ya muchisimas gracias :)
209  Programación / Programación Visual Basic / Re: Como Desbloquear un Array... en: 10 Octubre 2010, 08:02 am
Hola, el error 10 es porque ya dimensionaste antes el array, ej:

Esto tendrías que poner:

Código
  1. Dim arr()  As Long
  2.  
  3. ReDim arr(0 To 5)
  4.  
  5. arr(0) = 12
  6. arr(1) = 13
  7. arr(2) = 14
  8. arr(3) = 15
  9. arr(4) = 16
  10. arr(5) = 17
  11.  

Pero tu codigo sigue funcionando mal :(.

Asi que lo hice a mano, tal vez lo puedas mejorar o arreglar,

Código
  1. Private Sub Form_Load()
  2. Dim arr()  As Long
  3.  
  4. ReDim arr(0 To 5)
  5.    arr(0) = 12
  6.    arr(1) = 13
  7.    arr(2) = 14
  8.    arr(3) = 15
  9.    arr(4) = 16
  10.    arr(5) = 17
  11.    NewRemoveInArrayLong 4, arr
  12. End Sub
  13.  
  14. Private Function NewRemoveInArrayLong(ByVal Index&, ByRef ThisArray() As Long) As Boolean
  15. Dim tArray() As Long
  16. Dim i As Integer
  17.  
  18. If Not IsArray(ThisArray) Or Index& = -1 Then
  19.    NewRemoveInArrayLong = False
  20.    Exit Function
  21. End If
  22.  
  23. If Index& = UBound(ThisArray) Then
  24.    ReDim Preserve ThisArray(LBound(ThisArray) To (UBound(ThisArray) - 1))
  25.  
  26.    NewRemoveInArrayLong = True
  27.    Exit Function
  28. Else
  29.    ReDim tArray(LBound(ThisArray) To (UBound(ThisArray) - 1))
  30.    For i = LBound(ThisArray) To UBound(ThisArray)
  31.        If i < Index& Then
  32.            tArray(i) = ThisArray(i)
  33.        ElseIf i > Index& Then
  34.            tArray(i - 1) = ThisArray(i)
  35.        End If
  36.    Next i
  37.    ReDim ThisArray(LBound(tArray) To UBound(tArray))
  38.    ThisArray = tArray
  39.    Erase tArray
  40.  
  41.    NewRemoveInArrayLong = True
  42.    Exit Function
  43. End If
  44. NewRemoveInArrayLong = False
  45. End Function
  46.  
  47.  

Y muchas gracias por ayudarme en el otro post  ;-), igualmente tuve una nueva duda, si puedes héchale un vistazo.  :laugh:
210  Programación / Programación Visual Basic / Re: [Ayuda] Callings Sub y Functions en: 9 Octubre 2010, 21:25 pm
Wow, muchisimas gracias.  ;-)
Páginas: 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21] 22 23
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines