Hi all!
Can anyone tell me where can I find a source that will help me learn visual c++ win32, without com and mfc, just pure basic, visual c++?
I already programmed different programs, but I am having trouble, when I try to add more windows to my program, I don't know how to manage it!
I created more winprocs, but the new windows I created wouldn't register.
so if anyone knows how to help me or where I can find help I would appreciate it very much!!!
Gabs.

Dani AI

Generated

Good suggestions from and — tutorials and Petzold are great for concepts. For the specific symptom "I created more winprocs, but the new windows I created wouldn't register", the problem is usually one of these practical issues: wrong or missing WNDCLASSEX fields, using the wrong HINSTANCE, Unicode/ANSI string mismatches, or not checking return values. Verify these first and you will find the bug quickly.

Common checklist

  • Make sure wc.cbSize = sizeof(WNDCLASSEX) and wc.lpfnWndProc is set to a valid LRESULT CALLBACK function. See the WNDCLASSEX docs.
  • Call RegisterClassEx and check its return; if it fails call GetLastError to see why. See RegisterClassEx.
  • Use the same hInstance for RegisterClassEx and CreateWindowEx. If you register a class with one instance and create a window with another (common with DLLs) it can fail.
  • Be careful with class names and Unicode: use TEXT("MyClass") or wide strings to match your build.
  • You do not need separate WndProcs for each window. Register a class once and create many windows from it; store per-window state with SetWindowLongPtr(hWnd, GWLP_USERDATA, ...) and forward messages in your single WndProc. See Window procedures.

Minimal pattern (register, then create; check failures) will expose the issue quickly. If the class already exists with different attributes, RegisterClassEx will fail — either use a new class name or unregister the old class before re-registering.

Recommended Answers

All 2 Replies

Here is a very good introduction to win32 api programming. Its only a brief introduction to get you started.

Study windows proramming book by charles petzold .. It will help in clarifying most of ypur doubts

commented: It appears that the OP got a sufficient answer a year ago. Let sleeping threads lie. -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.