原帖及讨论:http://bbs.bccn.net/thread-233329-1-1.html 用Win32asm写的"同时打开多个网页的实用小工具",请大家指正~~中秋自己过没趣,去南宁书城蹲地翻书也没趣,只好写小程序打发时间了~~ 谁叫自己还是个菜鸟呢,所以写的都是小程序~~ 这是个功能单一简单的小工具,觉得自己写得很粗陋,希望大家批评指正~~修改多了,它就会完善起来了. ;========================================= 程序很简单,但代码也有近400行吧.所以,只帖出主程序代码出来了.其它的,大家可以在附件中下载. 声明: 1.希望高手指正,而不是耻笑; 2.字符串匹配部分的代码,要感谢我们汇编论坛的dizengrong朋友! ;========================== 这个程序,你可以在列表中任意添加或删除网址,然后,就可以同时打开多个网址,对于每天都要到很多个网站浏览东西的朋友,不必为一一打开网址而麻烦了. ;================================== ;===程序功能:可以同时打开多个网页== ;=======作者:ONEPROBLEM============ .386 .model flat,stdcall option casemap:none ;=================================== include windows.inc include user32.inc includelib user32.lib include kernel32.inc includelib kernel32.lib include shell32.inc includelib shell32.lib
IDD_DIALOG equ 1 ICO_MAIN equ 1 IDC_ADD equ 1000 IDC_DELETE equ 1001 IDC_EDIT equ 1002 IDC_LISTBOX equ 1003
.data? hInstance dd ? hWinMain dd ? szBuffer db 256 dup (?) szBuffer1 db 256 dup (?)
.const szFileName db 'openwebtools.bat',0 szCaption db '友情提示',0 szText db '请您首先在列表中添加网址!',0 ;=================================================== .code include _writeFile.asm include _initListBox.asm include _deleteAddress.asm
;=================对话框过程========================== _procDlgMain proc uses ebx edi esi hWnd,wMsg,wParam,lParam mov eax,wMsg .if eax == WM_CLOSE invoke EndDialog,hWnd,NULL .elseif eax == WM_INITDIALOG push hWnd pop hWinMain invoke LoadIcon,hInstance,ICO_MAIN invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax invoke _initListBox,addr szFileName,hWinMain,IDC_LISTBOX .elseif eax == WM_COMMAND mov eax,wParam .if ax == IDCANCEL invoke EndDialog,hWnd,NULL .elseif ax == IDOK invoke ShellExecute,hWnd,0,addr szFileName,0,0,SW_SHOW .if eax < 31 invoke MessageBox,hWnd,addr szText,addr szCaption,MB_OK .else invoke EndDialog,hWnd,NULL .endif .elseif ax == IDC_EDIT invoke GetDlgItemText,hWnd,IDC_EDIT,addr szBuffer,sizeof szBuffer
.elseif ax == IDC_ADD ;添加模块 invoke SendDlgItemMessage,hWnd,IDC_LISTBOX,LB_ADDSTRING,0,addr szBuffer invoke _writeFile,addr szFileName,hWinMain,addr szBuffer .elseif ax == IDC_LISTBOX shr eax,16 .if ax == LBN_SELCHANGE invoke RtlZeroMemory,addr szBuffer1,sizeof szBuffer1 invoke SendMessage,lParam,LB_GETCURSEL,0,0 lea ecx,szBuffer1 invoke SendMessage,lParam,LB_GETTEXT,eax,ecx .endif .elseif ax == IDC_DELETE ;删除模块 invoke _deleteAddress,addr szFileName,hWinMain,addr szBuffer1 invoke SendDlgItemMessage,hWnd,IDC_LISTBOX,LB_RESETCONTENT,0,0 invoke SendMessage,hWnd,WM_INITDIALOG,0,0 .endif .else mov eax,FALSE ret .endif mov eax,TRUE ret _procDlgMain endp ;======================主程序================================== start: invoke GetModuleHandle,NULL mov hInstance,eax invoke DialogBoxParam,hInstance,IDD_DIALOG,NULL,offset _procDlgMain,NULL invoke ExitProcess,NULL end start ;============================================================== ONEPROBLEM.rar  
|