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

C / C++ / MFC

 
GeneralRe: vc6 to vc8 conversion Pin
Russell'13-Nov-08 7:54
Russell'13-Nov-08 7:54 
GeneralRe: vc6 to vc8 conversion Pin
Mark Salsbery13-Nov-08 8:31
Mark Salsbery13-Nov-08 8:31 
AnswerRe: vc6 to vc8 conversion Pin
Joe Woodbury12-Nov-08 11:47
professionalJoe Woodbury12-Nov-08 11:47 
GeneralRe: vc6 to vc8 conversion Pin
Russell'12-Nov-08 22:20
Russell'12-Nov-08 22:20 
QuestionThe WM_DEVICECHANGE question Pin
josip cagalj12-Nov-08 3:28
josip cagalj12-Nov-08 3:28 
AnswerRe: The WM_DEVICECHANGE question Pin
Roger Stoltz12-Nov-08 3:58
Roger Stoltz12-Nov-08 3:58 
AnswerRe: The WM_DEVICECHANGE question Pin
Iain Clarke, Warrior Programmer12-Nov-08 12:09
Iain Clarke, Warrior Programmer12-Nov-08 12:09 
QuestionRegisterClassEx and CreateWindowEx fails.. Pin
gothic_coder12-Nov-08 2:35
gothic_coder12-Nov-08 2:35 
Hello all..
I'm trying to make window with specific requirement.. But that's not my issue. It's related to RegisterClassEx and CreateWindowEx.. Both actually fails.. I've no idea why.. I put GetLastError on both.

After RegisterClassEx it shows Error 6 which means "The handle is invalid."

After CreateWindowEx it shows Error 203 which means "The system could not find the environment option that was entered."

Here's code snippet.. Please take a look.

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.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0 ;
     wndclass.hInstance     = hInstance ;
     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 = "WndProc";
     
     DWORD eRR = GetLastError();

     if (!RegisterClassEx (&wndclass))
     {
          MessageBox (NULL, "Registration Fails","Error", MB_ICONERROR) ;
          return 0 ;
     }
     
     hwnd = CreateWindowEx(WS_EX_TOOLWINDOW |WS_EX_LAYERED|  WS_EX_APPWINDOW,
                          "WndProc",
			   NULL,			
			   WS_POPUP,		
            10,								
	    10,								
	   100,								
	   100,								
            NULL,							
	   NULL,							
	   hInstance,
	   NULL) ;							


     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 ;
}



It also doesn't get into message loop..

Thanks..
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 
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 

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.