Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding a dll function to QM
#2
To add Windows API functions to QM:
1. Type function name in macro. If it's colored, you can use it; goto 8.
2. Look in status bar. If it contains function declaration, you can use it; goto 8.
3. Type WINAPIV.FunctionName. If it becomes colored, you can use it; goto 8.
4. Type WINAPI7.FunctionName. If it becomes colored, you can use it; goto 8.
5. Download and install More Windows API declarations for QM
6. Type WINAPI2.FunctionName. If it becomes colored, you can use it; goto 8.
7. Convert declaration from C++ to QM.
8. If need Unicode version, and function name does not end with W, append W and goto g1.

Most Windows API functions with string parameters have 2 versions, eg PathMakeSystemFolderA (ANSI, strings are lpstr ($)) and PathMakeSystemFolderW (Unicode UTF-16, strings are word* (@*)). PathMakeSystemFolder actually does not exist, and QM then picks the A version. Declaration examples:
dll Shlwapi #PathMakeSystemFolder $pszPath ;;ANSI version
dll Shlwapi #PathMakeSystemFolderW @*pszPath ;;Unicode version

It's better to use W version. ANSI version will not work with strings containing non-ASCII characters, because default QM string encoding is UTF-8. Example:
str sf.expandpath("$my qm$\sys")
mkdir sf
if(!PathMakeSystemFolderW(@sf)) out _s.dllerror ;;operator @ converts from QM string encoding to UTF-16


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)