Which part/code of WinMain() calls WndProc()? .. Confused!

This is a discussion on Which part/code of WinMain() calls WndProc()? .. Confused! within the Windows Programming forums, part of the Platform Specific Boards category; Being looking at the WinMain() function examples but can't find where Windows Procedure WndProc() is called... How does WndProc() receives ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    610

    Which part/code of WinMain() calls WndProc()? .. Confused!

    Being looking at the WinMain() function examples but can't find where Windows Procedure WndProc() is called... How does WndProc() receives the handle hwnd declared in WinMain()?

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Look at the initialization of the WNDCLASS(EX) structure. lpfnWndProc is assigned the address of WndProc. That's how Windows knows about the function.

    Windows then calls WndProc whenever it has a message. This can be from many places - in a standard example, there's six API calls that might call WndProc: CreateWindow, ShowWindow, UpdateWindow, TranslateMessage, DispatchMessage and DestroyWindow.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by CornedBee View Post
    Look at the initialization of the WNDCLASS(EX) structure. lpfnWndProc is assigned the address of WndProc. That's how Windows knows about the function.

    Windows then calls WndProc whenever it has a message. This can be from many places - in a standard example, there's six API calls that might call WndProc: CreateWindow, ShowWindow, UpdateWindow, TranslateMessage, DispatchMessage and DestroyWindow.
    Hey CornedBee thanx... Question, my development tool doesn't recognize the functions you mention. Do you know the header file for these functions and where i can get't?

    Oh! was wondering if things do work like that... I mean if a development tool doesn't have a header file by default, can one easily add extra header files and use the functions with ease?

    Thanks a lot

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    They're all in <windows.h>.

    You can add libraries, but just adding header files often doesn't work. For example, if you don't have windows.h, you need to install the Microsoft Platform SDK (you can get it at their website).
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by CornedBee View Post
    They're all in <windows.h>.

    You can add libraries, but just adding header files often doesn't work. For example, if you don't have windows.h, you need to install the Microsoft Platform SDK (you can get it at their website).
    Last question, does SDK install header files in a specific folder where i can copy from. I run a tool called QUEST (Computer Based Training tool) which has it's own includes/header file folder. How will this integrate with MS Platform SDK? Or perhaps my question should be is MS Platform SDK compatible with any development tool which uses C/C++?

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    You don't copy headers. You reference the folder they're in. And if QUEST doesn't let you do that, chances are it won't take kindly to you using low-level WinAPI functions either.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 07-05-2010, 10:43 AM
  2. my wndProc is out of scope
    By Raison in forum Windows Programming
    Replies: 35
    Last Post: 06-25-2004, 07:23 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21