Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3711
Number of posts: 9173

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
The List Control crash my Dialog box... (VC++6, no MFC) Posted by Psyko on 31 Oct 2002 at 2:26 PM
Hello

I made a new project with a working Dialog Box. If I add a List Control on it, then it crash. I also tryed adding a List Control on an older project, and it worked. So, I tryed to copy/paste some code from the old one to the current one, but it still does not work. I also tryed to copy the configuration: no result...

Is there something I forgot to do ?
Report
Re: The List Control crash my Dialog box... (VC++6, no MFC) Posted by AsmGuru62 on 1 Nov 2002 at 7:32 AM
: Hello
:
: I made a new project with a working Dialog Box. If I add a List Control on it, then it crash. I also tryed adding a List Control on an older project, and it worked. So, I tryed to copy/paste some code from the old one to the current one, but it still does not work. I also tryed to copy the configuration: no result...
:
: Is there something I forgot to do ?
:
You forgot to post some code how you are adding this mysterious list box... to see the dlg.cpp will be nice...
Report
Re: The List Control crash my Dialog box... (VC++6, no MFC) Posted by Psyko on 1 Nov 2002 at 9:10 AM
This message was edited by Psyko at 2002-11-1 9:15:43

It is not a Listbox, it is a List Control. Also knows as List View, if you prefer.

So, I make a simple Dialog in the ressource editor, there is only one button, and one List Control.

Here is the code.


#include <windows.h>
#include "resource.h"

LRESULT CALLBACK MainProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_CLOSE:
EndDialog(hWnd,0);
return TRUE;
default:
return FALSE;
}

case WM_CLOSE:
EndDialog(hWnd,0);
return TRUE;

default:
return FALSE;
}
}

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
DialogBox(hInstance,(LPCTSTR)IDD_MAIN,NULL,(DLGPROC)MainProc);
return 0;
}


If I run my program, it instantly closes. However, if I remove the List Control from the dialog, it does run.






Report
Re: The List Control crash my Dialog box... (VC++6, no MFC) Posted by pingpong on 1 Nov 2002 at 10:11 AM
Add a call to InitCommonControlsEx at the start of your program.

: This message was edited by Psyko at 2002-11-1 9:15:43

: It is not a Listbox, it is a List Control. Also knows as List View, if you prefer.
:
: So, I make a simple Dialog in the ressource editor, there is only one button, and one List Control.
:
: Here is the code.
:
:
: #include <windows.h>
: #include "resource.h"
:
: LRESULT CALLBACK MainProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
: {
: switch(Msg)
: {
: case WM_COMMAND:
: switch(LOWORD(wParam))
: {
: case IDC_CLOSE:
: EndDialog(hWnd,0);
: return TRUE;
: default:
: return FALSE;
: }
:
: case WM_CLOSE:
: EndDialog(hWnd,0);
: return TRUE;
:
: default:
: return FALSE;
: }
: }
:
: int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
: {
: DialogBox(hInstance,(LPCTSTR)IDD_MAIN,NULL,(DLGPROC)MainProc);
: return 0;
: }
:
:
: If I run my program, it instantly closes. However, if I remove the List Control from the dialog, it does run.
:
:
:
:
:
:
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.