TerenceAgius Posted March 2, 2013 Share Posted March 2, 2013 I have this piece of code $MapView = DllCall($hDll, [b]"str"[/b], "MapViewOfFile", _ "hwnd", $hFile[0], _ "dword", $FILE_MAP_WRITE, _ "dword", 0, _ "dword", 0, _ "dword", 0) Now "str" should be "hwnd" but if I do, I cannot read the returned string. In Autoit, is there a manual conversion function which can "cast" or convert a variant into a string? Link to comment Share on other sites More sharing options...
KaFu Posted March 2, 2013 Share Posted March 2, 2013 (edited) Take a look at it's all there...Edit:You also might want to take a look at excellent example ...expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_MapViewOfFile ; Description....: Maps a view of a file mapping into the address space of a calling process. ; Syntax.........: _WinAPI_MapViewOfFile ( $hMapping [, $iOffset [, $iBytes [, $iAccess]]] ) ; Parameters.....: $hMapping - Handle to a file mapping object. The _WinAPI_CreateFileMapping() and _WinAPI_OpenFileMapping() ; functions return this handle. ; $iOffset - The file offset where the view is to begin. ; $iBytes - The number of bytes of a file mapping to map to a view. All bytes must be within the maximum size ; specified by _WinAPI_CreateFileMapping(). If $iBytes is 0, the mapping extends from the specified ; offset to the end of the file mapping. ; $iAccess - The access to the file mapping object. This parameter can be one of the following values. ; ; $FILE_MAP_ALL_ACCESS ; $FILE_MAP_COPY ; $FILE_MAP_READ ; $FILE_MAP_WRITE ; ; Each of the preceding values can be combined with the following value. ; ; $FILE_MAP_EXECUTE ; ; Return values..: Success - The starting address of the mapped view. ; Failure - 0 and sets the @error flag to non-zero. ; Author.........: Yashied ; Modified.......: ; Remarks........: For files that are larger than the address space, you can only map a small portion of the file data at one time. ; When the first view is complete, then you unmap it and map a new view. ; Related........: ; Link...........: @@MsdnLink@@ MapViewOfFile ; Example........: Yes ; =============================================================================================================================== Func _WinAPI_MapViewOfFile($hMapping, $iOffset = 0, $iBytes = 0, $iAccess = 0x0006) Local $Ret = DllCall('kernel32.dll', 'ptr', 'MapViewOfFile', 'ptr', $hMapping, 'dword', $iAccess, 'dword', _WinAPI_HiDWord($iOffset), 'dword', _WinAPI_LoDWord($iOffset), 'dword', $iBytes) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) EndIf Return $Ret[0] EndFunc ;==>_WinAPI_MapViewOfFile Edited March 2, 2013 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
TerenceAgius Posted March 2, 2013 Author Share Posted March 2, 2013 Thanks Funny thing is I looked for ages for such UDFs...beautiful finished my app in minutes Link to comment Share on other sites More sharing options...
KaFu Posted March 2, 2013 Share Posted March 2, 2013 You're welcome ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now