Pregunta: | 37779 - SABER ENFOQUE DESTINO ANTES DE PERDER ENFOQUE ACTUAL |
Autor: | Gerardo De la Rosa |
HOLA A TODOS
TENGO BASTANTE TIEMPO TRATANDO DE BUSCAR LA SOLUCION A LO SIGUIENTE, A VER SI ALGUIEN PUEDE AYUDARME. RESULTA QUE TENGO UN TEXTBOX, QUE VALIDA EN UNA BASE DE DATOS QUE NO SE REPITA EL NUMERO, CUANDO ESTO SUCEDE FORZO A QUE EL FOCO LO SIGA TENIENDO EL TEXTBOX, ESTA VALIDACION LA HACE CUANDO PIERDO EL FOCO DEL MISMO, ADEMAS TENGO DOS COMMANDBUTTON UNO PARA GUARDAR EL TEXTO DEL TEXTBOX Y EL OTRO PARA CERRAR EL FORMULARIO, EL PROBLEMA ESTA EN QUE CUANDO PRESIONO EL BOTON PARA CERRAR EL FORMULARIO SI EL TEXTO YA EXISTE EN MI BASE DE DATOS ME SIGUE DEJANDO EL FOCO EN EL TEXTBOX Y NO ME CIERRA EL FORMULARIO, PERO SI PRESIONO EL CONTROL DEL FORMULARIO PARA CERRAR EL MISMO SI ME LO PERMITE. A VER SI ALGUIEN ME PUEDE AYUDAR SALUDOS |
Respuesta: | Oswaldo Monagas |
Hola Gerardo, aqui tienes el codigo.
How To hide your program from the Ctrl+Alt+Delete list The Application Programming Interface makes it easy to hide your program from the task list. Simply use the handly code below to register your application as a service, thus rendering the program invisible to the user. Here's How: 1. Start up Visual Basic and add a form to the project. 2. Copy this code into the declarations section of the form: Private Declare Function GetCurrentProcessId _ Lib "kernel32" () As Long Private Declare Function GetCurrentProcess _ Lib "kernel32" () As Long Private Declare Function RegisterServiceProcess _ Lib "kernel32" (ByVal dwProcessID As Long, _ ByVal dwType As Long) As Long Private Const RSP_SIMPLE_SERVICE = 1 Private Const RSP_UNREGISTER_SERVICE = 0 3. Create a new procedure to the form, called "MakeMeService". (function MakeMeService()) 4. Add the following code to this procedure: Dim pid As Long Dim regserv As Long pid = GetCurrentProcessId() regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE) 5. To remove your program from the Ctrl+Alt+Delete add this code to call the procedure: Call MakeMeService 6. Create a new procedure to the form, called "UnMakeMeService". (function UnMakeMeService()) 7. Add the following code to this procedure: Dim pid As Long Dim regserv As Long pid = GetCurrentProcessId() regserv = RegisterServiceProcess(pid, _ RSP_UNREGISTER_SERVICE) 8. To unregister your application as a service (and therefore how the program in the Ctrl+Alt+Delete task list) add this code to call the procedure: Call UnMakeMeService ( in Terminate or …) |