📄 tut11.html
字号:
which pair of the filter strings will be initially used when the open file
dialog is first displayed. The index is 1-based, that is the first pair
is 1, the second pair is 2 and so on. So in the above example, if we specify
nFilterIndex as 2, the second pattern, "*.txt" will be used.</font></font></font></td>
</tr>
<tr>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>lpstrFile</font></font></font></td>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>Pointer
to the buffer that contains the filename used to initialize the filename
edit control on the dialog box. The buffer should be at least 260 bytes
long. </font></font></font>
<br><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>After
the user selects a file to open, the filename with full path is stored
in this buffer. You can extract the information from it later.</font></font></font></td>
</tr>
<tr>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>nMaxFile</font></font></font></td>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>The
size of the lpstrFile buffer.</font></font></font></td>
</tr>
<tr>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>lpstrTitle</font></font></font></td>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>Pointer
to the title of the open file dialog box</font></font></font></td>
</tr>
<tr>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>Flags</font></font></font></td>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>Determine
the styles and characteristics of the dialog box.</font></font></font></td>
</tr>
<tr>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>nFileOffset</font></font></font></td>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>After
the user selects a file to open, this member contains the index to the
first character of the actual filename. For example, if the full name with
path is "c:\windows\system\lz32.dll", the this member will contain the
value 18.</font></font></font></td>
</tr>
<tr>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>nFileExtension</font></font></font></td>
<td><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>After
the user selects a file to open, this member contains the index to the
first character of the file extension</font></font></font></td>
</tr>
</table></center>
<font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1></font></font></font>
<h3>
<font face="Arial,Helvetica"><font color="#CCCCCC"><font size=+0>Example:</font></font></font></h3>
<font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>The following
program displays an open file dialog box when the user selects File-> Open
from the menu. When the user selects a file in the dialog box, the program
displays a message box showing the full name, filename,and extension of
the selected file.</font></font></font><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1></font></font></font>
<p><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>.386</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>.model
flat,stdcall</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>option
casemap:none</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>WinMain
proto :DWORD,:DWORD,:DWORD,:DWORD</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>include
\masm32\include\windows.inc</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>include
\masm32\include\user32.inc</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>include
\masm32\include\kernel32.inc</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>include
\masm32\include\comdlg32.inc</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>includelib
\masm32\lib\user32.lib</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>includelib
\masm32\lib\kernel32.lib</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>includelib
\masm32\lib\comdlg32.lib</font></font></font></b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1></font></font></font>
<p><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>.const</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>IDM_OPEN
equ 1</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>IDM_EXIT
equ 2</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>MAXSIZE
equ 260</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>OUTPUTSIZE
equ 512</font></font></font></b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1></font></font></font>
<p><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>.data</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>ClassName
db "SimpleWinClass",0</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>AppName
db "Our Main Window",0</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>MenuName
db "FirstMenu",0</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>ofn
OPENFILENAME <></font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>FilterString
db "All Files",0,"*.*",0</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>
db "Text Files",0,"*.txt",0,0</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>buffer
db MAXSIZE dup(0)</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>OurTitle
db "-=Our First Open File Dialog Box=-: Choose the file to open",0</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>FullPathName
db "The Full Filename with Path is: ",0</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>FullName
db "The Filename is: ",0</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>ExtensionName
db "The Extension is: ",0</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>OutputString
db OUTPUTSIZE dup(0)</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>CrLf
db 0Dh,0Ah,0</font></font></font></b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1></font></font></font>
<p><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>.data?</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>hInstance
HINSTANCE ?</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>CommandLine
LPSTR ?</font></font></font></b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1></font></font></font>
<p><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>.code</font></font></font></b>
<br>
<b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>start:</font></font></font></b>
<br>
<b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>
invoke GetModuleHandle, NULL</font></font></font></b> <br>
<b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>
mov hInstance,eax</font></font></font></b> <br>
<b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>
invoke GetCommandLine<br>
mov CommandLine,eax</font></font></font></b> <br>
<b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>
invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT</font></font></font></b>
<br>
<b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>
invoke ExitProcess,eax</font></font></font></b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1></font></font></font>
<p><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>WinMain
proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>
LOCAL wc:WNDCLASSEX</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>
LOCAL msg:MSG</font></font></font></b>
<br><b><font face="Arial,Helvetica"><font color="#CCCCCC"><font size=-1>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -