Register
Handmade Hero»Forums»Code»MSDN Windows Api syntax changes
Peter Pop
1 posts
MSDN Windows Api syntax changes
5 months, 2 weeks ago Edited by Peter Pop on May 10, 2019, 7:50 a.m. Reason: Initial post
Hi

Does anyone know what happened to the MSDN documentation?

This really doesn't explain anything about the issue I have.

If I search for WinMain, today MSDN (or rather Windows Dev Center) shows:
1
2
3
4
5
6
int __clrcall WinMain(
  HINSTANCE hInstance,
  HINSTANCE hPrevInstance,
  LPSTR     lpCmdLine,
  int       nShowCmd
);


In the past it was:
1
2
3
4
5
6
int CALLBACK WinMain(
  _In_  HINSTANCE hInstance,
  _In_  HINSTANCE hPrevInstance,
  _In_  LPSTR lpCmdLine,
  _In_  int nCmdShow
);


This is prevalent in the whole documentation.

Compiling with __clrcall gave me an error (I can't remember which, and it doesn't matter) so I changed it to CALLBACK. But I shouldn't have to remember this. The documentation should just be correct.

It was also nice that you could see the direction of the parameters.

What am I missing?
Simon Anciaux
675 posts
MSDN Windows Api syntax changes
5 months, 2 weeks ago Edited by Simon Anciaux on May 10, 2019, 4:14 p.m. Reason: typo
On WinMain I believe it's WINAPI or APIENTRY, not CALLBACK, but they all are defined as __stdcall. CALLBACK is on WinProc. WinProc documentation still uses the older style which I like better.

The doc for __crlcall as some information in paragraph 3:
Entry points are separate, compiler-generated functions. If a function has both native and managed entry points, one of them will be the actual function with the function implementation. The other function will be a separate function (a thunk) that calls into the actual function and lets the common language runtime perform PInvoke. When marking a function as __clrcall, you indicate the function implementation must be MSIL and that the native entry point function will not be generated.


I never used clr and __clrcall so I can't help you more. But you can drop the calling convention if you compile for 64 bits. Putting __clrcall on WinMain seems to be to encourage people to use managed code instead of native (maybe, I don't know).

That said in my opinion Microsoft documentation is getting worse. I've seen several times a TODO or TBD note in the descriptions and the presentation of arguments and their descriptions seem less visually clear to me.
Mārtiņš Možeiko
1979 posts / 1 project
MSDN Windows Api syntax changes
5 months, 2 weeks ago
__clrcall is for C++/CLI. It is completely irrelevant for native C and C++ code. They messed up something in documentation.

For last two or so years they are slowly migrating documentation from somewhere to elsewhere. And during this migration I have seen a lot of things are breaking. Either defines are wrong, or missing function argument names, or missing argument descriptions.. Complete shit-show.

I suggest download MSDN documentation for using it offline. Good option to do this is to use Zeal with MSDN docs from here.
Philip Ludington
14 posts / 1 project
(tbd)
MSDN Windows Api syntax changes
3 months, 3 weeks ago
The https://www.rotemy.com/dash/ link doesn't seem to work anymore. I did find this http://laurencejackson.com/win32/ So, there might be a way to convert the chm file to something zeal can use?
Philip Ludington
14 posts / 1 project
(tbd)
MSDN Windows Api syntax changes
3 months, 3 weeks ago
The https://www.rotemy.com/dash/ link doesn't seem to work anymore. I did find this http://laurencejackson.com/win32/ So, there might be a way to convert the chm file to something zeal can use?
Miguel Lechón
73 posts
MSDN Windows Api syntax changes
2 months, 2 weeks ago
MrPhil
The https://www.rotemy.com/dash/ link doesn't seem to work anymore.


I asked @vmalloc and he fixed the download link.
2 posts
MSDN Windows Api syntax changes
1 week, 1 day ago
It stinks that MS don't have ALL the old versions of their dev tools. After all, programs originally written in Visual Studio 2008 like Ryan was using in the videos will still run today on win 10, so obviously one could still use it to compile things now. All MS do with this constant churn is make development needlessly difficult and sell MSDN subscriptions and training courses, and give everyone extra work to do. And basically they have just made it harder for ppl to follow what Ryan spent years creating. Rotters!

That said, there is a reasonable bare-bones single-file windows "hello world" program walkthrough at:

https://docs.microsoft.com/en-us/...top-applications-cpp?view=vs-2019

Ignore all the code sections except the one at the end, as they are just non-running explanations which won't compile. The one at the end of the article is the real thing. It is a bit more complex than Ryan's code, but it is ok, and vastly preferable to the stuff created by the 2019 C++ project wizard.

I tried it in the community 2019 VS and it compiled and ran OK.
Mārtiņš Možeiko
1979 posts / 1 project
MSDN Windows Api syntax changes
1 week, 1 day ago
Who is Ryan?
19 posts
MSDN Windows Api syntax changes
1 week ago
Probably Fleury.
Ryan Fleury
176 posts / 1 project

Handmade Network lead and developer of The Melodist

MSDN Windows Api syntax changes
1 week ago
I'm afraid I'm being mixed up with someone else!

Handmade Network lead and developer of The Melodist
2 posts
MSDN Windows Api syntax changes
1 week ago Edited by Loldemort on Oct. 16, 2019, 7:25 a.m.
Oops I wrongly assumed that was the guy in the first video. That's what happens when you post before you've watched the first 100 vids I suppose. [Sigh, debugging already!]