Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2003, 07:36 AM
Authorized User
 
Join Date: Jun 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't access dialog members in .NET

Hi all,
I can't tell you how much this is really p***ing me off. I am new to .NET, using c++ i'm creating a dialog box with a slider control in it. However I can't find out how to set the values for the slider. There is no option in the tool box area, adding a class to the dialog does nothing, no files are ever created. Although the IDC_SLIDER1 is available through the resource file I cannot access its :: functions. Does any one know how to get over this hurdle. I hope its a simple solution because I'm at my wits end. Any help at all would be much appreciated.
Cheers
DRB2k2
 
Old September 12th, 2003, 02:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Right click on the Slider control in your dialog
box and select Add Variable. name the variable and click finish. this is a CSliderCtrl type
variable thats added to your dialog class as a
member variable.

Access any method you wanna access through this
variable
 
Old September 12th, 2003, 03:55 PM
Authorized User
 
Join Date: Jun 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Ankur_Verma
 Right click on the Slider control in your dialog
box and select Add Variable. name the variable and click finish. this is a CSliderCtrl type
variable thats added to your dialog class as a
member variable.

Access any method you wanna access through this
variable
When I right click on the slider bar it will only let me select "Add Class". I'm only selected a win32 project not an MFC, so i don't know if this is causing any problems. I've tried to turn the dialog into a class but it does nothing. It only generates a resource.h file with the folowing
Code:
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Chp2Ex11.rc
//
#define IDD_DIALOG1                     101
#define IDC_SLIDER1                     1001
#define IDC_RED                         1001

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        102
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1002
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif
Then if i try "IDC_RED:: " to access the 'SetRange' function it isn't available in the intellisense options. I expect that the dialog needs to be made into a class but it just won't let me do it. The thing is I don't want to make an MFC project because there is a lot of excess code that I don't want to use. Any idea where I'm going wrong?
Cheers
DRB2k2
 
Old September 16th, 2003, 02:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Since you are not making use of MFC you have to
use SendMessage to get and set these values to and
from the Slider Control like this

HWND hwndSlider = GetDlgItem(hDlg, // handle to dialog box
                  IDC_SLIDER1 // control identifier );

  SendMessage(hwndSlider, TBM_SETRANGE,
        (WPARAM) TRUE, // redraw flag
        (LPARAM) MAKELONG(iMin, iMax)); // min. & max. positions

    SendMessage(hwndSlider, TBM_SETPOS,
        (WPARAM) TRUE, // redraw flag
        (LPARAM) iSelMin);

etc.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Access shared members through an instance.. woodstock08 ASP.NET 2.0 Basics 1 December 3rd, 2006 01:27 PM
Callin Static Members from .NET Dll in VBA syoguran VB How-To 0 March 13th, 2006 04:37 AM
call window dialog component with asp.net/vb.net s3ng ASP.NET 1.x and 2.0 Application Design 0 June 21st, 2005 04:54 AM
Using common dialog with access azkabancells VB Databases Basics 2 May 14th, 2005 06:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.