| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 713 人关注过本帖, 1 人收藏
标题:为何每次启动和退出程序时,qq会自动启动?
只看楼主 加入收藏
sznt
Rank: 2
等 级:论坛游民
帖 子:161
专家分:20
注 册:2005-8-4
结帖率:66.67%
收藏(1)
 问题点数:0 回复次数:2 
为何每次启动和退出程序时,qq会自动启动?
为何每次启动和退出程序时,qq会自动启动?
搜索更多相关主题的帖子: 自动 
2009-10-15 09:24
msgj
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:4
帖 子:190
专家分:914
注 册:2009-10-3
收藏
得分:0 
这不是VB6的问题,但还是帮助你
1、QQ在安装时加入了启动组
2、QQ登录设置选取了自动登录
2009-10-15 10:51
sznt
Rank: 2
等 级:论坛游民
帖 子:161
专家分:20
注 册:2005-8-4
收藏
得分:0 
不是指系统启动时qq自动运行,而是vb编译的程序一启动和退出时,会将qq程序启动,不知为何?
原来没这种情况,后来模块里加载锁键盘代码后就这样了,代码如下:

'《模块代码》
' /----------------------------------------------------------\
' |          屏蔽 NT 系统的下所有按键消息 v2.1                  |
' |          ================================                |
' |  Author : Hackor(阿国哥)                                  |
' |  Email  : hackor@                                |
' |  Website: http://www.                         |
' |  ~~~~~~~~~~ 请保留作者原版信息 ~~~~~~~~~~~                 |
' |                                                          |
' |  Usage:                                                  |
' |     Call LockKeyboard(T | F )                            |
' |     返回: True 成功;False 失败                                 |
' |                                                          |
' |     Call GetKeyboardState                                |
' |     返回: True 已锁定                                           |
' |                                                          |
' |                                                          |
' |  实现原理:                                                      |
' |     锁定 Ctrl+Alt+Del 使用远程线程、代码注入及子类化技术       |
' |     其它键盘消息使用普通钩子技术                                 |
' |                                                          |
' |  本模块向 VB 程序员展示远程线程、代码注入等似乎被列入            |
' |  只有Delphi、VC程序员才可能使用的技术,同时目前诸多木马         |
' |  也同样大量使用这些技术。注入的方式比 Dll 钩入更加隐蔽。        |
' |  注入后无进程、无文件。                                          |
' \----------------------------------------------------------/
Option Explicit
 
'是否包含处理其它键盘消息,True表示处理.
#Const INC_OTHER_KEY = True
 
'注意,以下所有双版本的API均声明成了 UNICODE 版。 并且许多地方与VB的API浏览器生成的代码有所不同。
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
 
Private Declare Function GlobalAddAtom Lib "kernel32" Alias "GlobalAddAtomW" (ByVal lpString As Long) As Integer
Private Declare Function GlobalDeleteAtom Lib "kernel32" (ByVal nAtom As Integer) As Integer
Private Declare Function GlobalFindAtom Lib "kernel32" Alias "GlobalFindAtomW" (ByVal lpString As Long) As Integer
 
Private Const TH32CS_SNAPPROCESS = 2
Private Type PROCESSENTRY32W
    dwSize              As Long
    cntUsage            As Long
    h32ProcessID        As Long '    // this process
    th32DefaultHeapID   As Long '
    h32ModuleID         As Long '    // associated exe
    cntThreads          As Long '
    th32ParentProcessID As Long '    // this process's parent process
    pcPriClassBase      As Long '    // Base priority of process's threads
    dwFlags             As Long '
    szExeFile(1 To 260) As Integer ' // Path
End Type
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" Alias "Process32FirstW" (ByVal hSnapshot As Long, lpPE As PROCESSENTRY32W) As Long
Private Declare Function Process32Next Lib "kernel32" Alias "Process32NextW" (ByVal hSnapshot As Long, lpPE As PROCESSENTRY32W) As Long
Private Declare Function lstrcmpi Lib "kernel32" Alias "lstrcmpiW" (lpString1 As Integer, ByVal lpString2 As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetLastError Lib "kernel32" () As Long
 
 
Private Type LUID
    lowpart     As Long
    highpart    As Long
End Type
Private Type LUID_AND_ATTRIBUTES
        pLuid       As LUID
        Attributes  As Long
End Type
Private Type TOKEN_PRIVILEGES
    PrivilegeCount  As Long
    Privileges      As LUID_AND_ATTRIBUTES
End Type
Private Const PROCESS_ALL_ACCESS        As Long = &H1F0FFF
Private Const TOKEN_QUERY               As Long = &H8&
Private Const TOKEN_ADJUST_PRIVILEGES   As Long = &H20&
Private Const SE_PRIVILEGE_ENABLED      As Long = &H2
Private Const SE_DEBUG_NAME As String = "SeDebugPrivilege"
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueW" (ByVal lpSystemName As Long, ByVal lpName As Long, lpLuid As LUID) As Long
Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, ByVal PrevState As Long, ByVal N As Long) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleW" (ByVal lpwModuleName As Long) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
 
Private Const MEM_COMMIT        As Long = &H1000
Private Const MEM_DECOMMIT      As Long = &H4000
Private Const PAGE_EXECUTE_READWRITE    As Long = &H40
Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal ProcessHandle As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
Private Declare Function VirtualFreeEx Lib "kernel32" (ByVal ProcessHandle As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long
Private Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Long, ByVal lpThreadAttributes As Long, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, ByVal lpParameter As Long, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function GetExitCodeThread Lib "kernel32" (ByVal hThread As Long, lpExitCode As Long) As Long
 
#If INC_OTHER_KEY Then
Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExW" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
#End If
 
Private Const ATOM_FLAG As String = "HookSysKey"
Private Const SHELL_FALG As String = "Winlogon"
 
Private Const SHELL_CODE_DWORDLEN = 317     '注入代码所占的双字数
Private Const SHELL_CODE_LENGTH = (SHELL_CODE_DWORDLEN * 4) '字节数
Private Const SHELL_FUNCOFFSET = &H8       '注入代码线程函数偏移量
Private mlShellCode(SHELL_CODE_DWORDLEN - 1) As Long
 
#If INC_OTHER_KEY Then
Private m_lHookID       As Long             '键盘钩子句柄
'!! V2.1版就网友要求,增加了键盘钩子处理示例
Private Type KBDLLHOOKSTRUCT
    vkCode          As Long
    scanCode        As Long
    flags           As Long
    time            As Long
    dwExtraInfo     As Long
End Type
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
#End If
 
'============================================
' 锁定/解锁键盘
' 参数:布尔型,真表示锁定
' 返回:布尔型, 真表示成功
' 注意:非 Ctrl+Alt+Del 键使用普通钩子技术,因此
'       程序在退出时注意要卸载钩子。
'============================================
Public Function LockKeyboard(ByVal bLock As Boolean) As Boolean
Dim lResult As Long
Dim lStrPtr  As Long
Dim iAtom   As Integer
 
    lStrPtr = StrPtr(SHELL_FALG)
    iAtom = GlobalFindAtom(lStrPtr)
    If iAtom = 0 Then
        lResult = InsertAsmCode
        Debug.Assert lResult = 0
        If lResult Then Exit Function
    End If
 
    lStrPtr = StrPtr(ATOM_FLAG)
    iAtom = GlobalFindAtom(lStrPtr)
    If bLock Then
        #If INC_OTHER_KEY Then
            '强烈建议:使用了SetWindowsHookEx的话,请编译后再运行!
            m_lHookID = SetWindowsHookEx(13, AddressOf LowLevelKeyboardProc, App.hInstance, 0)
        #End If
 
        If iAtom = 0 Then iAtom = GlobalAddAtom(lStrPtr)
        LockKeyboard = (iAtom <> 0)
        Debug.Assert LockKeyboard
    Else
        #If INC_OTHER_KEY Then
            If m_lHookID Then Call UnhookWindowsHookEx(m_lHookID)
        #End If
        If iAtom Then iAtom = GlobalDeleteAtom(iAtom)
        LockKeyboard = iAtom = 0
    End If
End Function
2009-10-15 13:34
快速回复:为何每次启动和退出程序时,qq会自动启动?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014968 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved