简体   繁体   English

C ++我应该在这个dll脚本中使用什么类型?

[英]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: 这是我的dll正常工作的一部分,但我想对其进行改进:

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 . 根据FindWindow的文档,您应该使用LPCTSTR It's a const TCHAR string. 这是一个const TCHAR字符串。 TCHAR is a wchar_t if you build your dll for Unicode charset or char otherwise. 如果您为Unicode字符集或char dll,则TCHARwchar_t

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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