a basic win32 programming problem on adding a control 
Author Message
 a basic win32 programming problem on adding a control

Hi,

    I encounted a problem when I was writing a simple Win32 program and ask
for your help.

    I was using Visual C++ 6.0. I used the AppWizard to create a typical
'Hello World' program.
This program has a menu and when I choose the Help->About item, a About
dialog box will pop up.
But after I added a Listbox control to the dialog box in the Resource editor
and rebuilt it,
then the About dialog box wouldn't emerge any longer however I selected the
Help->About menu item.
But if I added a Static Text control it worked.

    Could you tell me what's wrong and how to solve the problem? Any answer
will be appericated.

    Thanks in advance.

         Best wishes!



Wed, 26 Jun 2002 03:00:00 GMT  
 a basic win32 programming problem on adding a control

Quote:

>Hi,

>    I encounted a problem when I was writing a simple Win32 program and ask
>for your help.

OK

[Snipped bug description]

Quote:
>    Could you tell me what's wrong and how to solve the problem?

Not without some source code being posted.

Jimbo



Wed, 26 Jun 2002 03:00:00 GMT  
 a basic win32 programming problem on adding a control
Quote:
>>    Could you tell me what's wrong and how to solve the problem?
> Not without some source code being posted.

--------
Thank you. The source code is all generated using the Visual C++ 6.0 Win32
AppWizard(generating a simple "Hello world" App). All the modification I
made to it is just adding a ListBox control to the dialog box in the
resource editor. And then the dialog box won't popup any longer.

Thanks in advance.



Thu, 27 Jun 2002 03:00:00 GMT  
 a basic win32 programming problem on adding a control

Quote:

>>>    Could you tell me what's wrong and how to solve the problem?
>> Not without some source code being posted.
>--------
>Thank you. The source code is all generated using the Visual C++ 6.0 Win32
>AppWizard(generating a simple "Hello world" App).

Ahhh, yes.  Re-read the question and you said all that....  Me being
blind again.

Quote:
>All the modification I made to it is just adding a ListBox control
>to the dialog box in the resource editor. And then the dialog
>box won't popup any longer.

Just tried that, and got the about box to pop-up with a blank listbox
vertically below the rest of the controls.

Sorry, but I don't know what's happening.

What VC service packs have you got installed (if that makes a
difference ?)

You could put a breakpoint on the line:

DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);

Below the:
case IDM_ABOUT:

And see if it's getting called.

Even better is to assign a variable to the return value of DialogBox()
to see if the function is failing for some reason.

Also, something else...  Is it a list-box or a list-control ?  (May
seem like a silly question, but you'll need to call
"InitCommonControlsEx()" to use a list control.   This will stop the
dialog box appearing)

Quote:
>Thanks in advance.

HTH

Jim M



Fri, 28 Jun 2002 03:00:00 GMT  
 a basic win32 programming problem on adding a control
Quote:
> Also, something else...  Is it a list-box or a list-control ?  (May
> seem like a silly question, but you'll need to call
> "InitCommonControlsEx()" to use a list control.   This will stop the
> dialog box appearing)

Yes. It is a list control. Thank you. After adding the
InitCommonControlsEx() statement, the About box appeared.

But if I want to add a non-common ActiveX control such as MS NetShow
Control(msdxm.ocx), what should I do in the Win32 program? Should I use some
COM technique? If so, could you please give me some most-basic statement
that I can use to use the COM control?

Thank you very much.

Regards,
Novice



Sat, 29 Jun 2002 03:00:00 GMT  
 a basic win32 programming problem on adding a control

Quote:

>> Also, something else...  Is it a list-box or a list-control ?  (May
>> seem like a silly question, but you'll need to call
>> "InitCommonControlsEx()" to use a list control.   This will stop the
>> dialog box appearing)
>Yes. It is a list control. Thank you. After adding the
>InitCommonControlsEx() statement, the About box appeared.

Smashing.

Quote:
>But if I want to add a non-common ActiveX control such as MS NetShow
>Control(msdxm.ocx), what should I do in the Win32 program?
>Should I use some COM technique ?

Your program has to support COM and instantiate the object and all the
other things.

Quote:
>If so, could you please give me some most-basic statement
>that I can use to use the COM control?

Dunno mate.  I wouldn't know what I'm talking about if I gave you any
hints and tips.

Quote:
>Regards,
>Novice

Jim M



Sat, 29 Jun 2002 03:00:00 GMT  
 a basic win32 programming problem on adding a control
: > Also, something else...  Is it a list-box or a list-control ?  (May
: > seem like a silly question, but you'll need to call
: > "InitCommonControlsEx()" to use a list control.   This will stop the
: > dialog box appearing)
: Yes. It is a list control. Thank you. After adding the
: InitCommonControlsEx() statement, the About box appeared.

: But if I want to add a non-common ActiveX control such as MS NetShow
: Control(msdxm.ocx), what should I do in the Win32 program? Should I use some
: COM technique? If so, could you please give me some most-basic statement
: that I can use to use the COM control?

For this, you need a control container.  It's very hard to implement
such containers for visual controls (or so it seems), so you should
probably use a pre-existing one.  Since you've opted not to use MFC,
your best option may be to use the containment support of ATL 3.0.

--
Any opinions expressed are my own and not necessarily those of Laser-Scan.



Sat, 29 Jun 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Adding OLE Automation to existing Win32 SDK Program

2. : How to add toolbar to win32 program

3. adding controls to dialog - basics required

4. Adding an ActiveX Control to Win32 Application

5. ATL Control in Win32 program

6. Problem adding a control (calender control) to the dialog box in vc 4.2

7. Basic programming problem

8. Problem with basic C++ program ?

9. Problem with Win32 Control in Forms Designer

10. Stand-alone program with added control?

11. Can't Run Program after adding controls to GUI

12. Just your basic Win32 API

 

 
Powered by phpBB® Forum Software