Skip to content

Update Walkthrough Creating traditional Windows Desktop Apps. #3211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2021
Merged

Update Walkthrough Creating traditional Windows Desktop Apps. #3211

merged 2 commits into from
Jul 9, 2021

Conversation

thispsj
Copy link
Contributor

@thispsj thispsj commented Jun 19, 2021

This PR updates this article on ms docs. The code has been updated to use CreateWindowEx.

@ghost
Copy link

ghost commented Jun 19, 2021

CLA assistant check
All CLA requirements met.

@PRMerger17
Copy link
Contributor

@thispsj : Thanks for your contribution! The author(s) have been notified to review your proposed change.

@PRMerger13
Copy link
Contributor

@thispsj : Thanks for your contribution! The author(s) have been notified to review your proposed change.

@thispsj
Copy link
Contributor Author

thispsj commented Jul 6, 2021

@corob-msft any problems with the PR ?

@colin-home
Copy link
Contributor

@thispsj
Thanks for bringing this sample from the late '80s into the early '90s. I've been vacationing and not paying close attention to the repo. Your changes are mostly fine, though I don't see much value in changing the wcex.hIcon load from using the parameter hInstance to using the copy in the struct. In optimized code, the value is enregistered at that point, so it makes no difference, while in debug code it could conceivably cause an extra memory access. (I haven't checked the assembly output to verify.) Did you have a purpose or style guideline in mind for that change?

@thispsj
Copy link
Contributor Author

thispsj commented Jul 9, 2021

@corob-msft Here are the assembly output for both cases in debug mode.
Screenshot (62)
Screenshot (63)

This is one of my small projects which uses WCNDCLASSEX structure to create the window. Here the variable assigned to the structure is wcx and not wcex. That's the only difference in the cpp code.
As you see in the assembly, the mov instruction directly registers the pointer to hInst (the HINSTANCE variable) when directly passed while when wcex.hInstance is used it passes that pointer. Otherwise it's the same.

And one more thing, the sample code is itself using wcex.hInstance to load the small icon. So, to my main purpose was to use the same logic as applicable everywhere because I've seen people asking that why is it different in the same code (i.e. at one place hInst and at the another wcex.hInstance.

And sorry if I've bothered you in the middle of your vacation. I hope you won't mind that and continue enjoying your vacation. Summer is the best time to vacation after all.

Copy link
Contributor

@colin-home colin-home left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, @thispsj - thanks for the update.

@colin-home colin-home merged commit 769b186 into MicrosoftDocs:master Jul 9, 2021
@thispsj thispsj deleted the update branch July 9, 2021 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants