Can't find window in c++












1















I'm pretty new to C++ and I'm making a hack for Assassin's Creed Odyssey, however I can't get my code to find the window.



HWND hwnd = FindWindowA(NULL,  "Assassin's Creed® Odyssey");


Window name(s):



image



EDIT: Got it to work, the apostrophe is different than a normal one, for whoever needs it, this is the correct window name Assassin’s Creed® Odyssey










share|improve this question




















  • 2





    Maybe you shouldn't openly be saying that you're hacking a commercial product. Just a thought, you do what you want.

    – DeiDei
    Nov 14 '18 at 2:05











  • Realize that the authors of some of the software you feel you need to hack may be members here.

    – PaulMcKenzie
    Nov 14 '18 at 2:11






  • 2





    All the same, I believe Stack Overflow itself doesn't discriminate when it comes to the intentions behind a question.

    – paddy
    Nov 14 '18 at 2:12











  • @DeiDei Ubisoft is fine if the game is single player, it's just multiplayer games that get you into trouble.

    – Tate Greeves
    Nov 14 '18 at 2:55











  • @TateGreeves you should have posted your solution as an answer instead of as an edit to your question. You can post answers to your own questions. Now, in its current form, your question is has basically become irrelevant for a Q+A site and should be deleted.

    – Remy Lebeau
    Nov 14 '18 at 3:55


















1















I'm pretty new to C++ and I'm making a hack for Assassin's Creed Odyssey, however I can't get my code to find the window.



HWND hwnd = FindWindowA(NULL,  "Assassin's Creed® Odyssey");


Window name(s):



image



EDIT: Got it to work, the apostrophe is different than a normal one, for whoever needs it, this is the correct window name Assassin’s Creed® Odyssey










share|improve this question




















  • 2





    Maybe you shouldn't openly be saying that you're hacking a commercial product. Just a thought, you do what you want.

    – DeiDei
    Nov 14 '18 at 2:05











  • Realize that the authors of some of the software you feel you need to hack may be members here.

    – PaulMcKenzie
    Nov 14 '18 at 2:11






  • 2





    All the same, I believe Stack Overflow itself doesn't discriminate when it comes to the intentions behind a question.

    – paddy
    Nov 14 '18 at 2:12











  • @DeiDei Ubisoft is fine if the game is single player, it's just multiplayer games that get you into trouble.

    – Tate Greeves
    Nov 14 '18 at 2:55











  • @TateGreeves you should have posted your solution as an answer instead of as an edit to your question. You can post answers to your own questions. Now, in its current form, your question is has basically become irrelevant for a Q+A site and should be deleted.

    – Remy Lebeau
    Nov 14 '18 at 3:55
















1












1








1








I'm pretty new to C++ and I'm making a hack for Assassin's Creed Odyssey, however I can't get my code to find the window.



HWND hwnd = FindWindowA(NULL,  "Assassin's Creed® Odyssey");


Window name(s):



image



EDIT: Got it to work, the apostrophe is different than a normal one, for whoever needs it, this is the correct window name Assassin’s Creed® Odyssey










share|improve this question
















I'm pretty new to C++ and I'm making a hack for Assassin's Creed Odyssey, however I can't get my code to find the window.



HWND hwnd = FindWindowA(NULL,  "Assassin's Creed® Odyssey");


Window name(s):



image



EDIT: Got it to work, the apostrophe is different than a normal one, for whoever needs it, this is the correct window name Assassin’s Creed® Odyssey







c++






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 3:54









Remy Lebeau

334k18254450




334k18254450










asked Nov 14 '18 at 1:59









Tate GreevesTate Greeves

92




92








  • 2





    Maybe you shouldn't openly be saying that you're hacking a commercial product. Just a thought, you do what you want.

    – DeiDei
    Nov 14 '18 at 2:05











  • Realize that the authors of some of the software you feel you need to hack may be members here.

    – PaulMcKenzie
    Nov 14 '18 at 2:11






  • 2





    All the same, I believe Stack Overflow itself doesn't discriminate when it comes to the intentions behind a question.

    – paddy
    Nov 14 '18 at 2:12











  • @DeiDei Ubisoft is fine if the game is single player, it's just multiplayer games that get you into trouble.

    – Tate Greeves
    Nov 14 '18 at 2:55











  • @TateGreeves you should have posted your solution as an answer instead of as an edit to your question. You can post answers to your own questions. Now, in its current form, your question is has basically become irrelevant for a Q+A site and should be deleted.

    – Remy Lebeau
    Nov 14 '18 at 3:55
















  • 2





    Maybe you shouldn't openly be saying that you're hacking a commercial product. Just a thought, you do what you want.

    – DeiDei
    Nov 14 '18 at 2:05











  • Realize that the authors of some of the software you feel you need to hack may be members here.

    – PaulMcKenzie
    Nov 14 '18 at 2:11






  • 2





    All the same, I believe Stack Overflow itself doesn't discriminate when it comes to the intentions behind a question.

    – paddy
    Nov 14 '18 at 2:12











  • @DeiDei Ubisoft is fine if the game is single player, it's just multiplayer games that get you into trouble.

    – Tate Greeves
    Nov 14 '18 at 2:55











  • @TateGreeves you should have posted your solution as an answer instead of as an edit to your question. You can post answers to your own questions. Now, in its current form, your question is has basically become irrelevant for a Q+A site and should be deleted.

    – Remy Lebeau
    Nov 14 '18 at 3:55










2




2





Maybe you shouldn't openly be saying that you're hacking a commercial product. Just a thought, you do what you want.

– DeiDei
Nov 14 '18 at 2:05





Maybe you shouldn't openly be saying that you're hacking a commercial product. Just a thought, you do what you want.

– DeiDei
Nov 14 '18 at 2:05













Realize that the authors of some of the software you feel you need to hack may be members here.

– PaulMcKenzie
Nov 14 '18 at 2:11





Realize that the authors of some of the software you feel you need to hack may be members here.

– PaulMcKenzie
Nov 14 '18 at 2:11




2




2





All the same, I believe Stack Overflow itself doesn't discriminate when it comes to the intentions behind a question.

– paddy
Nov 14 '18 at 2:12





All the same, I believe Stack Overflow itself doesn't discriminate when it comes to the intentions behind a question.

– paddy
Nov 14 '18 at 2:12













@DeiDei Ubisoft is fine if the game is single player, it's just multiplayer games that get you into trouble.

– Tate Greeves
Nov 14 '18 at 2:55





@DeiDei Ubisoft is fine if the game is single player, it's just multiplayer games that get you into trouble.

– Tate Greeves
Nov 14 '18 at 2:55













@TateGreeves you should have posted your solution as an answer instead of as an edit to your question. You can post answers to your own questions. Now, in its current form, your question is has basically become irrelevant for a Q+A site and should be deleted.

– Remy Lebeau
Nov 14 '18 at 3:55







@TateGreeves you should have posted your solution as an answer instead of as an edit to your question. You can post answers to your own questions. Now, in its current form, your question is has basically become irrelevant for a Q+A site and should be deleted.

– Remy Lebeau
Nov 14 '18 at 3:55














1 Answer
1






active

oldest

votes


















1














Ahh. FindWindowA expects an ANSI string. To use the ® in Microsoft Windows, you should use the wstring variant, and use a wstring literal:



HWND hwnd = FindWindowW(NULL, L"Assassin's Creed® Odyssey");



Do check that you are using the correct type of apostrophe. I can't tell from the screen capture whether it is an ANSI apostrophe or a right single quote.



The L before the " indicates that it is a wstring. In Windows computers this is pretty much UTF-16, though Microsoft Windows doesn't quite meet all the UTF-16 standards.



See https://en.cppreference.com/w/cpp/language/string_literal for more information on the various type of string literals.



This microsoft article: https://docs.microsoft.com/en-us/windows/desktop/learnwin32/working-with-strings, explains the difference between the ANSI functions (ending with 'A') and the Unicode functions (ending with 'W').






share|improve this answer


























  • Thanks alot, though that may have been the case, I went into the Spy++ and copied and pasted the window caption, the apostrophe was different than what I put in the HWND. It works now.

    – Tate Greeves
    Nov 14 '18 at 3:03











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292124%2fcant-find-window-in-c%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Ahh. FindWindowA expects an ANSI string. To use the ® in Microsoft Windows, you should use the wstring variant, and use a wstring literal:



HWND hwnd = FindWindowW(NULL, L"Assassin's Creed® Odyssey");



Do check that you are using the correct type of apostrophe. I can't tell from the screen capture whether it is an ANSI apostrophe or a right single quote.



The L before the " indicates that it is a wstring. In Windows computers this is pretty much UTF-16, though Microsoft Windows doesn't quite meet all the UTF-16 standards.



See https://en.cppreference.com/w/cpp/language/string_literal for more information on the various type of string literals.



This microsoft article: https://docs.microsoft.com/en-us/windows/desktop/learnwin32/working-with-strings, explains the difference between the ANSI functions (ending with 'A') and the Unicode functions (ending with 'W').






share|improve this answer


























  • Thanks alot, though that may have been the case, I went into the Spy++ and copied and pasted the window caption, the apostrophe was different than what I put in the HWND. It works now.

    – Tate Greeves
    Nov 14 '18 at 3:03
















1














Ahh. FindWindowA expects an ANSI string. To use the ® in Microsoft Windows, you should use the wstring variant, and use a wstring literal:



HWND hwnd = FindWindowW(NULL, L"Assassin's Creed® Odyssey");



Do check that you are using the correct type of apostrophe. I can't tell from the screen capture whether it is an ANSI apostrophe or a right single quote.



The L before the " indicates that it is a wstring. In Windows computers this is pretty much UTF-16, though Microsoft Windows doesn't quite meet all the UTF-16 standards.



See https://en.cppreference.com/w/cpp/language/string_literal for more information on the various type of string literals.



This microsoft article: https://docs.microsoft.com/en-us/windows/desktop/learnwin32/working-with-strings, explains the difference between the ANSI functions (ending with 'A') and the Unicode functions (ending with 'W').






share|improve this answer


























  • Thanks alot, though that may have been the case, I went into the Spy++ and copied and pasted the window caption, the apostrophe was different than what I put in the HWND. It works now.

    – Tate Greeves
    Nov 14 '18 at 3:03














1












1








1







Ahh. FindWindowA expects an ANSI string. To use the ® in Microsoft Windows, you should use the wstring variant, and use a wstring literal:



HWND hwnd = FindWindowW(NULL, L"Assassin's Creed® Odyssey");



Do check that you are using the correct type of apostrophe. I can't tell from the screen capture whether it is an ANSI apostrophe or a right single quote.



The L before the " indicates that it is a wstring. In Windows computers this is pretty much UTF-16, though Microsoft Windows doesn't quite meet all the UTF-16 standards.



See https://en.cppreference.com/w/cpp/language/string_literal for more information on the various type of string literals.



This microsoft article: https://docs.microsoft.com/en-us/windows/desktop/learnwin32/working-with-strings, explains the difference between the ANSI functions (ending with 'A') and the Unicode functions (ending with 'W').






share|improve this answer















Ahh. FindWindowA expects an ANSI string. To use the ® in Microsoft Windows, you should use the wstring variant, and use a wstring literal:



HWND hwnd = FindWindowW(NULL, L"Assassin's Creed® Odyssey");



Do check that you are using the correct type of apostrophe. I can't tell from the screen capture whether it is an ANSI apostrophe or a right single quote.



The L before the " indicates that it is a wstring. In Windows computers this is pretty much UTF-16, though Microsoft Windows doesn't quite meet all the UTF-16 standards.



See https://en.cppreference.com/w/cpp/language/string_literal for more information on the various type of string literals.



This microsoft article: https://docs.microsoft.com/en-us/windows/desktop/learnwin32/working-with-strings, explains the difference between the ANSI functions (ending with 'A') and the Unicode functions (ending with 'W').







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 14 '18 at 2:12

























answered Nov 14 '18 at 2:04









rsjaffersjaffe

3,88671631




3,88671631













  • Thanks alot, though that may have been the case, I went into the Spy++ and copied and pasted the window caption, the apostrophe was different than what I put in the HWND. It works now.

    – Tate Greeves
    Nov 14 '18 at 3:03



















  • Thanks alot, though that may have been the case, I went into the Spy++ and copied and pasted the window caption, the apostrophe was different than what I put in the HWND. It works now.

    – Tate Greeves
    Nov 14 '18 at 3:03

















Thanks alot, though that may have been the case, I went into the Spy++ and copied and pasted the window caption, the apostrophe was different than what I put in the HWND. It works now.

– Tate Greeves
Nov 14 '18 at 3:03





Thanks alot, though that may have been the case, I went into the Spy++ and copied and pasted the window caption, the apostrophe was different than what I put in the HWND. It works now.

– Tate Greeves
Nov 14 '18 at 3:03


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292124%2fcant-find-window-in-c%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine