Click here to Skip to main content
16,017,151 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRegisterClassEx and CreateWindowEx fails.. Pin
gothic_coder12-Nov-08 2:35
gothic_coder12-Nov-08 2:35 
AnswerRe: RegisterClassEx and CreateWindowEx fails.. Pin
CPallini12-Nov-08 2:47
mveCPallini12-Nov-08 2:47 
GeneralRe: RegisterClassEx and CreateWindowEx fails.. Pin
gothic_coder12-Nov-08 3:10
gothic_coder12-Nov-08 3:10 
AnswerRe: RegisterClassEx and CreateWindowEx fails.. Pin
Randor 12-Nov-08 2:59
professional Randor 12-Nov-08 2:59 
QuestionRe: RegisterClassEx and CreateWindowEx fails.. Pin
David Crow12-Nov-08 3:00
David Crow12-Nov-08 3:00 
AnswerRe: RegisterClassEx and CreateWindowEx fails.. Pin
enhzflep12-Nov-08 3:01
enhzflep12-Nov-08 3:01 
GeneralRe: RegisterClassEx and CreateWindowEx fails.. Pin
gothic_coder12-Nov-08 3:18
gothic_coder12-Nov-08 3:18 
GeneralRe: RegisterClassEx and CreateWindowEx fails.. Pin
enhzflep12-Nov-08 3:36
enhzflep12-Nov-08 3:36 
Here, try this:

#define _WIN32_WINNT 0x0601
#include <windows.h>

LRESULT CALLBACK WndProc(

    HWND hwnd,	// handle of window
    UINT uMsg,	// message identifier
    WPARAM wParam,	// first message parameter
    LPARAM lParam 	// second message parameter
   );

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASSEX   wndclass ;


     wndclass.style         = CS_HREDRAW | CS_VREDRAW;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbSize = sizeof (WNDCLASSEX);
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0 ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIconSm = wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) CreateSolidBrush(RGB(255,255,255));
     wndclass.lpszMenuName  = NULL ;
     wndclass.lpszClassName = "myWndClassName";

     if (!RegisterClassEx (&wndclass))
     {
          DWORD eRR = GetLastError();
          MessageBox (NULL, "Registration Fails","Error", MB_ICONERROR) ;
          return 0 ;
     }


     hwnd = CreateWindowEx(
        WS_EX_TOOLWINDOW | WS_EX_APPWINDOW,
        "myWndClassName",
        0,
        WS_POPUP,
        10,
	    10,
	   100,
	   100,
        HWND_DESKTOP,
	   NULL,
	   hInstance,
	   NULL) ;

     if (hwnd == NULL)
     {
          DWORD eRR = GetLastError();
          MessageBox (NULL, "Window Creation Fails","Error", MB_ICONERROR) ;
          return 0 ;
     }

     DWORD eRR1 = GetLastError();

     ShowWindow (hwnd, iCmdShow) ;
  //   SetLayeredWindowAttributes(hwnd, RGB(255,255,255), 255, LWA_COLORKEY|LWA_ALPHA);

     while (GetMessage (&msg, NULL, 0, 0))
     {
          TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
     }
     return msg.wParam ;
}

LRESULT CALLBACK WndProc(

    HWND hwnd,	// handle of window
    UINT uMsg,	// message identifier
    WPARAM wParam,	// first message parameter
    LPARAM lParam 	// second message parameter
   )
{
    return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

GeneralRe: RegisterClassEx and CreateWindowEx fails.. Pin
gothic_coder12-Nov-08 3:43
gothic_coder12-Nov-08 3:43 
GeneralRe: RegisterClassEx and CreateWindowEx fails.. Pin
enhzflep12-Nov-08 3:50
enhzflep12-Nov-08 3:50 
GeneralRe: RegisterClassEx and CreateWindowEx fails.. Pin
gothic_coder12-Nov-08 19:10
gothic_coder12-Nov-08 19:10 
QuestionCoCreateInstance Problem Pin
john563212-Nov-08 2:10
john563212-Nov-08 2:10 
AnswerRe: CoCreateInstance Problem Pin
CPallini12-Nov-08 2:27
mveCPallini12-Nov-08 2:27 
AnswerRe: CoCreateInstance Problem Pin
Roger Stoltz12-Nov-08 2:32
Roger Stoltz12-Nov-08 2:32 
GeneralRe: CoCreateInstance Problem Pin
john563212-Nov-08 6:04
john563212-Nov-08 6:04 
AnswerRe: CoCreateInstance Problem Pin
Roger Stoltz12-Nov-08 6:29
Roger Stoltz12-Nov-08 6:29 
GeneralRe: CoCreateInstance Problem Pin
john563213-Nov-08 17:42
john563213-Nov-08 17:42 
AnswerRe: CoCreateInstance Problem Pin
Roger Stoltz13-Nov-08 22:34
Roger Stoltz13-Nov-08 22:34 
QuestionStrange Issue Pin
Sameer Naik12-Nov-08 2:02
Sameer Naik12-Nov-08 2:02 
AnswerRe: Strange Issue Pin
CPallini12-Nov-08 2:21
mveCPallini12-Nov-08 2:21 
QuestionExe problem in different machine Pin
NewVC++12-Nov-08 1:12
NewVC++12-Nov-08 1:12 
QuestionRe: Exe problem in different machine Pin
Rajesh R Subramanian12-Nov-08 1:42
professionalRajesh R Subramanian12-Nov-08 1:42 
JokeRe: Exe problem in different machine Pin
CPallini12-Nov-08 1:45
mveCPallini12-Nov-08 1:45 
AnswerRe: Exe problem in different machine Pin
NewVC++12-Nov-08 1:46
NewVC++12-Nov-08 1:46 
GeneralRe: Exe problem in different machine Pin
Rajesh R Subramanian12-Nov-08 1:56
professionalRajesh R Subramanian12-Nov-08 1:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.