⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit.inc

📁 一个背单词源码
💻 INC
字号:
.const
IDC_BTN2_CANCLE					equ 2001
IDC_BTN2_OK						equ 2002
IDC_EDT2_EXAMPLE				equ 2003
IDC_EDT2_EXPL					equ 2008
IDC_EDT2_IMAGIN					equ 2004
IDC_EDT2_PHONE					equ 2012
IDC_EDT2_PHRASE					equ 2009
IDC_EDT2_WORD					equ 2013
IDD_DLG_EDIT					equ 2000
.data?
hEdit2_Word			dd	?
hEdit2_Phone		dd	?
hEdit2_Explain		dd	?
hEdit2_Phrase		dd	?
hEdit2_Eg			dd	?
hEdit2_Legend		dd	?

.code
EditInit	proc	hWin:dword
	LOCAL tempfont:dword
	
	invoke GetWindowTextLength,hWord
	.if !eax
		invoke MessageBox,NULL,SADD("请先选定所要编辑的单词!!"),addr AppName,MB_ICONINFORMATION
		invoke SendMessage,hWin,WM_CLOSE,0,0
	.endif
	
	invoke GetDlgItem,hWin,IDC_EDT2_EXAMPLE			
	mov	hEdit2_Eg		,eax	
	invoke GetDlgItem,hWin,IDC_EDT2_EXPL			
	mov	hEdit2_Explain		,eax	
	invoke GetDlgItem,hWin,IDC_EDT2_IMAGIN			
	mov	hEdit2_Legend		,eax	
	invoke GetDlgItem,hWin,IDC_EDT2_PHONE			
	mov	hEdit2_Phone		,eax	
	invoke GetDlgItem,hWin,IDC_EDT2_PHRASE			
	mov	hEdit2_Phrase		,eax	
	invoke GetDlgItem,hWin,IDC_EDT2_WORD	
	mov	hEdit2_Word		,eax	
	invoke CreateFont,0,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_STRING_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,SADD("Kingsoft Phonetic Plain")
	invoke SendMessage,hEdit2_Phone,WM_SETFONT,eax,TRUE
	invoke CreateFont,0,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_STRING_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,SADD("宋体")	
	;invoke CreateFont,-13,0,0,0,700,1,0,0,-122,3,2,1,2,SADD("华文仿宋")
	mov tempfont,eax
	invoke SendMessage,hEdit2_Word,WM_SETFONT,tempfont,TRUE
	invoke SendMessage,hEdit2_Phrase,WM_SETFONT,tempfont,TRUE
	invoke SendMessage,hEdit2_Eg,WM_SETFONT,tempfont,TRUE
	;invoke SendMessage,hEdit2_Phone,WM_SETFONT,tempfont,TRUE
	invoke SendMessage,hEdit2_Legend,WM_SETFONT,tempfont,TRUE
	;invoke CreateFontIndirect,addr	temhdfont
	invoke SendMessage,hEdit2_Explain,WM_SETFONT,tempfont,TRUE
	
	
	invoke LoadIcon,hInstance,1002	
	invoke SendMessage,hWin,WM_SETICON,ICON_BIG,EAX

	
	ret

EditInit endp
EditSetText	proc hWin:dword
	
	;作用:
	;参数:
	;返回值:
	;
	;开发日期:
	;备注:
	LOCAL item:Item
	LOCAL lbufTableName[256]:byte
	LOCAL lbufSQL[1024]:byte
	LOCAL lbufAddr
	
	invoke GetWindowText,hWord,addr item.m_word,sizeof item.m_word
	invoke SetWindowText,hEdit2_Word,addr item.m_word
	invoke SingleQuote2Two,addr item.m_word 
	;Msg item.m_word
	invoke GetWindowText,hCombo,addr lbufTableName,256
	invoke wsprintf,addr lbufSQL,SADD("select * from %s where 单词 = '%s'"),\
					addr lbufTableName,addr item.m_word
	;Msg lbufSQL
	invoke ODBCExeDirect,addr lbufSQL
	;绑定结果区
	mov [item.m_no],byte ptr 0
	mov [item.m_word],byte ptr 0
	mov [item.m_phon],byte ptr 0
	mov [item.m_expl],byte ptr 0
	mov [item.m_phrase],byte ptr 0
	mov [item.m_eg],byte ptr 0
	mov [item.m_legd],byte ptr 0
	invoke SQLBindCol, hStmt,1,SQL_C_CHAR, addr item.m_word, sizeof item.m_word,addr lbufAddr
	invoke SQLBindCol, hStmt,2,SQL_C_CHAR, addr item.m_phon, sizeof item.m_phon,addr lbufAddr
	invoke SQLBindCol, hStmt,3,SQL_C_CHAR, addr item.m_expl, sizeof item.m_expl,addr lbufAddr
	invoke SQLBindCol, hStmt,4,SQL_C_CHAR, addr item.m_phrase, sizeof item.m_phrase,addr lbufAddr
	invoke SQLBindCol, hStmt,5,SQL_C_CHAR, addr item.m_eg	, sizeof item.m_eg	,addr lbufAddr
	invoke SQLBindCol, hStmt,6,SQL_C_CHAR, addr item.m_legd	, sizeof item.m_legd	,addr lbufAddr
	
	.if ax==SQL_SUCCESS || ax==SQL_SUCCESS_WITH_INFO
		invoke SQLFetch, hStmt
		.if ax==SQL_SUCCESS || ax==SQL_SUCCESS_WITH_INFO
			;Msg	item.m_word				
			;invoke SetWindowText,hEdit2_Word,addr item.m_word			
			invoke SetWindowText,hEdit2_Phone,addr item.m_phon
			invoke SetWindowText,hEdit2_Phrase,addr item.m_phrase
			invoke SetWindowText,hEdit2_Eg,addr item.m_eg
			invoke SetWindowText,hEdit2_Legend,addr item.m_legd
			invoke SetWindowText,hEdit2_Explain,addr item.m_expl
		.endif
	.endif
	ret

EditSetText endp

EditOk	proc uses edi hWin:dword
	
	;作用:
	;参数:
	;返回值:
	;
	;开发日期:
	;备注:
	LOCAL item:Item
	LOCAL lpoldWord[256]:byte
	LOCAL lpTableName[256]:byte
	
	invoke GetWindowText,hWord,addr lpoldWord,256
	.if !eax
		MyDebug "取词时出错,在EditOk函数,EditInc文件!"
		ret
	.endif
	invoke GetWindowText,hCombo,addr lpTableName,256
	.if !eax
		MyDebug "取词库名时出错,在EditOk函数,EditInc文件!"
		ret
	.endif
	
	invoke SingleQuote2Two,addr lpoldWord
	
	invoke GetWindowText,hEdit2_Word,addr item.m_word,sizeof item.m_word
	invoke GetWindowText,hEdit2_Phone,addr item.m_phon,sizeof item.m_phon
	invoke GetWindowText,hEdit2_Explain,addr item.m_expl,sizeof item.m_expl
	invoke GetWindowText,hEdit2_Phrase,addr item.m_phrase,sizeof item.m_phrase
	invoke GetWindowText,hEdit2_Eg,addr item.m_eg,sizeof item.m_eg
	invoke GetWindowText,hEdit2_Legend,addr item.m_legd,sizeof item.m_legd
	
	invoke SingleQuote2Two,addr item.m_word
	invoke SingleQuote2Two,addr item.m_phon
	invoke SingleQuote2Two,addr item.m_expl
	invoke SingleQuote2Two,addr item.m_phrase
	invoke SingleQuote2Two,addr item.m_eg
	invoke SingleQuote2Two,addr item.m_legd
	
	invoke ODBCUpdate,addr lpTableName,addr item,addr lpoldWord
	
	invoke SetWindowText,hWord,addr item.m_word
			;invoke SetWindowText,h
			;音标			
			invoke SetWindowText,hEdtPhone,addr item.m_phon
			invoke GlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,64*1024
			invoke GlobalLock,eax			
			mov		edi,eax
			mov [edi],byte ptr 0
			
			invoke lstrlen,	addr item.m_expl
			
			.if eax>1				
					invoke lstrcat,edi,SADD("解释:",13,10)
					invoke lstrcat,edi,addr item.m_expl
					invoke lstrcat,edi,SADD(13,10)
			.endif
		
			invoke lstrlen,	addr item.m_phrase
			.if eax>1				
					invoke lstrcat,edi,SADD("词组:",13,10)
					invoke lstrcat,edi,addr item.m_phrase
					invoke lstrcat,edi,SADD(13,10)				
			.endif
			
			invoke lstrlen,	addr item.m_eg
			.if eax>1				
					invoke lstrcat,edi,SADD("例句:",13,10)
					invoke lstrcat,edi,addr item.m_eg
					invoke lstrcat,edi,SADD(13,10)				
			.endif	
			 
			invoke lstrlen,	addr item.m_legd
			.if eax>1		
					invoke lstrcat,edi,SADD("联想:",13,10)
					invoke lstrcat,edi,addr item.m_legd
					invoke lstrcat,edi,SADD(13,10)
			.endif
			
			invoke SetDlgItemText,hWin,IDC_EDT_EXPL,edi
			invoke GlobalUnlock,edi
			invoke GlobalFree,edi			
	
	
	ret

EditOk endp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -