<html><div style='background-color:'><DIV class=RTE>
<P><BR><BR></P></DIV>
<DIV></DIV>>From: "Noorez Kassam" <COO...@HO...>
<DIV></DIV>>To: dev...@li...
<DIV></DIV>>Subject: [Dev-C++] WinAPP
<DIV></DIV>>Date: Wed, 24 Dec 2003 14:11:53 -0700
<DIV></DIV>
<P>>MIME-Version: 1.0 </P>
<P> </P>
<DIV></DIV><mailto:dev...@li...?subject=unsubscribe><mailto:dev...@li...><mailto:dev...@li...?subject=help><mailto:dev...@li...?subject=subscribe>
<DIV></DIV>>My windows APP is closing before i see any results! It complies fine
<DIV></DIV>>but it just closes
<DIV></DIV>>
<DIV></DIV>
<DIV></DIV>> WNDCLASSEX wndClass;
<DIV></DIV>>
<DIV></DIV>> //register class
<DIV></DIV>> wndClass.style = 0;
<DIV></DIV>> wndClass.lpfnWndProc = WindowProc;
<DIV></DIV>> wndClass. cbClsExtra = 0;
<DIV></DIV>> wndClass.hInstance = hInstance;
<DIV></DIV>> wndClass.hIcon = LoadIcon( hInstance, szAppName);
<DIV></DIV>> wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
<DIV></DIV>> wndClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
<DIV></DIV>> wndClass.lpszMenuName = NULL;
<DIV></DIV>> wndClass.lpszClassName = szAppName;
<DIV></DIV>> wndClass.hIconSm = wndClass.hIcon;
<DIV></DIV>>
<DIV></DIV>
<DIV></DIV>
<P>Hmm, do you have a resource file that actually has the specified icon? But anyways, the reason your app fails is because RegisterClassEx returns 0. The reason for this prolly were: cbWndExtra was not initialized, and more importantly: cbSize was not initialized/set to the size of the WNDCLASSEX structure. </P>
<P>I changed your code to this:</P>
<P>WNDCLASSEX wndClass = {0}; </P>
<P>//register class <BR>wndClass.style = CS_OWNDC; // A habit I picked up from OpenGL<BR>wndClass.lpfnWndProc = WindowProc; </P>
<P>wndClass.hInstance = hInstance; <BR>wndClass.hIcon = LoadIcon( NULL, IDI_WINLOGO); //A standard windows icon<BR>wndClass.hCursor = LoadCursor(NULL, IDC_ARROW); <BR>wndClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND; <BR>wndClass.lpszMenuName = NULL; <BR>wndClass.lpszClassName = szAppName; <BR>wndClass.hIconSm = wndClass.hIcon; <BR>wndClass.cbSize = sizeof(WNDCLASSEX); //Important field</P>
<P>and it worked ;).</P>
<P>>_________________________________________________________________ </P>
<DIV></DIV>>MSN 8 with e-mail virus protection service: 2 months FREE*
<DIV></DIV>>http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>-------------------------------------------------------
<DIV></DIV>>This SF.net email is sponsored by: IBM Linux Tutorials.
<DIV></DIV>>Become an expert in LINUX or just sharpen your skills. Sign up for
<DIV></DIV>>IBM's
<DIV></DIV>>Free Linux Tutorials. Learn everything from the bash shell to sys
<DIV></DIV>>admin.
<DIV></DIV>>Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
<DIV></DIV>>_______________________________________________
<DIV></DIV>>Dev-cpp-users mailing list
<DIV></DIV>>Dev...@li...
<DIV></DIV>>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
<DIV></DIV>>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
<DIV></DIV></mailto:dev...@li...?subject=subscribe></mailto:dev...@li...?subject=help></mailto:dev...@li...></mailto:dev...@li...?subject=unsubscribe></div><br clear=all><hr>MSN 8 helps <a href="http://g.msn.com/8HMAEN/2752??PS=">ELIMINATE E-MAIL VIRUSES.</a> Get 2 months FREE*.</html>
|