Dota改键

 

利用全局钩子 制作一个个性化的dota游戏改键!

 

dll部分:

// FileName: add.cpp

#include <Windows.h>/* 定义全局变量 */
HWND g_hwnd = NULL;
HHOOK g_hKeyboard = NULL;// 设置数据段
#pragma data_seg("MySec")
static WORD g_keyNum[6]={0};        // 只有初始化过的才能用
static int g_signed = 0;
#pragma data_seg()  
#pragma comment( linker,"/section:MySec,RWS" ) LRESULT CALLBACK KeyboardProc(int code,       // hook codeWPARAM wParam,  // virtual-key codeLPARAM lParam   // keystroke-message information
    )
{for(int j=0; j<6; j++){if(wParam==g_keyNum[j] && !(lParam>>31) ){switch(j){case 0: keybd_event(VK_NUMPAD1,0,KEYEVENTF_EXTENDEDKEY,0); keybd_event(VK_NUMPAD1,0,KEYEVENTF_KEYUP,0); return 1;case 1: keybd_event(VK_NUMPAD2,0,KEYEVENTF_EXTENDEDKEY,0); keybd_event(VK_NUMPAD2,0,KEYEVENTF_KEYUP,0); return 1;case 2: keybd_event(VK_NUMPAD4,0,KEYEVENTF_EXTENDEDKEY,0); keybd_event(VK_NUMPAD4,0,KEYEVENTF_KEYUP,0); return 1;case 3: keybd_event(VK_NUMPAD5,0,KEYEVENTF_EXTENDEDKEY,0); keybd_event(VK_NUMPAD5,0,KEYEVENTF_KEYUP,0); return 1;case 4: keybd_event(VK_NUMPAD7,0,KEYEVENTF_EXTENDEDKEY,0); keybd_event(VK_NUMPAD7,0,KEYEVENTF_KEYUP,0); return 1;case 5: keybd_event(VK_NUMPAD8,0,KEYEVENTF_EXTENDEDKEY,0); keybd_event(VK_NUMPAD8,0,KEYEVENTF_KEYUP,0); return 1;}}}return CallNextHookEx(g_hKeyboard,code,wParam,lParam);
}
_declspec(dllexport) void SetHook (WORD KeyNum[])
{for(int i=0; i<6; i++){g_keyNum[i] = KeyNum[i];}g_hKeyboard=SetWindowsHookEx(WH_KEYBOARD,KeyboardProc,GetModuleHandle(L"DLL.dll"),0);
}_declspec(dllexport) void DelHook ()
{UnhookWindowsHookEx(g_hKeyboard);g_hKeyboard = NULL;
}

 

主程序部分:

// DotaDlg.cpp : 实现文件
//

#include "stdafx.h"
#include "Dota.h"
#include "DotaDlg.h"
#include "afxdialogex.h"#pragma comment(lib, "DLL.lib")#ifdef _DEBUG
#define new DEBUG_NEW
#endif/* 全局变量 */
CDotaDlg * g_pt = NULL;HHOOK g_hook;/* 记录输入框是否有焦点 */
bool g_signNum[6] = {false};
/* 记录按下键的编码 */
WORD g_nkey[6] = {0};
/* 按键表 */
CString g_szkeyboard[200];// 用于应用程序“关于”菜单项的 CAboutDlg 对话框class CAboutDlg : public CDialogEx
{
public:CAboutDlg();// 对话框数据enum { IDD = IDD_ABOUTBOX };protected:virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持// 实现
protected:DECLARE_MESSAGE_MAP()
};CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{CDialogEx::DoDataExchange(pDX);
}BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()// CDotaDlg 对话框
CDotaDlg::CDotaDlg(CWnd* pParent /*=NULL*/): CDialogEx(CDotaDlg::IDD, pParent), m_num7(_T("")), m_num8(_T("")), m_num4(_T("")), m_num1(_T("")), m_num2(_T("")), m_num5(_T(""))
{m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}void CDotaDlg::DoDataExchange(CDataExchange* pDX)
{CDialogEx::DoDataExchange(pDX);DDX_Text(pDX, IDC_EDIT_NUM7, m_num7);DDV_MaxChars(pDX, m_num7, 1);DDX_Text(pDX, IDC_EDIT_NUM8, m_num8);DDV_MaxChars(pDX, m_num8, 1);DDX_Text(pDX, IDC_EDIT_NUM4, m_num4);DDV_MaxChars(pDX, m_num4, 1);DDX_Text(pDX, IDC_EDIT_NUM1, m_num1);DDV_MaxChars(pDX, m_num1, 1);DDX_Text(pDX, IDC_EDIT_NUM2, m_num2);DDV_MaxChars(pDX, m_num2, 1);DDX_Text(pDX, IDC_EDIT_NUM5, m_num5);DDV_MaxChars(pDX, m_num5, 1);
}BEGIN_MESSAGE_MAP(CDotaDlg, CDialogEx)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_BUTTON_EXIT, &CDotaDlg::OnBnClickedButtonExit)ON_EN_SETFOCUS(IDC_EDIT_NUM7, &CDotaDlg::OnEnSetfocusEditNum7)ON_WM_DESTROY()ON_EN_KILLFOCUS(IDC_EDIT_NUM7, &CDotaDlg::OnEnKillfocusEditNum7)ON_EN_SETFOCUS(IDC_EDIT_NUM8, &CDotaDlg::OnEnSetfocusEditNum8)ON_EN_KILLFOCUS(IDC_EDIT_NUM8, &CDotaDlg::OnEnKillfocusEditNum8)ON_EN_SETFOCUS(IDC_EDIT_NUM4, &CDotaDlg::OnEnSetfocusEditNum4)ON_EN_KILLFOCUS(IDC_EDIT_NUM4, &CDotaDlg::OnEnKillfocusEditNum4)ON_EN_SETFOCUS(IDC_EDIT_NUM5, &CDotaDlg::OnEnSetfocusEditNum5)ON_EN_KILLFOCUS(IDC_EDIT_NUM5, &CDotaDlg::OnEnKillfocusEditNum5)ON_EN_SETFOCUS(IDC_EDIT_NUM1, &CDotaDlg::OnEnSetfocusEditNum1)ON_EN_KILLFOCUS(IDC_EDIT_NUM1, &CDotaDlg::OnEnKillfocusEditNum1)ON_EN_SETFOCUS(IDC_EDIT_NUM2, &CDotaDlg::OnEnSetfocusEditNum2)ON_EN_KILLFOCUS(IDC_EDIT_NUM2, &CDotaDlg::OnEnKillfocusEditNum2)ON_WM_TIMER()ON_BN_CLICKED(IDC_BUTTON_HIDE, &CDotaDlg::OnBnClickedButtonHide)ON_MESSAGE(WM_SHOWTASK,OnShowTask)
END_MESSAGE_MAP()/* 局部钩子处理程序 */
LRESULT CALLBACK KeyboardProc(int code,       // hook codeWPARAM wParam,  // virtual-key codeLPARAM lParam   // keystroke-message information
    )
{/* 按一个键时 */if(wParam && !(lParam>>31)){//CString str;//str.Format(L"%d", wParam);//AfxMessageBox(str);
        POINT point;GetCaretPos(&point);for(int i=0; i<6; i++){if(g_signNum[i])        // 且某个输入框有输入焦点
            {if(wParam != VK_BACK)    //且按下的 不是 退格键
                {switch(i){case 0: g_pt->m_num1 = g_szkeyboard[wParam]; g_nkey[0]=wParam; g_pt->UpdateData(FALSE); break;case 1: g_pt->m_num2 = g_szkeyboard[wParam]; g_nkey[1]=wParam; g_pt->UpdateData(FALSE); break;case 2: g_pt->m_num4 = g_szkeyboard[wParam]; g_nkey[2]=wParam; g_pt->UpdateData(FALSE); break;case 3: g_pt->m_num5 = g_szkeyboard[wParam]; g_nkey[3]=wParam; g_pt->UpdateData(FALSE); break;case 4: g_pt->m_num7 = g_szkeyboard[wParam]; g_nkey[4]=wParam; g_pt->UpdateData(FALSE); break;case 5: g_pt->m_num8 = g_szkeyboard[wParam]; g_nkey[5]=wParam; g_pt->UpdateData(FALSE); break;}}else        // 按下退格键删除以前的改键
                {switch(i){case 0: g_pt->m_num1 = ""; g_nkey[0]=0; g_pt->UpdateData(FALSE); break;case 1: g_pt->m_num2 = ""; g_nkey[1]=0; g_pt->UpdateData(FALSE); break;case 2: g_pt->m_num4 = ""; g_nkey[2]=0; g_pt->UpdateData(FALSE); break;case 3: g_pt->m_num5 = ""; g_nkey[3]=0; g_pt->UpdateData(FALSE); break;case 4: g_pt->m_num7 = ""; g_nkey[4]=0; g_pt->UpdateData(FALSE); break;case 5: g_pt->m_num8 = ""; g_nkey[5]=0; g_pt->UpdateData(FALSE); break;}}}}}//return CallNextHookEx(g_hook, code, wParam, lParam);return 1;
}// CDotaDlg 消息处理程序

BOOL CDotaDlg::OnInitDialog()
{CDialogEx::OnInitDialog();// 将“关于...”菜单项添加到系统菜单中。// IDM_ABOUTBOX 必须在系统命令范围内。ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX < 0xF000);CMenu* pSysMenu = GetSystemMenu(FALSE);if (pSysMenu != NULL){BOOL bNameValid;CString strAboutMenu;bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);ASSERT(bNameValid);if (!strAboutMenu.IsEmpty()){pSysMenu->AppendMenu(MF_SEPARATOR);pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);}}// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动//  执行此操作SetIcon(m_hIcon, TRUE);            // 设置大图标SetIcon(m_hIcon, FALSE);        // 设置小图标// TODO: 在此添加额外的初始化代码SetTimer(1, 1000, NULL);        // 设置一个定时器g_pt = this;g_szkeyboard['0']="0";g_szkeyboard['1']="1";g_szkeyboard['2']="2";g_szkeyboard['3']="3";g_szkeyboard['4']="4";g_szkeyboard['5']="5";g_szkeyboard['6']="6";g_szkeyboard['7']="7";g_szkeyboard['8']="8";g_szkeyboard['9']="9";g_szkeyboard['A']="A";g_szkeyboard['B']="B";g_szkeyboard['C']="C";g_szkeyboard['D']="D";g_szkeyboard['E']="E";g_szkeyboard['F']="F";g_szkeyboard['G']="G";g_szkeyboard['H']="H";g_szkeyboard['I']="I";g_szkeyboard['J']="J";g_szkeyboard['K']="K";g_szkeyboard['L']="L";g_szkeyboard['M']="M";g_szkeyboard['N']="N";g_szkeyboard['O']="O";g_szkeyboard['P']="P";g_szkeyboard['Q']="Q";g_szkeyboard['R']="R";g_szkeyboard['S']="S";g_szkeyboard['T']="T";g_szkeyboard['U']="U";g_szkeyboard['V']="V";g_szkeyboard['W']="W";g_szkeyboard['X']="X";g_szkeyboard['Y']="Y";g_szkeyboard['Z']="Z";g_szkeyboard[144]="NUM LOCK";g_szkeyboard[96]="NUM 0";g_szkeyboard[97]="NUM 1";g_szkeyboard[98]="NUM 2";g_szkeyboard[99]="NUM 3";g_szkeyboard[100]="NUM 4";g_szkeyboard[101]="NUM 5";g_szkeyboard[102]="NUM 6";g_szkeyboard[103]="NUM 7";g_szkeyboard[104]="NUM 8";g_szkeyboard[105]="NUM 9";g_szkeyboard[106]="NUM *";g_szkeyboard[107]="NUM +";g_szkeyboard[109]="NUM -";g_szkeyboard[110]="NUM DEL";g_szkeyboard[111]="NUM /";g_szkeyboard[VK_F1]="F1";g_szkeyboard[VK_F2]="F2";g_szkeyboard[VK_F3]="F3";g_szkeyboard[VK_F4]="F4";g_szkeyboard[VK_F5]="F5";g_szkeyboard[VK_F6]="F6";g_szkeyboard[VK_F7]="F7";g_szkeyboard[VK_F8]="F8";g_szkeyboard[VK_F9]="F9";g_szkeyboard[VK_F10]="F10";g_szkeyboard[VK_F11]="F11";g_szkeyboard[VK_F12]="F12";g_szkeyboard[VK_ESCAPE]="ESC";g_szkeyboard[VK_TAB]="TAB";g_szkeyboard[VK_CAPITAL]="Caps Lock";g_szkeyboard[192]="`";g_szkeyboard[VK_SPACE]="Space";/* 安装局部钩子 */g_hook = SetWindowsHookEx(WH_KEYBOARD, KeyboardProc, NULL, GetCurrentThreadId());ReadKeyNum();return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}void CDotaDlg::OnSysCommand(UINT nID, LPARAM lParam)
{if ((nID & 0xFFF0) == IDM_ABOUTBOX){CAboutDlg dlgAbout;dlgAbout.DoModal();}else{CDialogEx::OnSysCommand(nID, lParam);}
}// 如果向对话框添加最小化按钮,则需要下面的代码
//  来绘制该图标。对于使用文档/视图模型的 MFC 应用程序,
//  这将由框架自动完成。void CDotaDlg::OnPaint()
{if (IsIconic()){CPaintDC dc(this); // 用于绘制的设备上下文
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);// 使图标在工作区矩形中居中int cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;// 绘制图标
        dc.DrawIcon(x, y, m_hIcon);}else{CDialogEx::OnPaint();}
}//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CDotaDlg::OnQueryDragIcon()
{return static_cast<HCURSOR>(m_hIcon);
}BOOL CDotaDlg::PreTranslateMessage (MSG * pMsg)
{switch(pMsg->wParam){case VK_ESCAPE:            // 屏蔽ESC键return TRUE;}return CDialog::PreTranslateMessage(pMsg);
}void CDotaDlg::OnBnClickedButtonExit()
{//OnNotifyMsg();
    SendMessage(WM_CLOSE);
}void CDotaDlg::OnDestroy()
{CDialogEx::OnDestroy();g_pt = NULL;KillTimer(1);/* 卸载钩子 */UnhookWindowsHookEx(g_hook);
}void CDotaDlg::OnEnSetfocusEditNum7()
{g_signNum[4] = true;
}void CDotaDlg::OnEnKillfocusEditNum7()
{g_signNum[4] = false;
}void CDotaDlg::OnEnSetfocusEditNum8()
{g_signNum[5] = true;
}void CDotaDlg::OnEnKillfocusEditNum8()
{g_signNum[5] = false;
}void CDotaDlg::OnEnSetfocusEditNum4()
{g_signNum[2] = true;
}void CDotaDlg::OnEnKillfocusEditNum4()
{g_signNum[2] = false;
}void CDotaDlg::OnEnSetfocusEditNum5()
{g_signNum[3] = true;
}void CDotaDlg::OnEnKillfocusEditNum5()
{g_signNum[3] = false;
}void CDotaDlg::OnEnSetfocusEditNum1()
{g_signNum[0] = true;
}void CDotaDlg::OnEnKillfocusEditNum1()
{g_signNum[0] = false;
}void CDotaDlg::OnEnSetfocusEditNum2()
{g_signNum[1] = true;
}void CDotaDlg::OnEnKillfocusEditNum2()
{g_signNum[1] = false;
}_declspec(dllimport) void SetHook (WORD KeyNum[]);
_declspec(dllimport) void DelHook ();void CDotaDlg::OnTimer(UINT_PTR nIDEvent)
{static int sign = 1;HWND hwnd =    NULL;hwnd = ::FindWindow(L"Warcraft III",0);            // 获得顶层窗口句柄if(hwnd == ::GetForegroundWindow())                // 得到前台窗口句柄 
    {if(sign){//MessageBox(L"找到目标进程了");//DelHook();  SetHook(g_nkey);    // 安装钩子。sign = 0;}}else{DelHook();sign = 1;}CDialogEx::OnTimer(nIDEvent);
}_declspec(dllimport) void SetHook (WORD KeyNum[]);
void CDotaDlg::OnBnClickedButtonHide()
{//SetHook(g_nkey);
    CStdioFile file;CString str;CFileException mExcept;file.Open(L"Key.ini", CFile::modeCreate|CFile::modeReadWrite, &mExcept);file.SeekToEnd();str.Format(L"@%d-->1@\n@%d-->2@\n@%d-->4@\n@%d-->5@\n@%d-->7@\n@%d-->8@\n",g_nkey[0], g_nkey[1], g_nkey[2], g_nkey[3], g_nkey[4], g_nkey[5]);file.WriteString(str);file.Close();NOTIFYICONDATA nid;    nid.cbSize=(DWORD)sizeof(NOTIFYICONDATA);   nid.hWnd=this->m_hWnd;    nid.uID=IDR_MAINFRAME;    nid.uFlags=NIF_ICON|NIF_MESSAGE|NIF_TIP ;    nid.uCallbackMessage=WM_SHOWTASK;//自定义的消息名称    
nid.hIcon=LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)); wcscpy(nid.szTip, L"冬雪简易改键");    //信息提示条   
Shell_NotifyIcon(NIM_ADD,&nid);    //在托盘区添加图标    
ShowWindow(SW_HIDE);    //隐藏主窗口
}void CDotaDlg::ReadKeyNum(void)
{CStdioFile file;if(file.Open(L"Key.ini", CFile::modeRead)){CString buffer;char buf[4];int i;int j = 0;memset(buf,0,4);while(file.ReadString(buffer)){i = 0;for(i=0; i<4; i++){buf[i]=char(buffer.GetAt(1+i));if(buf[i] == '-'){buf[i] = '\0';break;}}g_nkey[j] = (WORD)atol(buf);if(g_nkey[j]){switch(j){case 0 : m_num1=g_szkeyboard[g_nkey[0]]; break;case 1 : m_num2=g_szkeyboard[g_nkey[1]]; break;case 2 : m_num4=g_szkeyboard[g_nkey[2]]; break;case 3 : m_num5=g_szkeyboard[g_nkey[3]]; break;case 4 : m_num7=g_szkeyboard[g_nkey[4]]; break;case 5 : m_num8=g_szkeyboard[g_nkey[5]]; break;}}j++;}UpdateData(FALSE);file.Close();}
}void CDotaDlg::ToTray()
{   NOTIFYICONDATA nid;    nid.cbSize=(DWORD)sizeof(NOTIFYICONDATA);   nid.hWnd=this->m_hWnd;    nid.uID=IDR_MAINFRAME;    nid.uFlags=NIF_ICON|NIF_MESSAGE|NIF_TIP ;    nid.uCallbackMessage=WM_SHOWTASK;//自定义的消息名称    
nid.hIcon=LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME));   wcscpy(nid.szTip,L"冬雪简易改键");    //信息提示条   
Shell_NotifyIcon(NIM_ADD,&nid);    //在托盘区添加图标    
ShowWindow(SW_HIDE);    //隐藏主窗口

}LRESULT CDotaDlg::OnShowTask(WPARAM wParam,LPARAM lParam)   
{     if(wParam!=IDR_MAINFRAME)        return 1;      switch(lParam)     {            case WM_RBUTTONUP://右键起来时弹出快捷菜单,这里只有一个“关闭”       
        {         LPPOINT lpoint= new tagPOINT;         ::GetCursorPos(lpoint);//得到鼠标位置          
            CMenu menu;             menu.CreatePopupMenu();//声明一个弹出式菜单          //增加菜单项“关闭”,点击则发送消息WM_DESTROY给主窗口(已             //隐藏),将程序结束。            menu.AppendMenu(MF_STRING,WM_DESTROY,L"关闭");  //          menu.AppendMenu(MF_STRING,WM_DESTROY,"设置...");  //确定弹出式菜单的位置           menu.TrackPopupMenu(TPM_LEFTALIGN,lpoint->x,lpoint->y,this);        //资源回收            HMENU hmenu=menu.Detach();              menu.DestroyMenu();             delete lpoint;        }             break;          case WM_LBUTTONDBLCLK://双击左键的处理        
        {           ShowWindow(SW_SHOWNORMAL);//简单的显示主窗口完事儿   SW_SHOW则错误  //  this->SetForegroundWindow(); // 置顶显示          //~DeleteTray();        
        }             break;          default:             break;      }      return 0;  
}  

 

转载于:https://www.cnblogs.com/calm2012/archive/2013/03/13/2957984.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/474622.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

LeetCode MySQL 1501. 可以放心投资的国家

文章目录1. 题目2. 解题1. 题目 表 Person: ------------------------- | Column Name | Type | ------------------------- | id | int | | name | varchar | | phone_number | varchar | ------------------------- id 是该表主键. 该表…

php 小数末尾进1,PHP小数点最后一位加1、减1

比如我有几个数字(小数点后面的位数不固定)&#xff1a;1、155.0552、122.1963、0.9631我怎么做才能让这些数字的小数点最后一位1&#xff0c;或者-1&#xff1f;比如1的话希望得到&#xff1a;1、155.0562、122.1973、0.9632回复内容&#xff1a;比如我有几个数字(小数点后面的…

ARM汇编Hello,World

1. 编译运行环境见http://www.cnblogs.com/linucos/archive/2013/03/01/2938517.htm2. 汇编例子.data msg: .asciz "hello, world\n" .text .global main …

LeetCode MySQL 1270. 向公司CEO汇报工作的所有人

文章目录1. 题目2. 解题1. 题目 员工表&#xff1a;Employees ------------------------ | Column Name | Type | ------------------------ | employee_id | int | | employee_name | varchar | | manager_id | int | ------------------------ employee_…

php 正则 尖括号,php使用正则表达式提取字符串中尖括号、小括号、中括号、大括号中的字符串...

$str"你好(爱)[北京]{天安门}";echo f1($str); //返回你好echo f2($str); //返回我echo f3($str); //返回爱echo f4($str); //返回北京echo f5($str); //返回天安门function f1($str){$result array();preg_match_all("/^(.*)(?:return $result[1][0];}functi…

经济学经典书籍

I&#xff1a;入门阶段&#xff1a; 中文版名称&#xff1a;《经济学原理》 曼昆 英文版名称&#xff1a;principle of economics by Mankiw,N.G.II&#xff1a;基础阶段&#xff1a; 《微观经济学》 周惠中 《微观经济学&#xff1a;现代观点》 哈尔.R.范里安&#xff08;Hal …

LeetCode MySQL 570. 至少有5名直接下属的经理

文章目录1. 题目2. 解题1. 题目 Employee 表包含所有员工和他们的经理。 每个员工都有一个 Id&#xff0c;并且还有一列是经理的 Id。 ------------------------------------- |Id |Name |Department |ManagerId | ------------------------------------- |101 |John…

php 数据接口,初识 php 接口

这次的这篇文章介绍的是PHP接口的内容&#xff0c;现在分享给大家&#xff0c;也给有需要帮助的朋友一个参考&#xff0c;大家一起过来看一看吧一. 接口按请求人可以分为两种&#xff1a;一种是被其他内部项目调用的接口(包括js异步请求的接口和定时程序)。另一种是对外的接口&…

SYSU每周一赛(13.03.16)1003

给定起点终点的无向图&#xff0c;出发时速度为1&#xff0c;到达时速度也为1&#xff0c;在每个点可以进行速度1&#xff0c;不变&#xff0c;-1的操作&#xff0c;在每条边都有限速&#xff0c;到达一城市后不能直接走反向边&#xff0c;求最短时间。 SPFA作松弛操作的典型例…

LeetCode MySQL 1132. 报告的记录 II

文章目录1. 题目2. 解题1. 题目 动作表&#xff1a; Actions ------------------------ | Column Name | Type | ------------------------ | user_id | int | | post_id | int | | action_date | date | | action | enum | | extra…

java封装省市区三级json格式,微信开发 使用picker封装省市区三级联动模板

目前学习小程序更多的是看看能否二次封装其它组件&#xff0c;利于以后能快速开发各种小程序应用。目前发现picker的selector模式只有一级下拉&#xff0c;那么我们是否可以通过3个picker来实现三级联动模板的形式来引入其它页面中呢&#xff1f;答案是肯定可以的。那么我的思路…

LeetCode MySQL 1126. 查询活跃业务

文章目录1. 题目2. 解题1. 题目 事件表&#xff1a;Events ------------------------ | Column Name | Type | ------------------------ | business_id | int | | event_type | varchar | | occurences | int | ------------------------ 此表的主键是…

php linux 删除文件夹,linux下如何删除文件夹

linux下删除文件夹的方法&#xff1a;可以使用【rm -rf 目录名】命令进行删除&#xff0c;如【rm -rf /var/log/httpd/access】&#xff0c;表示删除/var/log/httpd/access目录及其下的所有文件、文件夹。直接rm就可以了&#xff0c;不过要加两个参数-rf 即&#xff1a;rm -rf …

Too many fragmentation in LMT?

这周和同事讨论技术问题时&#xff0c;他告诉我客户的一套11.1.0.6的数据库中某个本地管理表空间上存在大量的Extents Fragment区间碎片&#xff0c;这些连续的Extents没有正常合并为一个大的Extent&#xff0c;他怀疑这是由于11.1.0.6上的bug造成了LMT上存在大量碎片。 同事判…

LeetCode 1533. Find the Index of the Large Integer(二分查找)

文章目录1. 题目2. 解题1. 题目 We have an integer array arr, where all the integers in arr are equal except for one integer which is larger than the rest of the integers. You will not be given direct access to the array, instead, you will have an API Array…

java先抽到红球获胜,【图片】红蓝球概率问题,通过程序模拟抽取,计算结果已出,有兴趣来看【非现役文职吧】_百度贴吧...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼我用的c语言&#xff0c;大一学的还没忘完。。。。程序非常简单&#xff0c;就是生成随机数&#xff0c;然后根据随机数的结果进行计数就好了。代码贴下面&#xff0c;有兴趣的可以看看。懂行的请不要喷我写的烂。。。。。毕竟不是…

MySQL Server Architecture

MySQL 服务器架构&#xff1a; 转载于:https://www.cnblogs.com/macleanoracle/archive/2013/03/19/2968212.html

LeetCode MySQL 1479. 周内每天的销售情况(dayname星期几)

文章目录1. 题目2. 解题1. 题目 表&#xff1a;Orders ------------------------ | Column Name | Type | ------------------------ | order_id | int | | customer_id | int | | order_date | date | | item_id | varchar | | quantity …

php的swoole教程,PHP + Swoole2.0 初体验(swoole入门教程)

PHP Swoole2.0 初体验(swoole入门教程)环境&#xff1a;centos7 PHP7.1 swoole2.0准备工作&#xff1a;一、 swoole 扩展安装1 、下载swoolecd/usr/localwget -c https://github.com/swoole/swoole-src/archive/v2.0.8.tar.gztar -zxvf v2.0.8.tar.gzcdswoole-src-2.0.8/2 编…

Git常用命令解说

http://zensheno.blog.51cto.com/2712776/490748 1. Git概念 1.1. Git库中由三部分组成 Git 仓库就是那个.git 目录&#xff0c;其中存放的是我们所提交的文档索引内容&#xff0c;Git 可基于文档索引内容对其所管理的文档进行内容追踪&#xff0c;从而实现文档的版本控…