ในหัวข้อนี้มี Function ที่ต้องศึกษาอยู่ 2 ตัวครับมาดูกันเลย
**Hidden Content: To see this hidden content your post count must be 2 or greater.**
ในหัวข้อนี้มี Function ที่ต้องศึกษาอยู่ 2 ตัวครับมาดูกันเลย
**Hidden Content: To see this hidden content your post count must be 2 or greater.**
parameter ตัวแรก เขาไม่ได้บอกว่าให้ปล่อยเป็น NULL ได้ครับ เขาแค่บอกว่า ถ้าเป็น NULL จะได้ path ของ process ปัจจุบันตัวแรกชื่อว่า GetModuleFileName Function เป็น Function ที่ใช้ในการหา path ของไฟล์ครับ
มาดูราละเอียดกัน
DWORD WINAPI GetModuleFileName(
__in HMODULE hModule,
__out LPTSTR lpFilename,
__in DWORD nSize
);
Parameters
hModule
A handle to the loaded module whose path is being requested. If this parameter is NULL, GetModuleFileName retrieves the path of the executable file of the current process.
lpFilename
A pointer to a buffer that receives the fully-qualified path of the module. If the length of the path exceeds the size that the nSize parameter specifies, the function succeeds, and the string is truncated to nSize characters and cannot be null terminated.
The string returned will use the same format that was specified when the module was loaded. Therefore, the path can be a long or short file name, and can use the prefix "\\?\". For more information, see Naming a File.
nSize
The size of the lpFilename buffer, in TCHARs.
มัน จะรับ Parameters 3ตัวครับ ตัวแรกเค้าบอกว่าปล่อยเป็น NULL ได้ ตัวที่สองเป็น string ครับ ตัวที่สามเป็ขนาด อาจจะงง พอเห็นตัวอย่างก็จะเข้าใจครับ [/b]
ที่ผมต้องบอกว่า ตัวแรกเค้าบอกว่าปล่อยเป็น NULL ได้ ก็เพราะว่าให้คนที่พึ่งจะเริ่มเขียนนำไปใช้ได้เลยครับไม่ต้องทำความเข้าใจมากมาย
แต่ก็ขอบคุณที่เข้ามาทักท้วงครับ **ทีีหลังจะแปลตรงๆละกัน
Actions : (View-Readers)
There are no names to display.