简体   繁体   中英

c++ what type should I use in this dll script?

Here is the part of my dll which works fine but I want to improve it:

extern "C" __declspec(dllexport) void RightClick()
    {   
        hWindow = FindWindow(NULL, "My Window title");
        [...]
    }

What I'd like to have is something like this:

extern "C" __declspec(dllexport) void RightClick(**TYPE** variable)
    {   
        hWindow = FindWindow(NULL, **TYPE** variable);
        [...]
    }

Where variable is string, for example "Notepad - Untitled" which I can call in my autohotkey script, examplery:

f3::    
DllCall("Project4.dll\RightClick", **TYPE**, "Notepad - Untitled")
return

According to the documentation of FindWindow you should use LPCTSTR . It's a const TCHAR string. TCHAR is a wchar_t if you build your dll for Unicode charset or char otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM