DX9 DirectX鼠标控制程序 代码
代码实例1:
// @time: 2012.3.26
// @author: jadeshu
// des: DirectX鼠标控制程序
#include <Windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <atlstr.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#define ReleaseD3D(x) if (x!=NULL){x->Release();x=NULL;}
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"d3d9.lib")
#pragma comment(lib,"d3dx9.lib")
#pragma comment(lib,"dinput8.lib")
#pragma comment(lib, "dxguid.lib")
//全局变量
TCHAR g_szWindowName[]=_T("DirectX鼠标控制程序");
BOOL bActive = TRUE;
DIMOUSESTATE g_diMousestate={0};
//定义设备接口
IDirect3DDevice9 * g_pd3dDevice=NULL;
LPDIRECTINPUT8 g_pDirectInput=NULL; //DirectInput接口
LPDIRECTINPUTDEVICE8 g_pMouseDevice=NULL; //键盘输入接口
LPD3DXMESH g_pMeshTeapot=NULL; //茶壶网格对象
//回调函数声明
LRESULT CALLBACK WinProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
//初始化Direct3D函数声明
HRESULT Init3D(HWND hwnd,HINSTANCE hinstance);
//渲染声明
VOID Render();
//清除对象声明
VOID Cleanup();
//读取设备的输入数据
BOOL ReadDevice(IDirectInputDevice8 *pDIDevice,void *pBuffer,long ISize);
//主函数
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
//定义窗口类结构
TCHAR szAppName[]=TEXT("ClassN");
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
ZeroMemory(&msg,sizeof(msg));
wc.cbClsExtra=0;
wc.cbSize=sizeof(WNDCLASSEX);
wc.cbWndExtra=0;
wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wc.hCursor=LoadCursor(hInstance,IDC_ARROW);
wc.hIcon=LoadIcon(hInstance,IDI_APPLICATION);
wc.hIconSm=NULL;
wc.hInstance=hInstance;
wc.lpfnWndProc=WinProc;
wc.lpszClassName=szAppName;
wc.lpszMenuName=NULL;
wc.style=CS_HREDRAW|CS_VREDRAW;
//注册窗口
RegisterClassEx(&wc);
//创建窗口
hwnd=CreateWindow(szAppName,g_szWindowName,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
NULL,NULL,hInstance,0);
//加载3D初始化
if (FAILED(Init3D(hwnd,hInstance)))
{
return FALSE;
}
//显示和更新窗口
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
//消息循环
while (WM_QUIT!=msg.message)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
//转换消息
TranslateMessage(&msg);
//投递消息
DispatchMessage(&msg);
}
else if(bActive)
{
//渲染
Render();
}
else
{
if(!WaitMessage())
return -1;
}
}
//删除注册窗口
UnregisterClass(szAppName,hInstance);
return msg.wParam;
}
//回调函数
LRESULT CALLBACK WinProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch (uMsg)
{
case WM_PAINT:
Render(); //渲染
ValidateRect(hwnd,NULL); //更新窗口
return 0;
case WM_ACTIVATEAPP:
bActive = (BOOL)wParam;
break;
case WM_DESTROY:
Cleanup(); //清除对象
PostQuitMessage(0); //退出消息循环
return 0;
}
return DefWindowProc(hwnd,uMsg,wParam,lParam); //返回默认消息
}
//Direct3D初始化
HRESULT Init3D(HWND hwnd,HINSTANCE hinstance)
{
IDirect3D9 *pD3D=NULL; //定义对象接口
pD3D=Direct3DCreate9(D3D_SDK_VERSION); //创建对象接口
if (NULL==pD3D)
{
return E_FAIL;
}
D3DCAPS9 caps; //获取硬件设备信息
int vp=0;
pD3D->GetDeviceCaps(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,&caps);
if (caps.DevCaps&D3DDEVCAPS_HWTRANSFORMANDLIGHT)
{
vp=D3DCREATE_HARDWARE_VERTEXPROCESSING;
}
else
{
vp=D3DCREATE_SOFTWARE_VERTEXPROCESSING;
}
//创建Direct3D设备接口
D3DPRESENT_PARAMETERS d3dpp;
d3dpp.AutoDepthStencilFormat=D3DFMT_D24S8;
d3dpp.BackBufferCount=1;
d3dpp.BackBufferFormat=D3DFMT_A8R8G8B8;
d3dpp.BackBufferHeight=640;
d3dpp.BackBufferWidth=480;
d3dpp.EnableAutoDepthStencil=FALSE;
d3dpp.Flags=0;
d3dpp.FullScreen_RefreshRateInHz=D3DPRESENT_RATE_DEFAULT;
d3dpp.hDeviceWindow=hwnd;
d3dpp.MultiSampleQuality=0;
d3dpp.MultiSampleType=D3DMULTISAMPLE_NONE;
d3dpp.PresentationInterval=D3DPRESENT_INTERVAL_IMMEDIATE;
d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
d3dpp.Windowed=TRUE;
if (FAILED(pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dpp,&g_pd3dDevice)))
{
return E_FAIL;
}
D3DXCreateTeapot(g_pd3dDevice,&g_pMeshTeapot,0); //创建茶壶集合体
//创建DirectInput设备
DirectInput8Create(hinstance,0x0800,IID_IDirectInput8,(void **)&g_pDirectInput,NULL);
//创建键盘设备
g_pDirectInput->CreateDevice(GUID_SysMouse,&g_pMouseDevice,NULL);
//设置数据格式和协作级别
g_pMouseDevice->SetDataFormat(&c_dfDIMouse);
g_pMouseDevice->SetCooperativeLevel(hwnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE);
//获取设备
g_pMouseDevice->Acquire();
////世界变换矩阵
//D3DXMATRIX matWorld,Rx,Ry,Rz;
//D3DXMatrixIdentity(&matWorld);
//D3DXMatrixRotationX(&Rx,/*::timeGetTime()/1000*/1.0f);
//D3DXMatrixRotationY(&Ry,/*::timeGetTime()/1000*//*1.0f*/::timeGetTime()/1000.0f);
//D3DXMatrixRotationZ(&Rz,/*::timeGetTime()/1000.0f*//*::timeGetTime()/1000*/1.0f);
//matWorld=Rx*Ry*Rz*matWorld;
//g_pd3dDevice->SetTransform(D3DTS_WORLD,&matWorld);
//取景变换矩阵
D3DXMATRIX matView;
D3DXVECTOR3 vEye(0.0f,0.0f,-10.0f);
D3DXVECTOR3 vAt(0.0f,0.0f,0.0f);
D3DXVECTOR3 vUp(0.0f,1.0f,0.0f);
D3DXMatrixLookAtLH(&matView,&vEye,&vAt,&vUp);
g_pd3dDevice->SetTransform(D3DTS_VIEW,&matView);
//投影变换矩阵
D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH(&matProj,D3DX_PI/4.0f,1.0f,1.0f,1000.0f);
g_pd3dDevice->SetTransform(D3DTS_PROJECTION,&matProj);
pD3D->Release();
return S_OK;
}
//渲染图形
VOID Render()
{
g_pd3dDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME);
g_pd3dDevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(150,150,255),1.0f,0); //清除后台缓冲区
g_pd3dDevice->BeginScene(); //开始绘制
::ZeroMemory(&g_diMousestate,sizeof(g_pMouseDevice));
ReadDevice(g_pMouseDevice,(LPVOID)&g_diMousestate,sizeof(g_diMousestate));
////鼠标左键平移物体
static FLOAT fPosX=0.0f,fPosY=0.0f,fPosZ=0.0f;
if (g_diMousestate.rgbButtons[0]&0x80)
{
fPosX+=g_diMousestate.lX*0.01f; //沿X轴平移
fPosY+=g_diMousestate.lY*-0.01f; //沿Y轴平移
}
fPosZ+=g_diMousestate.lZ*0.005f;
D3DXMATRIX matWorld;
D3DXMatrixTranslation(&matWorld,fPosX,fPosY,fPosZ);
//鼠标右键旋转物体
static float fAngleX=0.0f,fAngleY=0.0f;
if (g_diMousestate.rgbButtons[1]&0x80)
{
fAngleX+=g_diMousestate.lX*-0.01f;
fAngleY+=g_diMousestate.lY*-0.01f;
}
D3DXMATRIX Rx,Ry;
D3DXMatrixRotationX(&Rx,fAngleX);
D3DXMatrixRotationY(&Ry,fAngleY);
matWorld=Rx*Ry*matWorld;
g_pd3dDevice->SetTransform(D3DTS_WORLD,&matWorld);
//绘制茶壶
g_pMeshTeapot->DrawSubset(0);
g_pd3dDevice->EndScene(); //结束绘制
g_pd3dDevice->Present(NULL,NULL,NULL,NULL); //从后台缓冲区复制到前台----翻转
}
//清除对象,内存
VOID Cleanup()
{
g_pMouseDevice->Unacquire();
ReleaseD3D(g_pMeshTeapot);
ReleaseD3D(g_pMouseDevice);
ReleaseD3D(g_pDirectInput);
ReleaseD3D(g_pd3dDevice);
//if (g_pMeshTeapot!=NULL)
//{
// g_pMeshTeapot->Release();
// g_pMeshTeapot=NULL;
//}
//if (g_pKeyboardDevice!=NULL)
//{
// g_pKeyboardDevice->Release();
// g_pKeyboardDevice=NULL;
//}
//if (g_pDirectInput!=NULL)
//{
// g_pDirectInput->Release();
// g_pDirectInput=NULL;
//}
//if (g_pd3dDevice!=NULL)
//{
// g_pd3dDevice->Release();
// g_pd3dDevice=NULL;
//}
}
BOOL ReadDevice(IDirectInputDevice8 *pDIDevice,void *pBuffer,long ISize)
{
HRESULT hr;
while(true)
{
/*pDIDevice->Poll();*/
pDIDevice->Acquire();
if (SUCCEEDED(hr=pDIDevice->GetDeviceState(ISize,pBuffer))) break;
if (hr!=DIERR_INPUTLOST||hr!=DIERR_NOTACQUIRED) return FALSE;
/*if (FAILED(pDIDevice->Acquire())) return FALSE */;
}
return TRUE;
}
代码实例2:
// @time: 2012.3.26
// @author: jadeshu
// des: DirectX鼠标控制程序
#include <Windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <atlstr.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#define ReleaseD3D(x) if (x!=NULL){x->Release();x=NULL;}
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"d3d9.lib")
#pragma comment(lib,"d3dx9.lib")
#pragma comment(lib,"dinput8.lib")
#pragma comment(lib, "dxguid.lib")
//全局变量
TCHAR g_szWindowName[]=_T("DirectX鼠标控制程序");
BOOL bActive = TRUE;
DIMOUSESTATE g_diMousestate={0};
//定义设备接口
IDirect3DDevice9 * g_pd3dDevice=NULL;
LPDIRECTINPUT8 g_pDirectInput=NULL; //DirectInput接口
LPDIRECTINPUTDEVICE8 g_pMouseDevice=NULL; //键盘输入接口
LPD3DXMESH g_pMeshTeapot=NULL; //茶壶网格对象
//回调函数声明
LRESULT CALLBACK WinProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
//初始化Direct3D函数声明
HRESULT Init3D(HWND hwnd,HINSTANCE hinstance);
//渲染声明
VOID Render();
//清除对象声明
VOID Cleanup();
//读取设备的输入数据
BOOL ReadDevice(IDirectInputDevice8 *pDIDevice,void *pBuffer,long ISize);
//主函数
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
//定义窗口类结构
TCHAR szAppName[]=TEXT("ClassN");
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
ZeroMemory(&msg,sizeof(msg));
wc.cbClsExtra=0;
wc.cbSize=sizeof(WNDCLASSEX);
wc.cbWndExtra=0;
wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wc.hCursor=LoadCursor(hInstance,IDC_ARROW);
wc.hIcon=LoadIcon(hInstance,IDI_APPLICATION);
wc.hIconSm=NULL;
wc.hInstance=hInstance;
wc.lpfnWndProc=WinProc;
wc.lpszClassName=szAppName;
wc.lpszMenuName=NULL;
wc.style=CS_HREDRAW|CS_VREDRAW;
//注册窗口
RegisterClassEx(&wc);
//创建窗口
hwnd=CreateWindow(szAppName,g_szWindowName,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
NULL,NULL,hInstance,0);
//加载3D初始化
if (FAILED(Init3D(hwnd,hInstance)))
{
return FALSE;
}
//显示和更新窗口
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
//消息循环
while (WM_QUIT!=msg.message)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
//转换消息
TranslateMessage(&msg);
//投递消息
DispatchMessage(&msg);
}
else if(bActive)
{
//渲染
Render();
}
else
{
if(!WaitMessage())
return -1;
}
}
//删除注册窗口
UnregisterClass(szAppName,hInstance);
return msg.wParam;
}
//回调函数
LRESULT CALLBACK WinProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch (uMsg)
{
case WM_PAINT:
Render(); //渲染
ValidateRect(hwnd,NULL); //更新窗口
return 0;
case WM_ACTIVATEAPP:
bActive = (BOOL)wParam;
break;
case WM_DESTROY:
Cleanup(); //清除对象
PostQuitMessage(0); //退出消息循环
return 0;
}
return DefWindowProc(hwnd,uMsg,wParam,lParam); //返回默认消息
}
//Direct3D初始化
HRESULT Init3D(HWND hwnd,HINSTANCE hinstance)
{
IDirect3D9 *pD3D=NULL; //定义对象接口
pD3D=Direct3DCreate9(D3D_SDK_VERSION); //创建对象接口
if (NULL==pD3D)
{
return E_FAIL;
}
D3DCAPS9 caps; //获取硬件设备信息
int vp=0;
pD3D->GetDeviceCaps(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,&caps);
if (caps.DevCaps&D3DDEVCAPS_HWTRANSFORMANDLIGHT)
{
vp=D3DCREATE_HARDWARE_VERTEXPROCESSING;
}
else
{
vp=D3DCREATE_SOFTWARE_VERTEXPROCESSING;
}
//创建Direct3D设备接口
D3DPRESENT_PARAMETERS d3dpp;
d3dpp.AutoDepthStencilFormat=D3DFMT_D24S8;
d3dpp.BackBufferCount=1;
d3dpp.BackBufferFormat=D3DFMT_A8R8G8B8;
d3dpp.BackBufferHeight=640;
d3dpp.BackBufferWidth=480;
d3dpp.EnableAutoDepthStencil=FALSE;
d3dpp.Flags=0;
d3dpp.FullScreen_RefreshRateInHz=D3DPRESENT_RATE_DEFAULT;
d3dpp.hDeviceWindow=hwnd;
d3dpp.MultiSampleQuality=0;
d3dpp.MultiSampleType=D3DMULTISAMPLE_NONE;
d3dpp.PresentationInterval=D3DPRESENT_INTERVAL_IMMEDIATE;
d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
d3dpp.Windowed=TRUE;
if (FAILED(pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dpp,&g_pd3dDevice)))
{
return E_FAIL;
}
D3DXCreateTeapot(g_pd3dDevice,&g_pMeshTeapot,0); //创建茶壶集合体
//创建DirectInput设备
DirectInput8Create(hinstance,0x0800,IID_IDirectInput8,(void **)&g_pDirectInput,NULL);
//创建键盘设备
g_pDirectInput->CreateDevice(GUID_SysMouse,&g_pMouseDevice,NULL);
//设置数据格式和协作级别
g_pMouseDevice->SetDataFormat(&c_dfDIMouse);
g_pMouseDevice->SetCooperativeLevel(hwnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE);
//获取设备
g_pMouseDevice->Acquire();
////世界变换矩阵
//D3DXMATRIX matWorld,Rx,Ry,Rz;
//D3DXMatrixIdentity(&matWorld);
//D3DXMatrixRotationX(&Rx,/*::timeGetTime()/1000*/1.0f);
//D3DXMatrixRotationY(&Ry,/*::timeGetTime()/1000*//*1.0f*/::timeGetTime()/1000.0f);
//D3DXMatrixRotationZ(&Rz,/*::timeGetTime()/1000.0f*//*::timeGetTime()/1000*/1.0f);
//matWorld=Rx*Ry*Rz*matWorld;
//g_pd3dDevice->SetTransform(D3DTS_WORLD,&matWorld);
//取景变换矩阵
D3DXMATRIX matView;
D3DXVECTOR3 vEye(0.0f,0.0f,-10.0f);
D3DXVECTOR3 vAt(0.0f,0.0f,0.0f);
D3DXVECTOR3 vUp(0.0f,1.0f,0.0f);
D3DXMatrixLookAtLH(&matView,&vEye,&vAt,&vUp);
g_pd3dDevice->SetTransform(D3DTS_VIEW,&matView);
//投影变换矩阵
D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH(&matProj,D3DX_PI/4.0f,1.0f,1.0f,1000.0f);
g_pd3dDevice->SetTransform(D3DTS_PROJECTION,&matProj);
pD3D->Release();
return S_OK;
}
//渲染图形
VOID Render()
{
g_pd3dDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME);
g_pd3dDevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(150,150,255),1.0f,0); //清除后台缓冲区
g_pd3dDevice->BeginScene(); //开始绘制
::ZeroMemory(&g_diMousestate,sizeof(g_pMouseDevice));
ReadDevice(g_pMouseDevice,(LPVOID)&g_diMousestate,sizeof(g_diMousestate));
////鼠标左键平移物体
static FLOAT fPosX=0.0f,fPosY=0.0f,fPosZ=0.0f;
if (g_diMousestate.rgbButtons[0]&0x80)
{
fPosX+=g_diMousestate.lX*0.01f; //沿X轴平移
fPosY+=g_diMousestate.lY*-0.01f; //沿Y轴平移
}
fPosZ+=g_diMousestate.lZ*0.005f;
D3DXMATRIX matWorld;
D3DXMatrixTranslation(&matWorld,fPosX,fPosY,fPosZ);
//鼠标右键旋转物体
static float fAngleX=0.0f,fAngleY=0.0f;
if (g_diMousestate.rgbButtons[1]&0x80)
{
fAngleX+=g_diMousestate.lX*-0.01f;
fAngleY+=g_diMousestate.lY*-0.01f;
}
D3DXMATRIX Rx,Ry;
D3DXMatrixRotationX(&Rx,fAngleX);
D3DXMatrixRotationY(&Ry,fAngleY);
matWorld=Rx*Ry*matWorld;
g_pd3dDevice->SetTransform(D3DTS_WORLD,&matWorld);
//绘制茶壶
g_pMeshTeapot->DrawSubset(0);
g_pd3dDevice->EndScene(); //结束绘制
g_pd3dDevice->Present(NULL,NULL,NULL,NULL); //从后台缓冲区复制到前台----翻转
}
//清除对象,内存
VOID Cleanup()
{
g_pMouseDevice->Unacquire();
ReleaseD3D(g_pMeshTeapot);
ReleaseD3D(g_pMouseDevice);
ReleaseD3D(g_pDirectInput);
ReleaseD3D(g_pd3dDevice);
//if (g_pMeshTeapot!=NULL)
//{
// g_pMeshTeapot->Release();
// g_pMeshTeapot=NULL;
//}
//if (g_pKeyboardDevice!=NULL)
//{
// g_pKeyboardDevice->Release();
// g_pKeyboardDevice=NULL;
//}
//if (g_pDirectInput!=NULL)
//{
// g_pDirectInput->Release();
// g_pDirectInput=NULL;
//}
//if (g_pd3dDevice!=NULL)
//{
// g_pd3dDevice->Release();
// g_pd3dDevice=NULL;
//}
}
BOOL ReadDevice(IDirectInputDevice8 *pDIDevice,void *pBuffer,long ISize)
{
HRESULT hr;
while(true)
{
/*pDIDevice->Poll();*/
pDIDevice->Acquire();
if (SUCCEEDED(hr=pDIDevice->GetDeviceState(ISize,pBuffer))) break;
if (hr!=DIERR_INPUTLOST||hr!=DIERR_NOTACQUIRED) return FALSE;
/*if (FAILED(pDIDevice->Acquire())) return FALSE */;
}
return TRUE;
}
DX9 DirectX鼠标控制程序 代码的更多相关文章
- DX9 DirectX键盘控制程序 代码
// @time: 2012.3.26 // @author: jadeshu // des: DirectX键盘控制程序 #include <Windows.h> #include &l ...
- DX9 DirectX 索引缓存(IndexBuffer) 代码
// @time: 2012.3.22 // @author: jadeshu // des: 索引缓存 //包含头文件 #include <Windows.h> #include < ...
- js模拟下拉菜单-键盘、鼠标(代码详解)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- DX9 空间坐标变换示例代码
// @time 2012.3.25 // @author jadeshu #include <Windows.h> #include <d3d9.h> #include &l ...
- 免费CSS鼠标样式代码大全
原文发布时间为:2008-08-01 -- 来源于本人的百度文章 [由搬家工具导入] http://5211.91.tc/sb.htm
- 使用C#+FFmpeg+DirectX+dxva2硬件解码播放h264流
本文门槛较高,因此行文看起来会乱一些,如果你看到某处能会心一笑请马上联系我开始摆龙门阵 如果你跟随这篇文章实现了播放器,那你会得到一个高效率,低cpu占用(单路720p视频解码播放占用1%左右cpu) ...
- 博客代码:iframe—网页中嵌入其他网页
iframe 是一个可以把另外一个网页嵌入到一个网页里的代码,非常有用.对于一个内容不错的网页,要方便地把它搬到自己的博客里,用这个代码最合适.而对于在新浪博客里不支持的一些网页效果和代码,可先把他们 ...
- JS禁止WEB页面鼠标事件大全
<!--禁止鼠标右键代码-->:<noscript><ifra:<scriptlanguage=javas:<!--:if(window.Event):doc ...
- 代码自动生成工具MyGeneration之一(程序员必备工具)
代码自动生成工具MyGeneration之一(程序员必备工具) 转 分类: C#2008-08-06 18:12 16064人阅读 评论(12) 收藏 举报 工具数据库相关数据库stringbrows ...
随机推荐
- 列表的pop()和路径拼接问题
我竟然发现了新大陆,感觉对列表已经啥也不清楚了 #pop()删除最后一项 l=[1,2,3] a=l.pop(-1) print(a) print(l) 结果: 3 [1, 2] 练习题:计算文件夹的 ...
- RMAN.DBMS_RCVCAT 版本错误处理
登录新装的catalog库准备注册数据库时报版本问题 rman target / catalog rman11g/rman2010#@rman Recovery Manager:Release 11. ...
- Monkey简介及环境搭建(1)
简介:Monkey是Android SDK自带的测试工具,是一个命令行工具,可以运行在模拟器中或者实际设备中,它向系统发送伪随机的用户事件流(如按键输入,触摸屏输入,手势输入等),实现对正在开发的应用 ...
- falsk 与 django cookie和session存、取、删的区别
falsk cookie的存取删需导入from flask import Flask,make_response,request# 存COOKIE的方法@app.route('/setcookie') ...
- 如何使用 window api 转换字符集?(std::string与std::wstring的相互转换)
//宽字符转多字节 std::string W2A(const std::wstring& utf8) { int buffSize = WideCharToMultiByte(CP_ACP, ...
- 如何在Pycharm中配置Python和Django(环境搭建篇)
一.准备好以下必备条件,并且按照先后顺序进行安装: Python 3.6 (64-bit).或Python27(64-bit) Django-1.11.tar.gz pycharm 开发工具 安装好了 ...
- 使用eclipse自动生成WSDL客户端代码
一.获取WSDL文件 从网上可以搜到一些提供各种服务的免费接口,比如获取天气预报的接口: http://www.webxml.com.cn/WebServices/WeatherWebService. ...
- open():打开文件
1.open():使用指定的模式和编码打开文件,返回文件读写对象 2.使用说明: (1)使用格式:open(filename [, mode [, bufsize]])(2)打开一个文件,返回一个fi ...
- update moudle 调用方式
向数据库中添加数据 ztt_teacher 1: 创建一个 function moudle,设置该moudle类型为 update moudle 2: 向数据库添加数据的代码 FUNCTION ...
- [django]django 3种返回json方法
django 3种返回json方法 1.手动组装字典返回 from django.http import JsonResponse, HttpResponse from django.shortcut ...