Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Measurement Studio Controls and Dialogs

I am running a dialog based project in VC6.0 and am trying to popup other modeless child dialogs to give me info on test ranges and setup information. I really want them to be modeless so that I can run the main test panel with the test ranges visable throughout if so desired.

I thought I was done but realized that the static control that comes with VC6.0 Standard only takes 256 characters. I suppose I could use a bunch of static controls but that looks dumb.

Edit boxes don't work well for me because they don't like tabs and newlines. I tried the rich text box control but when I put one on any dialog, even my main one, the whole dialog never displays. (Question for Microsoft I suppose.)

So, I started looking through the ActiveX controls and found a great plug in called Microsoft Forms 2.0 TextBox. I dropped in that control and made a nice setup box and range box for my two dialogs.

Well, here is the problem then. When I have a "Microsoft Forms 2.0 TextBox" control on my dialog I can't display my dialog as modeless. If I try to display it as modal with .DoModal everything works fine. I see that my problem is when I try to create the modeless dialog with the following command inside the Constructor for the dialog class:

error = this->Create(IDD_DIALOG, NULL);

All Microsoft tells me is that if the dialog is created and initialized without errors then error should be non zero. Well, it's zero if there is any NI control on the dialog. Consequently the dialog doesn't get displayed.

I wish that there was a nice TextBox control like in CVI. Just something you can edit straight from the dialog and it'll load itself just fine when you run it. Microsoft's standard static control is lame and the edit boxes don't let you type in the edit box from the dialog editor screen. So much for visual control. Anyway, I need some suggestions. I don't want to have the overhead of doing any SDI or MDI if I don't have to. I only do small projects and seperate Dialog projects work great.

Maybe I'm not doing something correctly with Visual C++ itself as far as creating modless dialogs are concerned, but the fact that all controls can be displayed as modal but only non-NI controls can be displayed modelessly seems strange. Maybe it's an ActiveX thing and since the NI-controls are the only ActiveX stuff I'm using I get into trouble. I'd appreciate some advice. Thanks,

Grant Johnson
Grant M. Johnson
Project Engineer
LECO Corporation
0 Kudos
Message 1 of 4
(3,424 Views)
I'm not really sure what could be causing the problem that you are seeing, but I have attached a small Meas. Studio for VC++ 6.0 example program to this post that creates an application similar to what you have described. The example has one dialog that creates another modeless dialog when a button is clicked using the CDialog::Create function. With this example the problem you are describing doesn't show up (the second dialog has CNi controls on it and it displays fine as a modeless dialog).

I have also tried running a modified version of the attached example that creates the second dialog as modeless from within its constructor, and it worked fine again. I believe this is exactly what you were asking about.

If you can discern anything from this
example program, or modify it to be more similar with your scenario (create modeless dialog from constructor), then you can let us know what might be different.

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
Message 2 of 4
(3,424 Views)
Thanks Jason. I was just about to take my posting off since I figured out a way to do this. Thanks for the example code, I'm going to try it out.

Right now I think my problem was when I added another control to the dialog class it wrapped another version of msctext.h and called it msctext1.h. I see this happen quite a bit when working with ActiveX controls. Anyway, I removed the references to mscdex1.h from my project and removed the files mscdex1.cpp and mscdex1.h from my project. Then I added mscdex.h and .cpp back into my project. Then I would get "class mscdex declared more then once" so I added #pragma once to the mscdex.h file and it works good. I think before I was hoping to declare mscdex.h only once in my main dialog header fi
le so I deleted the mscdex.h from my child dialog header files. Also, I was getting into trouble with global declarations of the dialogs.

Basically I think a whole bunch of bad coding practices ganged up on me. Thanks for taking a look at this and getting back to me.

Grant
Grant M. Johnson
Project Engineer
LECO Corporation
0 Kudos
Message 3 of 4
(3,424 Views)
Hey Jason. I tried your code out and it works great. I learned a lot from it about other things as well. Sure appreciate the support.

Grant
Grant M. Johnson
Project Engineer
LECO Corporation
0 Kudos
Message 4 of 4
(3,424 Views)