Danyfirex Posted April 21, 2012 Posted April 21, 2012 Hi, today I'm following Dealing_with_Dll Tutorial. And I don't know how to put the parameters.I don't understand what this means. lpClassName [in, optional] Type: LPCTSTR The class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If lpClassName points to a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names. If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter. sorry for my grammar mistakes... This is my code: $X = dllcall("user32.dll","HWND","FindWindow","str","str") msgbox(0,"",$X) Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Mat Posted April 21, 2012 Posted April 21, 2012 (edited) A few things:There is no function called Findwindow. You have to specify whether you want to pass ansi or unicode strings, by calling either "FindWindowA" or "FindWindowW" respectively. I am surprised that isn't covered by the tutorial. This is the same for all functions in the winapi that take string parameters (except a few that only allow one or the other), and can be told by the fact they use LPCTSTR (read as: Long Pointer to a constant TCHAR string), TCHAR being either ansi or unicode depending on what is being used. Scroll to the bottom of msdn pages and look for the row in the table saying "Unicode and ANSI names" to see these.DllCall requires parameters as well as type names. Right now you are only passing the types, which makes no sense. Look at the documentation for DllCall again, and you'll see that parameters are given as DllCall("Dll", "Return Type", "Function", "Arg type 1", "Arg 1", "Arg type 2", "Arg 2", ..., "Arg type N", "Arg N")DllCall returns an array, so nothing will show up in the message box. Instead, you can show the return value from the function by reading the first element of the array, or show the entire array using _ArrayDisplay. If you are using the array though, you must check for errors as the return value might now be an array at all if the function fails.A good reference point is to look at how it has already been implemented in _WinAPI_Findwindow. This will also show you how to deal with the fact that the lpClassName parameter is not necessarily a pointer to a string. Edited April 21, 2012 by Mat AutoIt Project Listing
KaFu Posted April 21, 2012 Posted April 21, 2012 Use the AU3Info tool or _WinAPI_GetClassName($hWnd) to get the class name. $X = DllCall("user32.dll", "HWND", "FindWindow", "str", "Shell_TrayWnd", "str", "") MsgBox(0, "", "Out: " & $X[0] & @CRLF & "In #1: " & $X[1] & @CRLF & "In #2: " & $X[2]) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Danyfirex Posted April 21, 2012 Author Posted April 21, 2012 (edited) MatI thought it did not matter if I put"W"or "A" as long as I use "str"or "WSTR" respectively.thank you so much Kafu Edited April 21, 2012 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Mat Posted April 21, 2012 Posted April 21, 2012 I thought it did not matter if I put"W"or "A" as long as I use "str"or "WSTR" respectively.You are right (sort of) I hadn't realised that AutoIt automagically adds the 'A' by default. However, if you passed a wstr parameter it would still try and use the ansi version (according to the docs). You can ignore my first point above then. I've just got into the habit of always saying which one I wanted. AutoIt Project Listing
Danyfirex Posted April 21, 2012 Author Posted April 21, 2012 ok thank you Mat and Kafu thank you for your advice.Solved.. Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
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