Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all 3027 articles
Browse latest View live

MFC MDI Tabbed Child Window Positioning

$
0
0
Is it possible to specify the size/position of tabs in an MFC MDI tabbed application?

I am trying to save the open tabs when exiting the program and restoring them when the application is relaunched. I have come up with a method of saving and reloading the tabs, but I cannot restore their position.

I have seen SaveMDIState and LoadMDIState but I can't make it do anything and I'm also not sure if it's what I need.

Thanks in advance,
AnotherMuggle

[RESOLVED] MFC MDI Tabbed Child Window Positioning

$
0
0
Is it possible to specify the size/position of tabs in an MFC MDI tabbed application?

I am trying to save the open tabs when exiting the program and restoring them when the application is relaunched. I have come up with a method of saving and reloading the tabs, but I cannot restore their position.

I have seen SaveMDIState and LoadMDIState but I can't make it do anything and I'm also not sure if it's what I need.

Thanks in advance,
AnotherMuggle

Input Validation Error Using Arrays

$
0
0
:confused:I have not completed this program yet, but I have already run into a snag. For the Input Validation part, every time you enter a number regardless if it is positive it will still display the cout statement: "Please enter positive values". The program runs correctly where I currently am at, but it just keeps reading that statement even if a user enters a positive value. I have run the debugger, but it really is not showing me anything other than I notice it jumping to that statement after every value that is entered.

Here is my code, once again I have not finished this yet, but I would really like to get this fixed first before I continue. I will keep debugging in the meantime...

Code:

// A local zoo wants to keep track of how many pounds of food each of its three monkeys
// eats each day during a typical week. Write a program that stores this information in a
// two-dimensional 3 X 7 array, where each row represents a different monkey and each column
// represents a different day of the week. The program should first have the user input the
// data for each monkey. Then it should create a report that includes the following information:

// Average amount of food eaten per day by the whole family of monkeys.
// The least amount of food eaten during the week by any one monkey.
// The greatest amount of food eaten during the week by any one monkey.

// Input validation: Do not accept negative numbers for pounds of food eaten.

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
        double totalAverage = 0;                                  // variable to store the total average, initalized to zero
        int monkey = 0,                                                    // index counter, intialized to zero
                day = 0;                                                    // index counter, intialized to zero
                                                   

        const int NUM_MONKEYS = 3;                          // Elements or number of rows in array
        const int NUM_DAYS = 7;                                    // Elements or number of columns in array
        double average [NUM_MONKEYS][NUM_DAYS],  // 2D array with a 3 x 7 (rows and columns)
                  highest = 0,                                        // variable to store the highest value for pounds eaten in a week
                  lowest,                                                    // variable to store the lowest value for pounds eaten in a week
                  monkeys[NUM_MONKEYS];                    // varialbe to store the total amount eaten by each monkey

        memset(&monkeys[0], 0, sizeof(monkeys));
        memset(&average[0], 0, sizeof(average));

        for(monkey = 0; monkey < NUM_MONKEYS; monkey ++)
        {
                for(day = 0; day < NUM_DAYS; day ++)
                {
                        do
                        {
                                cout << "Enter the number of pounds eaten for"
                            << " Monkey # " << (monkey + 1) << ", "
                                << "Day " << (day + 1) << ": ";
                                cin >> average[monkey][day];
                               
                                if(average[monkey][day] < 0);
                               

                                        // Ensure that negative numbers are not accepted
                                        // This keeps displaying regardless if the number is positive
                                        cout << "Please enter positive values.\n";     
                                                               
                        }
                                while(average[monkey][day] < 0);
                }

        cout << endl;

        }

Passing 2D array to and from a function in C++

$
0
0
Hello,

I am new to C++ and having problem passing arguments between main and a function.
I would like to pass three values to a function, have it calculate a 2D matrix and return it back to main. I would like it to accept variable matrix size. I appreciate any help I can get on this. Here is my code:

#include "stdafx.h"
#include <cstdlib>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <iomanip>
#include <ios>
#include <vector>
#include <sstream>
#include <iterator>
#include <algorithm>
#include <sstream>
#include <deque>
#include "split.h"
#include <cstdlib>
#include "Input_line_of_doubles.h"
#include "test_pad.h"

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::cerr;
using std::ifstream;
using std::ofstream;
using std::string;
using namespace std;

int main()
{
int k=0, j=0;
double roll=0.1;
double pitch=0.2;
double heading=1.0;
double **rr=0;

double Cb_n( double roll, double pitch, double heading, double **rr);

for (int k =0 ; k<3;k++)
{
for(int j =0 ;j <3;j++)
{
cout<<rr[k][j];
}
cout<<endl;
}
return 0;
}

double Cb_n(double roll, double pitch, double heading,double **r)
{
// function for calculating the rotation body---->navigation Cbn
double Ch,Sh,Cr,Sr,Cp,Sp;


Sh=sin(heading);
Ch=cos(heading);
Sr=sin(roll);
Cr=cos(roll);
Sp=sin(pitch);
Cp=cos(pitch);
r[1][1] = Ch*Cp;
r[1][2] = Ch*Sp*Sr - Sh*Cr;
r[1][3] = Ch*Sp*Cr + Sh*Sr;
r[2][1] = Sh*Cp;
r[2][2] = Sh*Sp*Sr + Ch*Cr;
r[2][3] = Sh*Sp*Cr - Ch*Sr;
r[3][1] = -Sp;
r[3][2] = Cp*Sr;
r[3][3] = Cp*Cr;

return **r;
}

Send commands or variables.

$
0
0
Hi Fellows,

I'm traying to create an executable with C or C++ that send a command with the function system, but it waits for a command or key.

Example :

I send this:

C:\runas /noprofile user:administrator notepad.exe

But it waits for password.

Please type the password :

So my question is how can I make to send the password or that my program detect that prompt.





Thanks.

Passing DDX Control Variables between Dialogs (Parent->Child)

$
0
0
Hello,
I apologize in advance, I'm very new to programming in general, especially C++, and I'm trying to update inherited code as best I can so please bear with me.

I have a main dialog which has (DDX?) controls for the user. eg a slider, and a combo box.
Previously, an image adjusted by these controls was in the same dialog.
I need to put this image in a New, separate dialog but it still must be controlled by the slider and combo box on the main dialog.
(I hope that makes sense)

My question is how can I pass the control's variables between the dialogs? I have, say,
Code:

//MainDlg.cpp
DDX_Control(pDX, IDC_ComboBrightness, m_Brightness

I was told that I could do something like:
Code:

//ImageDlg.h
public: 
        ImageDlg(CWnd* pParent = NULL, CComboBox m_Brightness);  // standard constructor

But I get errors including: Missing default parameter for parameter 2

I also need to pass the image array, is that perhaps the same method?

Even if someone could even point me to an appropriate MSDN article or a tutorial, I'm happy to do the reading - I just can't seem to hit on the right search parameters, or my C++ to English translations aren't as good as they should be yet.

Thanks so much!
Cheers!

How to locallize a plug-in DLL file?

$
0
0
I have experiences to localize a few MFC executable files, first create a resource dll file then add following code in InitInstance():

Code:

BOOL CMyApp::InitInstance()
{
  //Default Application Wizard code.
  HINSTANCE hRes = NULL;
  hRes= LoadLibrary("ResourceD.dll");
  if(hRes)
      AfxSetResourceHandle(hRes);
  //Rest of wizard code
  return CWinApp::InitInstance();
}

Now I need to localize a dll file which is an IE web browser toolbar, who could tell me how localize the dll file? Thank you!

MSDN Documentation books

$
0
0
Does anyone know if Microsoft has a collection of official MSDN books that are print versions of their online MSDN documentation?

Problem with template class ?

$
0
0
I'm assuming this problem is happening because the classes are template classes. Here's a cut-down version of the code that's giving me the problem:-

Code:

template<typename Time> class Note;

template<typename Time>
class Sequence : virtual public ControlSet {
public:
        // c'tors etc

public:
        struct EarlierNoteComparator {
                inline bool operator()(const boost::shared_ptr< const Note<Time> > a,
                                      const boost::shared_ptr< const Note<Time> > b) const {
                        return musical_time_less_than (a->time(), b->time());
                }
        };

        typedef typename boost::shared_ptr<Evoral::Note<Time> >  NotePtr;

        typedef std::multiset<NotePtr, EarlierNoteComparator> Notes;

        void set_notes (const Sequence<Time>::Notes& n);
};

Basically, the above code compiles with gcc but when I try to compile it with MSVC (version 8) I get this error at the red line:-

Quote:

error C2061: syntax error : identifier 'Notes'
Can anyone tell me what the problem is?

Recursion

$
0
0
The code below is suppose to create directories and upload files, but it is not working. What can I do to make the code work?


Code:

void CRECURSIONDlg::Recursion(CString sPath)
{

hInternet = InternetOpen(TEXT("BEAR FTP"),
  INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

// Make sure there are no errors
hIConnect = InternetConnect(hInternet,"192.168.1.4", 211,
  "******", "*****", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);


HANDLE hFind;
WIN32_FIND_DATA fdFind;
UpdateData(true);

CString salvation = m_path + "\\" + sPath;
        UpdateData(false);


hFind = FindFirstFile( salvation, &fdFind );



do{

if( fdFind.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
{
        FtpCreateDirectory(hIConnect,fdFind.cFileName);
UpdateData(true);
CString cov = m_path;
UpdateData(false);
CString newPath = cov + "\\" + fdFind.cFileName;
FtpCreateDirectory(hIConnect,fdFind.cFileName);

Recursion(newPath);
}
if(fdFind.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE)
continue;
else
{
FtpPutFile(hIConnect,fdFind.cFileName,fdFind.cFileName,FTP_TRANSFER_TYPE_BINARY,NULL);

}






}while( FindNextFile( hFind, &fdFind ) );


}

Getting error while retrieving value from ADO recordset.

$
0
0
I have a vc++ project file which reads data from access 2007 database.

I have successfully declared and opened connectionPtr and recordSetPtr objects.

The follwoing code is giving an error message that "item cannot be found in the collection"
stringVar = (recordSet->Fields->GetItem("[String]")->GetValue()).bstrVal;

If i replace "[String]" with "String" then above statement executed successfully.

How can i execute the above statement with "[String]" without errors?


Thanks in advance.

Regards,
Siva.

problem with toupper()

$
0
0
Hi,

I am having trouble with this line of code:

cout << "Lower to upper: t" << toupper(str);

The str is underlined and it won't compile.

Code:


#include<iostream>
#include<string>
#include<cctype>

using namespace std;

void upr(const string & str);

int main()
{
        string strinpt;
        char quit = 'Q';
        while (quit != 'q')
        {
                cout << "Enter phrase in lower case to be turned into upper case: " << "\n";
                getline(cin, strinpt);
                upr(strinpt);
                cout << "Do you want stop entry? " << "\n";
                cin >> quit;
        }
        return 0;
}
void upr(const string & str)
{
        cout << "OutPut: " << str << "\n";
        cout << "Lower to upper: t" << toupper(str);
}

Any help would be appreciated.

vcproj and sln files

$
0
0
Are .vcproj and .sln files still used in VS2012 or are they called something else now?

The reason I'm asking is that when I first moved from VC6 to VC8, it was quite handy to be able to have both the new style files (.vcproj / .sln) and the older files (.dsp / .dsw) in the same build folder. It meant that I could easily fall back to building with VC6 if necessary (although I don't think I ever needed to).

Now I want to upgrade to VS2012. Would my .vcproj and .sln files remain preserved or would they get converted to a newer format?

Recommended way to clear SaveMDIState?

$
0
0
I am using SaveMDIState and LoadMDIState to have documents from the last session, load on starting the next session.

I cannot see any way to clear the previously saved state other than manually deleting the relevant registry keys.

Does anyone know if there is a "proper" way to do this?

Cheers,
AnotherMuggle

strange compiler error 'in' MSVC++ functional template

$
0
0
Hi all, I'm working on a good sized project and after the latest code updates, I'm getting a compiler error the source of which is difficult to interpret:

1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1049) : error C2143: syntax error : missing ')' before '&'
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1083) : see reference to class template instantiation 'std::tr1::function<_Fty>' being compiled


It's actually one of 19 errors from the same file (functional).


This is the code (microsoft's code) at that line of the first error:

void swap(_Myt& _Right)
{ // swap with _Right
this->_Swap(_Right);
}


This happens when compiling a .cpp file that does not appear to use std::tr1::function or anything related to it. In fact, the code changes I made recently were not to the .cpp file that fails compilation due to this error. Typically, I can search the 'net and find a solution but this one has me stumped.

It would appear that the compiler doesn't understand what a _Myt or _Fty type is. That makes two of us, but it IS defined above in the 'functional' file:

template<class _Fty>
class function
: public _Get_function_impl<_Fty>::_Type
{ // wrapper for callable objects
public:
typedef function<_Fty> _Myt;

Unfortunately, I can't post example code because the entirety of my project is too big to post and the compiler isn't pointing to any particular file of my project. Any help in getting started down the path of finding where the problem is would be fantastic. Here are the rest of the errors generated:



Code:

1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1049) : error C2143: syntax error : missing ')' before '&'
1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1083) : see reference to class template instantiation 'std::tr1::function<_Fty>' being compiled
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1049) : error C2143: syntax error : missing ';' before '&'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1049) : error C2182: '_Myt' : illegal use of type 'void'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1049) : error C2377: 'std::tr1::function<_Fty>::_Myt' : redefinition; typedef cannot be overloaded with any other symbol
1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(953) : see declaration of 'std::tr1::function<_Fty>::_Myt'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1049) : error C2143: syntax error : missing ';' before '<<'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1049) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1049) : error C2059: syntax error : ')'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1050) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1087) : warning C4002: too many actual parameters for macro 'swap'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1087) : error C2143: syntax error : missing ')' before '&'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1087) : error C2143: syntax error : missing ';' before '&'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1087) : error C2182: 'function<_Fty>' : illegal use of type 'void'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1087) : error C2936: 'std::tr1::function<_Fty>' : template-class-id redefined as a global data variable
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1087) : error C2143: syntax error : missing ';' before '<<'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1087) : error C2059: syntax error : ')'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1087) : error C2065: '_Fty' : undeclared identifier
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1094) : error C2065: '_Fty' : undeclared identifier
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1095) : error C2143: syntax error : missing ';' before '{'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\functional(1095) : error C2447: '{' : missing function header (old-style formal list?)


[RESOLVED] Rounding a number multiple of another

$
0
0
Hello all,
How would I be able to round a number in multiples of another...

Let's say width is 150
And multiple to be 64...
I want 150 to become 128...
if it was 160 to become 192...

The width number will change and I want to covert it in multiples of the other number example 64... The minimum value will always be the multiple number used...

Hope I explain it right...
Thx so much...

How to publicise my own game?

Is there any way other than CRecordset to read/write database in VC++?

Weird interaction between and

$
0
0
Code:

#include <algorithm>
#include <winsock.h>

void some_func()
{
      int result = std::min (0, 16384);
}

Okay, it's a silly example - but the above code consistently gives me error C2589: '(' : illegal token on right side of '::'. I'm building with VC8. If I don't #include <winsock.h> the code compiles correctly but it doesn't matter if I #include <winsock.h> before or after including <algorithm>

I guess it might be due to one of my #defines but I've tried the code in a very minimal program and I still get the error. Is there anyone here who could try this (preferably in VC8) and let me know if they also see the problem?

How to call this function?

$
0
0
Code:

Value*
globalVars_get_cf(Value** arg_list, int count)
{
        // globalVars.get <global_name>
        check_arg_count(globalVars.get, 1, count);
        Value* glob_name = Name::intern(arg_list[0]->to_string());
        GlobalThunk* t = (GlobalThunk*)globals->get(glob_name);
        if (!t)
                throw RuntimeError (MaxSDK::GetResourceStringAsMSTR(IDS_NO_SUCH_GLOBAL), glob_name);
        return t->eval();
}

Code:

// the root MAXScript class
class Value : public Collectable
{
private:
        ScripterExport static Matrix3  s_error_matrix;
        ScripterExport static Box2  s_error_box2;
public:
        #pragma warning(push)
        #pragma warning(disable:4100)
        ValueMetaClass* tag;                // runtime type tag; filled in by subclasses

        ScripterExport virtual BOOL        is_kind_of(ValueMetaClass* c);
        ScripterExport virtual ValueMetaClass* local_base_class(); // local base class in this class's plug-in
        virtual Value*        eval() { check_interrupts(); return this; }
        virtual Value*        eval_no_wrapper() { check_interrupts(); return this; }
        ScripterExport virtual Value*  apply(Value** arglist, int count, CallContext* cc=NULL);
        ScripterExport virtual Value*  apply_no_alloc_frame(Value** arglist, int count, CallContext* cc=NULL);
        virtual void        export_to_scripter() { }

        virtual Value*  map(node_map& m) { unimplemented(_M("map"), this) ; return this; }
        virtual Value*        map_path(PathName* path, node_map& m) { unimplemented(_M("map_path"), this) ; return this; }
        virtual Value*        find_first(BOOL (*test_fn)(INode* node, int level, void* arg), void* test_arg) { unimplemented(_M("find_first"), this) ; return this; }
        virtual Value*        get_path(PathName* path) { unimplemented(_M("get"), this) ; return this; }

        ScripterExport virtual void        sprin1(CharStream* stream);
        ScripterExport virtual void        sprint(CharStream* stream);

        virtual void        prin1() { sprin1(thread_local(current_stdout)); }
        virtual void        print() { sprint(thread_local(current_stdout)); }
       
        /* include all the protocol declarations */

#include "..\macros\define_abstract_functions.h"
#        include "..\protocols\math.inl"
#        include "..\protocols\vector.inl"
#        include "..\protocols\matrix.inl"
#        include "..\protocols\quat.inl"
#        include "..\protocols\arrays.inl"
#        include "..\protocols\streams.inl"
#        include "..\protocols\strings.inl"
#        include "..\protocols\time.inl"
#        include "..\protocols\color.inl"
#        include "..\protocols\node.inl"
#        include "..\protocols\controller.inl"
#        include "..\protocols\primitives.inl"
#        include "..\protocols\generics.inl"
#        include "..\protocols\bitmaps.inl"
#        include "..\protocols\textures.inl"
#        include "..\protocols\atmospherics.inl"
#        // Moved to ..\maxwrapper\mxsnurbs.h into class NURBSObjectValue
#        include "..\protocols\cameratracker.inl"
#        include "..\protocols\bigmatrix.inl"
#        include        "..\protocols\box.inl"
#        include "..\protocols\physiqueblend.inl"
#        include "..\protocols\physiquemod.inl"
#        include        "..\protocols\biped.inl"
#        include "..\protocols\notekey.inl"
#        include "..\protocols\xrefs.inl"

        ScripterExport virtual Class_ID get_max_class_id() { return Class_ID(0, 0); }
        ScripterExport virtual Value* delete_vf(Value** arglist, int arg_count) { ABSTRACT_FUNCTION(_M("delete"), this, Value*); }         
        ScripterExport virtual Value* clearSelection_vf(Value** arglist, int arg_count) { ABSTRACT_FUNCTION(_M("clearSelection"), this, Value*); }         

#undef def_generic
#define def_generic(fn, name) ScripterExport virtual Value* fn##_vf(Value** arglist, int arg_count);
#        include "..\protocols\kernel.inl"
       
        virtual float                to_float() { ABSTRACT_CONVERTER(float, Float); }
        virtual double                to_double() { ABSTRACT_CONVERTER(double, Double); }
        virtual MCHAR*                to_string() { ABSTRACT_CONVERTER(MCHAR*, String); }
        virtual MSTR                to_filename() { ABSTRACT_CONVERTER(MCHAR*, FileName); }
        virtual int                        to_int() { ABSTRACT_CONVERTER(int, Integer); }
        virtual INT64                to_int64() { ABSTRACT_CONVERTER(INT64, Integer64); }       
        virtual INT_PTR                to_intptr() { ABSTRACT_CONVERTER(INT_PTR, IntegerPtr); }       
        virtual BOOL                to_bool() { ABSTRACT_CONVERTER(BOOL, Boolean); }
        virtual BitArray&        to_bitarray() { throw ConversionError (this, _M("BitArray")); return *(BitArray*)NULL; }
        virtual Point4                to_point4() { ABSTRACT_CONVERTER(Point4, Point4); }
        virtual Point3                to_point3() { ABSTRACT_CONVERTER(Point3, Point3); }
        virtual Point2                to_point2() { ABSTRACT_CONVERTER(Point2, Point2); }
        virtual AColor                to_acolor() { throw ConversionError (this, _M("Color")); return AColor(0,0,0); }
        virtual COLORREF        to_colorref() { throw ConversionError (this, _M("Color")); return RGB(0,0,0); }
        virtual INode*                to_node() { ABSTRACT_CONVERTER(INode*, <node>); }
        virtual Ray                        to_ray() { throw ConversionError (this, _M("Ray")); return Ray(); }
        virtual Interval        to_interval() { throw ConversionError (this, _M("Interval")); return Interval();  }
        virtual Quat                to_quat() { throw ConversionError (this, _M("Quaternion")); return Quat();  }
        virtual AngAxis                to_angaxis() { throw ConversionError (this, _M("AngleAxis")); return AngAxis();  }
        virtual Matrix3&        to_matrix3() { throw ConversionError (this, _M("Matrix")); return s_error_matrix;  }
        virtual float*                to_eulerangles() { ABSTRACT_CONVERTER(float*, Float); }
        virtual Mtl*                to_mtl() { ABSTRACT_CONVERTER(Mtl*, Material); }
        virtual Texmap*                to_texmap() { ABSTRACT_CONVERTER(Texmap*, TextureMap); }
        virtual MtlBase*        to_mtlbase() { ABSTRACT_CONVERTER(MtlBase*, MtlBase); }
        virtual Modifier*        to_modifier() { ABSTRACT_CONVERTER(Modifier*, Modifier); }
        virtual TimeValue        to_timevalue() { ABSTRACT_CONVERTER(TimeValue, Time); }
        virtual Control*        to_controller() { ABSTRACT_CONVERTER(Control*, Controller); }
        virtual Atmospheric* to_atmospheric() { ABSTRACT_CONVERTER(Atmospheric*, Atmospheric); }
        virtual Effect*                to_effect() { ABSTRACT_CONVERTER(Effect*, Effect); }                                                // RK: Added this
        virtual IMultiPassCameraEffect*        to_mpassCamEffect() { ABSTRACT_CONVERTER(IMultiPassCameraEffect*, Effect); }        // LAM: Added this
        virtual ShadowType*        to_shadowtype() { ABSTRACT_CONVERTER(ShadowType*, ShadowType); }                        // RK: Added this
        virtual FilterKernel*        to_filter() { ABSTRACT_CONVERTER(FilterKernel*, FilterKernel); }                // RK: Added this
        virtual INode*                to_rootnode() { ABSTRACT_CONVERTER(INode*, <root>); }                                                // RK: Added this
        virtual ITrackViewNode* to_trackviewnode() { ABSTRACT_CONVERTER(ITrackViewNode*, TrackViewNode); }
        virtual NURBSIndependentPoint* to_nurbsindependentpoint() { throw ConversionError (this, _M("NURBSIndependentPoint")); return (NURBSIndependentPoint*)0;  }
        virtual NURBSPoint*        to_nurbspoint() { throw ConversionError (this, _M("NURBSPoint")); return (NURBSPoint*)0;  }
        virtual NURBSObject* to_nurbsobject() { throw ConversionError (this, _M("NURBSObject")); return (NURBSObject*)0;  }
        virtual NURBSControlVertex* to_nurbscontrolvertex() { throw ConversionError (this, _M("NURBSControlVertex")); return (NURBSControlVertex*)0;  }
        virtual NURBSCurve* to_nurbscurve() { throw ConversionError (this, _M("NURBSCurve")); return (NURBSCurve*)0;  }
        virtual NURBSCVCurve* to_nurbscvcurve() { throw ConversionError (this, _M("NURBSCVCurve")); return (NURBSCVCurve*)0;  }
        virtual NURBSSurface* to_nurbssurface() { throw ConversionError (this, _M("NURBSSurface")); return (NURBSSurface*)0;  }
        virtual NURBSTexturePoint* to_nurbstexturepoint() { throw ConversionError (this, _M("NURBSTexturePoint")); return (NURBSTexturePoint*)0;  }
        virtual NURBSSet*        to_nurbsset() { throw ConversionError (this, _M("NURBSSet")); return (NURBSSet*)0;  }
        virtual ReferenceTarget* to_reftarg() { ABSTRACT_CONVERTER(ReferenceTarget*, MaxObject); }
        virtual Mesh*                to_mesh() { ABSTRACT_CONVERTER(Mesh*, Mesh); }
        virtual Thunk*                to_thunk() { ABSTRACT_CONVERTER(Thunk*, &-reference); }
        virtual void                to_fpvalue(FPValue& v) { throw ConversionError (this, _M("FPValue")); }

        virtual Renderer*        to_renderer() { ABSTRACT_CONVERTER(Renderer*, Renderer); }        // LAM: Added this 9/15/01

        virtual Box2&        to_box2() { throw ConversionError (this, _M("Box2")); return s_error_box2;  }
        virtual NURBSTextureSurface* to_nurbstexturesurface() { throw ConversionError (this, _M("NURBSTextureSurface")); return (NURBSTextureSurface*)0;  }
        virtual NURBSDisplay* to_nurbsdisplay() { throw ConversionError (this, _M("NURBSDisplay")); return (NURBSDisplay*)0;  }
        virtual TessApprox*        to_tessapprox() { throw ConversionError (this, _M("TessApprox")); return (TessApprox*)0;  }

        virtual Value*        widen_to(Value* arg, Value** arg_list) { ABSTRACT_WIDENER(arg); }
        virtual BOOL        comparable(Value* arg) { return (tag == arg->tag); }
        virtual BOOL        is_const() { return FALSE; }
        // LAM - 7/8/03 - defect 504956 - following identifies classes that derive from MAXWrapper. Only other implementation is in MAXWrapper
        // used by garbage collector to prevent collection of MAXWrapper-derived values while doing light collection
        virtual BOOL        derives_from_MAXWrapper()  { return FALSE; }

        ScripterExport virtual Value*        get_property(Value** arg_list, int count);
        ScripterExport virtual Value*        set_property(Value** arg_list, int count);
        ScripterExport                  Value*        _get_property(Value* prop);
        ScripterExport virtual Value*        _set_property(Value* prop, Value* val);
        virtual Value*        get_container_property(Value* prop, Value* cur_prop) { if (!dontThrowAccessorError) throw AccessorError (cur_prop, prop); return NULL; }
        virtual Value*        set_container_property(Value* prop, Value* val, Value* cur_prop) { throw AccessorError (cur_prop, prop); return NULL;}

        // polymorphic default type predicates - abstracted over by is_x(v) macros as needed
        virtual BOOL        _is_collection() { return FALSE; }
        virtual BOOL        _is_charstream() { return FALSE; }
        virtual BOOL        _is_rolloutcontrol() { return FALSE; }
        virtual BOOL        _is_rolloutthunk() { return FALSE; }
        virtual BOOL        _is_function()        { return FALSE; }
        virtual BOOL        _is_selection()        { return FALSE; }
        virtual BOOL        _is_thunk()                { return FALSE; }
        virtual BOOL        _is_indirect_thunk() { return FALSE; }

        // yield selection set iterator if you can
        virtual SelectionIterator* selection_iterator() { throw RuntimeError (_M("Operation requires a selection (Array or BitArray)")); return NULL; }

        // scene persistence functions
        ScripterExport virtual IOResult Save(ISave* isave);
        // the Load fn is a static method on loadbale classes, see SceneIO.cpp & .h and each loadable class

        // called during MAX exit to have all MAXScript-side refs dropped (main implementation in MAXWrapper)
        virtual void drop_MAX_refs() { }

        // access ID'd FPInterface if supported
        virtual BaseInterface* GetInterface(Interface_ID id) { return NULL; }


        // stack allocation routines
        ScripterExport Value* make_heap_permanent();
        ScripterExport Value* make_heap_static() { Value* v = make_heap_permanent(); v->flags |= GC_STATIC; return v; }

        ScripterExport Value* get_heap_ptr() { if (!has_heap_copy()) return migrate_to_heap(); return is_on_stack() ? get_stack_heap_ptr() : this; }
        ScripterExport Value* get_stack_heap_ptr() { return (Value*)next; }
        ScripterExport Value* migrate_to_heap();
        ScripterExport Value* get_live_ptr() { return is_on_stack() && has_heap_copy() ? get_stack_heap_ptr() : this; }
        #pragma warning(pop)
};

I want to create a MCHAR* type which is believed to be in strings.inl., I don't show the strings.inl file for now which might bring into larger confusion.

Will this do
MCHAR* name = globalVars.get("Name");
Thanks in advance
Jack
Viewing all 3027 articles
Browse latest View live