Thread: Stolen class doesn't like it...

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Stolen class doesn't like it...

    It doesn't make sence to me, maybe I am over-looking somthing, why doesn't this work?

    Code:
    #include <windows.h>
    #include <gwc.h>	 // My extra's include, also contains text();
    int WINAPI WinMain (HINSTANCE hThisInstance,
    					HINSTANCE hPrevInstance,
    					LPSTR lpszArgument,
    					int nFunsterStil)
    {
    	HWND hwnd;			   /* This is the handle for our window */
    	MSG messages;			/* Here messages to the application are saved */
    	WNDCLASSEX wincl;		/* Data structure for the windowclass */
    	
    	if (GetClassInfoEx(NULL,"IEFrame",&wincl) == 0)
    	{
    	  text("Cannot GET REG!");
    	  return 0;
    	}
    	
    	/* Register the window class, and if it fails quit the program */
    	if (!RegisterClassEx (&wincl))
    	{
    	  text("Cannot REG!");
    	  return 0;
    	}
    	
    	int winX = 544;
    	int winY = 375;
    	/* The class is registered, let's create the program*/
    	hwnd = CreateWindowEx (
    		   0,				   /* Extended possibilites for variation */
    		   "IEFrame",		 /* Classname */
    		   "Windows Application",	   /* Title Text */
    		   WS_OVERLAPPEDWINDOW&~WS_THICKFRAME&~WS_MAXIMIZEBOX,
    		   GetSystemMetrics(SM_CXSCREEN)/2-winX/2,
    		   GetSystemMetrics(SM_CYSCREEN)/2-winY/2,
    		   winX,				 /* The programs width */
    		   winY,				 /* and height in pixels */
    		   HWND_DESKTOP,		/* The window is a child-window to desktop */
    		   NULL,				/* No menu */
    		   wincl.hInstance,	   /* Program Instance handler */
    		   NULL				 /* No Window Creation data */
    		   );
    	/* Make the window visible on the screen */
    	ShowWindow (hwnd, nFunsterStil);
    	/* Run the message loop. It will run until GetMessage() returns 0 */
    	while (GetMessage (&messages, NULL, 0, 0))
    	{
    		/* Translate virtual-key messages into character messages */
    		TranslateMessage(&messages);
    		/* Send message to WindowProcedure */
    		DispatchMessage(&messages);
    	}
    	/* The program return-value is 0 - The value that PostQuitMessage() gave */
    	return messages.wParam;
    }
    Thanks for any help, August.

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Erm, what are you trying to achieve here?
    It appears that you're trying to "mimic" Internet Explorer's IEFrame in your program (even though there is a web browser control available that would achieve the same thing bar cosmetic differences).

    Something for you to dwell on:- is the address specified in wincl.lpfnWndProc valid in your program's address space?

    A clue to the answer: when Windows loads a program, it provides a "copy" of the system window classes ("BUTTON", "EDIT", etc.) inside the program's address space.

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    >> Something for you to dwell on:- is the address specified in wincl.lpfnWndProc
    >> valid in your program's address space?

    I don't get it.

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    In addition:

    Quote Originally Posted by GetClassInfoEx(..) - MSDN
    hinst

    [in] Handle to the instance of the application that created the class. To retrieve information about classes defined by the system (such as buttons or list boxes), set this parameter to NULL.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  2. Specializing class
    By Elysia in forum C++ Programming
    Replies: 6
    Last Post: 09-28-2008, 04:30 AM
  3. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM