|
5#

楼主 |
发表于 2007-10-9 21:24:41
|
只看该作者
参数设显示器分辨率 VC6.0
#include <windows.h>
LRESULT CALLBACK WinProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;//主消息
inline long pow(long d,DWORD n)
{
long l;
if(n>0)
{
long d1=1;
for(l=0;l<n;l++)
d1*=d;
return d1;
}
else if(n==0)
return 1;
else return 0;
}
double charpToDouble(const char *pc)
{
int ZenSu=0;//整数位数
int ZenSuData[20];
int XiaoSu=0;//小数的位数
int XiaoSuData[20];
bool Zenbool=1;//是否正数
bool ZenEnd=0;//整数是否完成
long l,ll;
for(l=0;pc[l]!=NULL;l++)
{
if(l==0&&pc[l]=='-')
Zenbool=0;
else if (l==0&&pc[l]=='+')
Zenbool=1;
else if(ZenEnd==0&&pc[l]>='0'&&pc[l]<='9')
{ZenSuData[ZenSu++]=pc[l]-'0';}
else if(ZenEnd==1&&pc[l]>='0'&&pc[l]<='9')
{XiaoSuData[XiaoSu++]=pc[l]-'0';}
else if(ZenEnd==0&&pc[l]=='.')
ZenEnd=1;
else break;
}
double data=0;
for(l=0,ll=ZenSu-1;l<ZenSu;l++,ll--)
data+=pow(10,ll) * ZenSuData[l];
for(l=0;l<XiaoSu;l++)
data+=XiaoSuData[l]/pow(10,l+1);//(10^(l+1));
if(Zenbool)return data;
else return -data;
}
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
if(lpCmdLine==NULL||lpCmdLine[0]==NULL){::MessageBox(0,"请输入参数 如:\
\n1024 768 32\n或输入:\n1024任何数字768任何数字32\n或\nwidth=0height=0bit=32(输入0代表省略)","",0);return 0;}
int nOldWidth=::GetSystemMetrics(SM_CXSCREEN);
int nOldHeight=::GetSystemMetrics(SM_CYSCREEN);
int nNewWidth,nNewHeight,nNewBit;
char str[512],*s;
lstrcpy(str,lpCmdLine);
s=str;
int index=0;
char *sNum[3];
long b_yes=1;
while(*s)
{
if(*s>='0'&&*s<='9')
{
if(b_yes)
{
b_yes=0;
sNum[index++]=s;
if(index>=3)break;
}
}
else b_yes=1;
s++;
}
nNewWidth=(index>=1)?charpToDouble(sNum[0]):0;
nNewHeight=(index>=2)?charpToDouble(sNum[1]):0;
nNewBit=(index>=3)?charpToDouble(sNum[2]):0;
DEVMODE m={0};
m.dmSize=sizeof(DEVMODE);
if(nNewBit!=0)m.dmBitsPerPel=nNewBit;
if(nNewWidth!=0)m.dmPelsWidth=nNewWidth;
if(nNewHeight!=0)m.dmPelsHeight=nNewHeight;
m.dmFields=((nNewWidth!=0)?DM_PELSWIDTH:0)
|((nNewHeight!=0)?DM_PELSHEIGHT:0)
|((nNewBit!=0)?DM_BITSPERPEL:0) ;
ChangeDisplaySettings(&m,0);
}
yyq.exe 汇编
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib ; calls to functions in user32.lib and kernel32.lib
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
.DATA ; initialized data
ClassName db "yyqClassName",0 ; the name of our window class
AppName db "yyqAppName",0 ; the name of our window
OurText db "请点击 加载 显卡、网络、多媒体、虚拟内存",0
programname db "X:\\WXPE\\SYSTEM32\\PECMD.EXE EXEC !B:\\外置程序\\PE_DX_WMP\\yyq.cmd",0
processInfo PROCESS_INFORMATION <>
.DATA? ; Uninitialized data
hInstance HINSTANCE ? ; Instance handle of our program
CommandLine LPSTR ?
g_nTime DWORD ?
g_Fnreground DWORD ?
.CODE ; Here begins our code
start:
invoke GetModuleHandle, NULL ; get the instance handle of our program.
; Under Win32, hmodule==hinstance mov hInstance,eax
mov hInstance,eax
invoke GetCommandLine ; get the command line. You don't have to call this function IF
; your program doesn't process the command line.
mov CommandLine,eax
invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT ; call the main function
invoke ExitProcess, eax ; quit our program. The exit code is returned in eax from WinMain.
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX ; create local variables on stack
LOCAL msg:MSG
LOCAL hwnd:HWND
LOCAL nWidth:DWORD
LOCAL nHeight:DWORD
invoke GetSystemMetrics,SM_CXSCREEN
mov nWidth,eax
invoke GetSystemMetrics,SM_CYSCREEN
mov nHeight,eax
mov wc.cbSize,SIZEOF WNDCLASSEX ; fill values in members of wc
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc ; register our window class
invoke CreateWindowEx,NULL,\
ADDR ClassName,\
ADDR AppName,\
WS_POPUP or WS_VISIBLE or WS_SYSMENU,\
0,\
0,\
nWidth,\
28,\
NULL,\
NULL,\
hInst,\
NULL
mov hwnd,eax
invoke ShowWindow, hwnd,CmdShow ; display our window on desktop
invoke UpdateWindow, hwnd ; refresh the client area
invoke SetWindowPos,hwnd, HWND_TOPMOST,NULL,NULL,NULL,NULL,\
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE
mov g_nTime,0
mov g_Fnreground,0
invoke SetTimer,hwnd,1,1000,NULL
.WHILE TRUE ; Enter message loop
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
invoke KillTimer,hwnd,1
mov eax,msg.wParam ; return exit code in eax
ret
WinMain endp
WndYYQ proc
LOCAL startInfo:STARTUPINFO
invoke GetStartupInfo,ADDR startInfo
invoke CreateProcess,NULL,ADDR programname,NULL,NULL,FALSE,\
NORMAL_PRIORITY_CLASS,\
NULL,NULL,ADDR startInfo,ADDR processInfo
invoke CloseHandle,processInfo.hThread
invoke PostQuitMessage,0
ret
WndYYQ endp
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL hdc:HDC
LOCAL ps:PAINTSTRUCT
LOCAL rect:RECT
LOCAL hCurWnd:HWND
LOCAL lMyID: DWORD
LOCAL lCurID: DWORD
.IF uMsg==WM_DESTROY ; if the user closes our window
invoke PostQuitMessage,NULL ; quit our application
.ELSEIF uMsg==WM_TIMER
add g_nTime,1
invoke GetForegroundWindow
.IF eax != hWnd
add g_Fnreground,1
.IF g_Fnreground==1
;hCurWnd = ::GetForegroundWindow();
invoke GetForegroundWindow
mov hCurWnd,eax
;lMyID = ::GetCurrentThreadId();
invoke GetCurrentThreadId
mov lMyID,eax
; lCurID = ::GetWindowThreadProcessId(hCurWnd, NULL);
invoke GetWindowThreadProcessId,hCurWnd, NULL
mov lCurID,eax
;AttachThreadInput( lMyID, lCurID, TRUE);
invoke AttachThreadInput,lMyID,lCurID,TRUE
;SetForegroundWindow();
invoke SetForegroundWindow,hWnd
;AttachThreadInput( lMyID, lCurID, FALSE);
invoke AttachThreadInput,lMyID, lCurID, FALSE
.Endif
.Endif
.IF g_nTime>=30 || g_Fnreground >= 2
invoke PostQuitMessage,0
.endif
.ELSEIF uMsg==WM_RBUTTONDOWN
invoke WndYYQ
.ELSEIF uMsg==WM_LBUTTONDOWN
invoke WndYYQ
.ELSEIF uMsg==WM_PAINT
invoke BeginPaint,hWnd, ADDR ps
mov hdc,eax
invoke GetClientRect,hWnd, ADDR rect
invoke DrawText, hdc,ADDR OurText,-1, ADDR rect, \
DT_SINGLELINE or DT_CENTER or DT_VCENTER
invoke EndPaint,hWnd, ADDR ps
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam ; Default message processing
ret
.ENDIF
xor eax,eax
ret
WndProc endp
end start
老九XPEHELP改名工具
#include <Windows.h>
#pragma comment(linker, "/SECTION:MiniPE,") //创建自定义的 MiniPE Section
#pragma comment(linker, "/MERGE:.data=MiniPE") //合并.data Section 到 MiniPE Section
#pragma comment(linker, "/MERGE:.text=MiniPE") //合并.text Section 到 MiniPE Section
#pragma comment(linker, "/MERGE:.rdata=MiniPE") //合并.rdata Section 到 MiniPE Section
//////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//全局变量
HWND g_hWnd; //主窗口句柄,一般程序中经常用到此变量,故使用全局变量
HINSTANCE g_hInst; //应用程序进程句柄,一般程序中经常用到此变量,故使用全局变量
const char c_szAppName[] = "MiniPE";
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//函数声明
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow);
////////////////////////////////////////////////////////////////////////////////////////////////////
#define TestString2 "C"
#define OurText "输入要更改的盘符: "
#define OurText2 "新文件名(5个字符,限英文)"
#define ButtonClassName "button"
#define ButtonText "改名"
#define EditClassName "edit"
HWND hwndButton ;
HWND hwndEdit ;
HWND hwndEdit2 ;
#define ButtonID 1
#define EditID 2
#define IDM_HELLO 1
#define IDM_CLEAR 2
#define IDM_GETTEXT 3
#define IDM_EXIT 4
#define CFile_CreateWrite(hFile,m_strFileName) CFile_Open(hFile,m_strFileName,OF_WRITE|OF_CREATE)
bool CFile_Open(HANDLE &hFile,LPCTSTR m_strFileName, UINT nOpenFlags=OF_READ)
{
if(nOpenFlags==OF_READ)
{
hFile= CreateFile( m_strFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,\
FILE_ATTRIBUTE_NORMAL, NULL);
}
else if(nOpenFlags&OF_WRITE)
{
if(nOpenFlags&OF_CREATE )
hFile= CreateFile( m_strFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS/*CREATE_NEW*/,\
FILE_ATTRIBUTE_NORMAL, NULL);
else hFile= CreateFile( m_strFileName,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING,\
FILE_ATTRIBUTE_NORMAL, NULL);
}
bool m_bCloseOnDelete= hFile!=INVALID_HANDLE_VALUE;
return (bool)m_bCloseOnDelete;
}
#define CFile_Close(hFile)if(hFile != INVALID_HANDLE_VALUE)\
{::CloseHandle(hFile);hFile = INVALID_HANDLE_VALUE;}
UINT CFile_Read(HANDLE &hFile,void *lpBuf, UINT nCount)
{DWORD dwRead;::ReadFile(hFile, lpBuf, nCount, &dwRead, NULL);return (UINT)dwRead;}
#define CFile_Write(hFile,lpBuf, nCount) {if (nCount != 0)\
{DWORD nWritten;::WriteFile(hFile, lpBuf, nCount, &nWritten, NULL);}}
ULONGLONG CFile_GetLength(HANDLE &hFile)
{
ULARGE_INTEGER liSize;
liSize.LowPart = ::GetFileSize(hFile, &liSize.HighPart);
return liSize.QuadPart;
}
DWORD Str16ToDword(char *);
char *LongToStr16(long l,char *s)
{
long l1;
for(l1=0;l1<8;l1++)
{
long b=(l>>28)&0x0f;
if(b>=10)
{
s[l1]=(b-10)+'A';
}
else
{
s[l1]=b+'0';
}
l=l<<4;
}
s[l1]=0;
return s;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//主函数
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
{
MSG sMsg;
WNDCLASSEX sWndClassEx;
g_hInst = hInstance;
sWndClassEx.cbSize = sizeof(WNDCLASSEX);
sWndClassEx.style = CS_VREDRAW | CS_HREDRAW;
sWndClassEx.lpfnWndProc = (WNDPROC) WindowProc;
sWndClassEx.cbClsExtra = 0;
sWndClassEx.cbWndExtra = 0;
sWndClassEx.hInstance = g_hInst;
sWndClassEx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
sWndClassEx.hCursor = LoadCursor(NULL, IDC_ARROW);
sWndClassEx.hbrBackground = (HBRUSH) (COLOR_WINDOW);
sWndClassEx.lpszMenuName = NULL;
sWndClassEx.lpszClassName = c_szAppName;
sWndClassEx.hIconSm = NULL;
RegisterClassEx(&sWndClassEx);
g_hWnd = CreateWindowEx(0, c_szAppName, c_szAppName, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 300, 250,
NULL, NULL, g_hInst, NULL);
ShowWindow(g_hWnd, iCmdShow);
UpdateWindow(g_hWnd);
while (GetMessage(&sMsg, NULL, 0, 0))
{
TranslateMessage(&sMsg);
DispatchMessage(&sMsg);
}
return((int) sMsg.wParam);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//主窗口回调函数
long GetStrStrNum(const char *str1,const char *str2)//获得 str1 中的str2 的数目
{
long len2=lstrlen(str2);
long len1=lstrlen(str1);
long index=0;
if(str2==0||str2[0]==NULL)return -1;
for(;;)
{
if(len2>len1)return index;
for(long l=0;;l++)
{
if(l>=len2){index++;break;}//all ==
if(str1[l]!=str2[l])break;
}
str1++;
len1--;
}
}
BOOL CmpStrHStr(const char *str1,const char *str2)//判断 字符串1头 == 字符串2
{
long len2=lstrlen(str2);
long len1=lstrlen(str1);
if(str2==0||str2[0]==NULL||len2>len1)return 0;
for(long l=0;;l++)
{
if(l>=len2){return 1;}
if(str1[l]!=str2[l])return 0;
}
}
void ByteTH(BYTE *pByte,DWORD dSize,const char *s1,const char *s2)
{
long l,l2,len=lstrlen(s1);
char *s=(char*)pByte;
for(l=0;(DWORD)l<(dSize-len-1);)
{
if(CmpStrHStr(s+l,s1))
{
for(l2=0;l2<len;l2++)
{
s[l+l2]=s2[l2];
}
l+=len;
}
else l++;
}
}
char * GetStrRight(char *str1,char *str2)//获得 str1 中 str2 最右边 位置(字符串)
{
long len2=lstrlen(str2);
long len1=lstrlen(str1);
if(str2==0||str2[0]==NULL)return 0;
char *_str1=str1+len1-len2;
for(;;)
{
if(_str1<str1)return 0;
for(long l=0;;l++)
{
if(l>=len2){return _str1;}//all ==
if(_str1[l]!=str2[l])break;
}
_str1--;
}
}
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
switch (uMsg)
{
case WM_COMMAND :
if(lParam==0 )
{
if((wParam&0x0000FFFF)==IDM_GETTEXT )
{
char *s;
long l;
BOOL b;
char str[256];
long index;
BYTE *buffer;
char filename[256];
char s1[2][128];
GetWindowText(hwndEdit,s1[0],128);
GetWindowText(hwndEdit2,s1[1],128);
if(lstrlen(s1[0])!=0)
{
if(lstrlen(s1[1])==0||lstrlen(s1[1])!=5)
{
::MessageBox(hWnd,"请输入新文件名(5个字符,限英文(a-z)和数字(0-9))","",0);
}
else
{
b=1;
for(l=0;l<5;l++)
{
if(
(s1[1][l]>='A'&&s1[1][l]<='Z')
||(s1[1][l]>='a'&&s1[1][l]<='z')
||(s1[1][l]>='0'&&s1[1][l]<='9')
)
{}
else
{
b=0;
break;
}
}
if(b==0)
{
::MessageBox(hWnd,"新文件名(限英文(a-z)和数字(0-9))","",0);
}
else
{
filename[0]=s1[0][0];
filename[1]=':';
lstrcpy(&filename[2],"BOOT.INI");
HANDLE hFile;
if(!CFile_Open(hFile,filename))
{
::MessageBox(hWnd,"指定位置BOOT.INI 文件不存在","",0);
}
else
{
index=(long)CFile_GetLength(hFile);
buffer=new BYTE [index+1];
CFile_Read(hFile,buffer,(long) CFile_GetLength(hFile));
buffer[index]=0;
long lNum=GetStrStrNum((char *)buffer,":\\AVLDR.PE");
if(lNum==0)
{
::MessageBox(hWnd,"BOOT.INI 中没有发现 AVLDR.PE","",0);
CFile_Close(hFile);
}
else if(lNum!=1)
{
::MessageBox(hWnd,"错误 BOOT.INI 中发现太多 AVLDR.PE","",0);
CFile_Close(hFile);
}
else
{
s=GetStrRight((char *)buffer,":\\AVLDR.PE");
s+=2;
s[0]=s1[1][0];
s[1]=s1[1][1];
s[2]=s1[1][2];
s[3]=s1[1][3];
s[4]=s1[1][4];
CFile_Close(hFile);
SetFileAttributes(filename, \
GetFileAttributes(filename)&( ~FILE_ATTRIBUTE_READONLY));
CFile_Open(hFile,filename,OF_WRITE);
CFile_Write(hFile,buffer,index);
CFile_Close(hFile);
SetFileAttributes(filename, \
GetFileAttributes(filename)|( FILE_ATTRIBUTE_READONLY));
delete [] buffer;
lstrcpy(&filename[2],"AVLDR.PE");
if(!CFile_Open(hFile,filename))
{
::MessageBox(hWnd,"指定位置AVLDR.PE 文件不存在","",0);
}
else
{
index=(long)CFile_GetLength(hFile);
buffer=new BYTE [index];
CFile_Read(hFile,buffer,(long) CFile_GetLength(hFile));
buffer[0x000002f0]=s1[1][0];
buffer[0x000002f0+1]=s1[1][1];
buffer[0x000002f0+2]=s1[1][2];
buffer[0x000002f0+3]=s1[1][3];
buffer[0x000002f0+4]=s1[1][4];
CFile_Close(hFile);
SetFileAttributes(filename, \
GetFileAttributes(filename)&( ~FILE_ATTRIBUTE_READONLY));
CFile_Open(hFile,filename,OF_WRITE);
CFile_Write(hFile,buffer,index);
CFile_Close(hFile);
lstrcpy(str,filename);
filename[2]=s1[1][0]; //filename[2]=s1[1][0];
filename[3]=s1[1][1];
filename[4]=s1[1][2];
filename[5]=s1[1][3];
filename[6]=s1[1][4];
MoveFile(str,filename);
SetFileAttributes(filename, \
GetFileAttributes(filename)|( FILE_ATTRIBUTE_READONLY));
delete [] buffer;
lstrcpy(&filename[2],"PELDR");
if(!CFile_Open(hFile,filename))
{
::MessageBox(hWnd,"指定位置PELDR 文件不存在","",0);
}
else
{
index=(long)CFile_GetLength(hFile);
buffer=new BYTE [index];
CFile_Read(hFile,buffer,(long) CFile_GetLength(hFile));
ByteTH(buffer,index,"WINNT",s1[1]);
ByteTH(buffer,index,"winnt",s1[1]);
CFile_Close(hFile);
SetFileAttributes(filename, \
GetFileAttributes(filename)&( ~FILE_ATTRIBUTE_READONLY));
CFile_Open(hFile,filename,OF_WRITE);
CFile_Write(hFile,buffer,index);
CFile_Close(hFile);
lstrcpy(str,filename);
filename[2]=s1[1][0]; //filename[2]=s1[1][0];
filename[3]=s1[1][1];
filename[4]=s1[1][2];
filename[5]=s1[1][3];
filename[6]=s1[1][4];
MoveFile(str,filename);
SetFileAttributes(filename, \
GetFileAttributes(filename)|( FILE_ATTRIBUTE_READONLY));
delete [] buffer;
lstrcpy(&filename[2],"WINNT.SIF");
if(!CFile_Open(hFile,filename))
{
::MessageBox(hWnd,"指定位置WINNT.SIF 文件不存在","",0);
}
else
{
index=(long)CFile_GetLength(hFile);
buffer=new BYTE [index+1];
CFile_Read(hFile,buffer,(long) CFile_GetLength(hFile));
buffer[index]=0;
CFile_Close(hFile);
s=GetStrRight((char *)buffer,"WinPE.");
if(s!=0)
{
str[0]=s[0];str[1]=s[1];str[2]=s[2];
str[3]=s[3];str[4]=s[4];str[5]=s[5];
str[6]=s[6];str[7]=s[7];str[8]=s[8];
str[9]=0;
char str2[256];
lstrcpy(str2,str);
ByteTH(buffer,index,"WinPE",s1[1]);
SetFileAttributes(filename, \
GetFileAttributes(filename)&( ~FILE_ATTRIBUTE_READONLY));
CFile_Open(hFile,filename,OF_WRITE);
CFile_Write(hFile,buffer,index);
CFile_Close(hFile);
lstrcpy(str,filename);
filename[2]=s1[1][0]; //filename[2]=s1[1][0];
filename[3]=s1[1][1];
filename[4]=s1[1][2];
filename[5]=s1[1][3];
filename[6]=s1[1][4];
MoveFile(str,filename);
SetFileAttributes(filename, \
GetFileAttributes(filename)|( FILE_ATTRIBUTE_READONLY));
delete [] buffer;
lstrcpy(&filename[2],str2);
if(!CFile_Open(hFile,filename))
{
::MessageBox(hWnd,"指定位置WinPE 文件不存在","",0);
}
else
{
CFile_Close(hFile);
strcpy(str,filename);
filename[2]=s1[1][0];
filename[3]=s1[1][1];
filename[4]=s1[1][2];
filename[5]=s1[1][3];
filename[6]=s1[1][4];
MoveFile(str, filename);
::MessageBox(hWnd,"所有任务已完成","",0);
}
}
else delete [] buffer;
}
}
}
}
}
}
}
}
}
else if((wParam&0x0000FFFF)==IDM_EXIT)
DestroyWindow(hWnd ) ;
}
else
{
if((wParam&0x0000FFFF)==ButtonID )
{
if((wParam>>16)==BN_CLICKED )
SendMessage(hWnd,WM_COMMAND,IDM_GETTEXT,0 );
}
}
break;
case WM_PAINT :
hdc=BeginPaint(hWnd, &ps );
rect.left=50-30;
rect.top=35;
rect.right=140+60;
rect.bottom=55;
DrawText(hdc,OurText,-1, &rect,DT_SINGLELINE | DT_CENTER | DT_VCENTER );
rect.left=50-30;
rect.top=55;
rect.right=140+60;
rect.bottom=75;
DrawText(hdc,OurText2,-1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
EndPaint(hWnd, &ps );
break;
case WM_CREATE :
hwndEdit=CreateWindowEx(WS_EX_CLIENTEDGE, EditClassName,NULL,
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |ES_AUTOHSCROLL,
200,35,100,25,hWnd,(HMENU__ *)8,g_hInst,NULL );
hwndEdit2=CreateWindowEx(WS_EX_CLIENTEDGE, EditClassName,NULL,
WS_CHILD| WS_VISIBLE | WS_BORDER | ES_LEFT |ES_AUTOHSCROLL,
200,55,100,25,hWnd,(HMENU__ *)8,g_hInst,NULL );
SetFocus( hwndEdit2 );
SetWindowText(hwndEdit,TestString2);
SetWindowText(hwndEdit2,"PE001");
hwndButton=CreateWindowEx(NULL,ButtonClassName,ButtonText,WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
75,110,140,25,hWnd,(HMENU__ *)ButtonID,g_hInst,NULL);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return(DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return(0);
}
DWORD Str16ToDword(char *s)//16进制字符串 转换 整数
{
if(s==NULL||s[0]==NULL)return 0;
DWORD nV=0;
int index=0;
char *_s=s;
for(;*_s;)
{
if((*_s>='a'&&*_s<='f')||(*_s>='A'&&*_s<='F')||(*_s>='0'&&*_s<='9'))
{index++;_s++;}
else break;
}
if(index==0)return 0;
if(index>8)index=8;
DWORD _l;
for(long l=0; l<index;l++)
{
if(s[l]>='a'&&s[l]<='f')
_l=s[l]-'a'+10;
else if(s[l]>='A'&&s[l]<='F')
_l=s[l]-'A'+10;
else //if(*s>='0'&&*s<='9'))
_l=s[l]-'0';
nV|=(_l<<((index-l-1)*4));
}
return nV;
}
[ 本帖最后由 yyq572 于 2007-10-9 09:31 PM 编辑 ] |
|