Thread: Obtaining a list of all registered window classes?

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    Obtaining a list of all registered window classes?

    Anyone know if there is a way to enumerate all available window classes that were registered with RegisterClass, RegisterClassEx, or GlobalAddAtom?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: Obtaining a list of all registered window classes?

    Originally posted by Sebastiani
    Anyone know if there is a way to enumerate all available window classes that were registered with RegisterClass, RegisterClassEx, or GlobalAddAtom?
    Code:
    #include <iostream>
    #include <set>
    #include <algorithm>
    #include <windows.h>
    
    typedef std::set<std::string> MYSET;
    const int BUFF_LEN = 255;
    
    BOOL CALLBACK EnumWindowsProc(HWND hWnd,LPARAM lParam){
    
    	MYSET* lpSet = reinterpret_cast<MYSET*>(lParam);
    	static char szClass[BUFF_LEN];
    	
    	if(GetClassName(hWnd,szClass,BUFF_LEN))
    		lpSet->insert(szClass);
    	
    	return TRUE;
    }
    
    
    int main()
    {
    	MYSET setClasses;
    	
    	EnumWindows(EnumWindowsProc,
    		reinterpret_cast<LPARAM>(&setClasses));
    	
    	std::copy(setClasses.begin(),setClasses.end(),
    		std::ostream_iterator<std::string>(std::cout,"\n"));
    
    }

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    I take it then there is.

    Thank you Fordy, I owe you a beer for that one.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    this is kinda off-topic, but if I declare a window class in one module, can I use it in another one?

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by frenchfry164
    this is kinda off-topic, but if I declare a window class in one module, can I use it in another one?
    no

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 10:10 AM
  2. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  3. help! Placement of nodes in a Linked List
    By lostmyshadow in forum C Programming
    Replies: 6
    Last Post: 12-17-2007, 01:21 PM
  4. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM