Click here to Skip to main content
15,899,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralNevermind... Pin
Nitron29-Oct-03 8:55
Nitron29-Oct-03 8:55 
GeneralRe: Nevermind... Pin
winalice29-Oct-03 9:37
winalice29-Oct-03 9:37 
GeneralRe: Nevermind... Pin
Nitron29-Oct-03 9:39
Nitron29-Oct-03 9:39 
GeneralRe: Control window sizing... Pin
winalice29-Oct-03 9:36
winalice29-Oct-03 9:36 
GeneralRe: Control window sizing... Pin
David Crow29-Oct-03 10:19
David Crow29-Oct-03 10:19 
QuestionMerging menus? Pin
Dominik Reichl29-Oct-03 8:22
Dominik Reichl29-Oct-03 8:22 
AnswerRe: Merging menus? Pin
igor196029-Oct-03 10:45
igor196029-Oct-03 10:45 
GeneralCreateWindowEx is stupid and nonsensical Pin
super_matt29-Oct-03 7:56
super_matt29-Oct-03 7:56 
Hello, i am having some trouble writing a simple wrapper (in c++) for c windowing code, i have been trying to sort it out for a while and have figured out the class members as callbacks using setWindowLong and all that , but my main proble lies in CreateWindowEx, i have my code set up for error checking and creation of a WNDCLASSEX object goes fine and RegisterClassEx goes fine but when i call CreateWindowEx, it returns the error code 0, which means ERROR_SUCCESS, my createWindowEx call looks like this:

m_hWnd is an HWND that is set to NULL until this call,
m_hInstance is set with GetModuleHandle(NULL)
emsg is just a file for collecting error messages
m_StrTitle is a string containing my window/class name (it isn't NULL)

if (!(m_hWnd=CreateWindowEx(dwExStyle, m_StrTitle,
m_StrTitle, dwStyle |
WS_CLIPSIBLINGS |
WS_CLIPCHILDREN,
0, 0, WindowRect.right-WindowRect.left, WindowRect.bottom-WindowRect.top,
NULL, NULL, m_hInstance, this)))
{
emsg << "create glWindow: " << GetLastError();
emsg.close();
this->KillGLWindow();
MessageBox(NULL,"Window Creation Error","ERROR",MB_OK|MB_ICONEXCLAMATION);
return false;
}

my WNDCLASSEX creation looks like this:

WndProc is a static class member

WNDCLASSEX l_wc =
{ sizeof(WNDCLASSEX),
CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW | CS_OWNDC,
(WNDPROC) WndProc,
0,
0,
m_hInstance,
LoadIcon(NULL, IDI_WINLOGO),
LoadCursor(NULL, IDC_ARROW),
NULL,
NULL,
m_StrTitle,
LoadIcon(NULL, IDI_WINLOGO),
};

once again the error code returned with GetLastError() after my call to CreateWindowEx returns zero which enumerates to ERROR_SUCCESS and i really don't know what to do, i have spent a lot of time building this code, any help would be very much appreciated, thank you in advance
-Matthew
GeneralRe: CreateWindowEx is stupid and nonsensical Pin
alex.barylski29-Oct-03 10:03
alex.barylski29-Oct-03 10:03 
GeneralRe: CreateWindowEx is stupid and nonsensical Pin
super_matt29-Oct-03 11:17
super_matt29-Oct-03 11:17 
GeneralRe: CreateWindowEx is stupid and nonsensical Pin
Steve S29-Oct-03 22:43
Steve S29-Oct-03 22:43 
GeneralRe: CreateWindowEx is stupid and nonsensical Pin
David Crow30-Oct-03 2:18
David Crow30-Oct-03 2:18 
GeneralRe: CreateWindowEx is stupid and nonsensical Pin
Steve S30-Oct-03 4:49
Steve S30-Oct-03 4:49 
GeneralRe: CreateWindowEx is stupid and nonsensical Pin
David Crow30-Oct-03 2:20
David Crow30-Oct-03 2:20 
GeneralRe: CreateWindowEx is stupid and nonsensical Pin
super_matt30-Oct-03 7:50
super_matt30-Oct-03 7:50 
GeneralHelp - COM Ports Pin
raheela29-Oct-03 7:12
raheela29-Oct-03 7:12 
GeneralRe: Help - COM Ports Pin
David Crow29-Oct-03 7:26
David Crow29-Oct-03 7:26 
GeneralVisual C++.net Removing Member Variable Pin
mfcuser29-Oct-03 6:48
mfcuser29-Oct-03 6:48 
GeneralRe: Visual C++.net Removing Member Variable Pin
Peter Molnar29-Oct-03 13:53
Peter Molnar29-Oct-03 13:53 
Questionhow to get a list of ALL the truetype fonts Pin
JP GOBLET29-Oct-03 6:43
JP GOBLET29-Oct-03 6:43 
AnswerRe: how to get a list of ALL the truetype fonts Pin
David Crow29-Oct-03 7:21
David Crow29-Oct-03 7:21 
GeneralRe: how to get a list of ALL the truetype fonts Pin
JP GOBLET29-Oct-03 21:29
JP GOBLET29-Oct-03 21:29 
GeneralCHtmlView Pin
includeh1029-Oct-03 6:36
includeh1029-Oct-03 6:36 
GeneralRe: CHtmlView Pin
Peter Molnar29-Oct-03 13:32
Peter Molnar29-Oct-03 13:32 
GeneralCTime causes exceptions Pin
Daniel132429-Oct-03 6:35
Daniel132429-Oct-03 6:35 

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.