I have a class which is using the float as template parameter . The code compiles correctly in VC6.0. But in VS2008 float is not allowed as template paramemter. So i am using the float pointer(please let me know if there is any alternative other than using int as data type). when I compile the code I get following errors at multiple places syntax error : missing ',' before identifier 'lowerBound' syntax error : missing ',' before identifier 'upperBound' 'tBoundedType' : too many template arguments How can fix this? what is error in this class declaration here is my float pointer class declaration #ifndef tBoundedType_h #define tBoundedType_h #define CLASSID_TBOUNDEDTYPE 27 template class tBoundedType { public: tBoundedType(); // Sets the value to lowerBound. tBoundedType(float * value); // An Ensure fails if value is not between lowerBound and upperBound. // tBoundedType & operator=(float *); // An Ensure fails if value is not between lowerBound and upperBound. static float LowerBound() { return lowerBound; } static float UpperBound() { return upperBound; } // operator type() const { return mValue; } // Stream me //virtual void PerformIO(tNSStream *); virtual long GetClassId() const { return CLASSID_TBOUNDEDTYPE; } long GetVersion() const { return 1; } protected: float mValue; }; template tBoundedType<lowerbound,>::tBoundedType() : mValue(*lowerBound) { } template tBoundedType::tBoundedType(float * newValue) : mValue(*newValue) { Ensure(mValue >= *lowerBound); Ensure(mValue <= *upperBound); } template tBoundedType & tBoundedType::operator=(type newValue) { Ensure(newValue >= lowerBound); Ensure(newValue <= upperBound); mValue = *newValue; return *this; } template void tBoundedType::PerformIO( tNSStream *stream ) { //int version = GetVersion(); //stream->DoIO( version ); //stream->DoIO( mValue ); }
Hemant kulkarni
Posts
-
problem in porting template class from VS6.0 to VS2008 -
how to fix error C2993: 'float' : illegal type for non-type template parameter 'Hi, I am porting a VC6.0 code to VS2008. I have a class with following decalration template type lowerBound, type upperBound> class TempClass { public: TempClass(void ); //virtual ~TempClass(void); protected: type mValue; }; template TempClass<type,>::TempClass(void) { // TBI } I am declaring a pointer to this class as TempClass <float, 1,2> *pT1; I am getting the error error C2993: 'float' : illegal type for non-type template parameter 'lowerBound' error C2993: 'float' : illegal type for non-type template parameter 'upperBound' how can I fix this problem? I cannot use the pointers for lowerBound, upperBound.
-
How to get the device instance id of a disk or volume?I am developing a software where I store the Instance ID of every disk in the system. How can I get the Instance ID from a disk number? e.g I want Instance ID of DIsk0 DIsk1 etc.? here is what I am doing 1] SetupDiClassGuidsFromNameA("DiskDrive",***); to get the GUID for disk drives 2]SetupDiEnumDeviceInf(***) to enumrate all the disks.This gives me Instance ID's of all the disks but how can I get the device instance ID of spesific disk(like Disk0)?
-
Icon & bitmap ID's for "New folder" "Delete" Rename" etcHi, Windows explorer uses soem icons(bitmaps) for folder, New Folder, Delete etc. Are those standard icons? Can we use same icons in my application? If yes what are the ID's of those icon? Can I load them using LoadResource(), or LoadBitmap() function? Regards, Hemant
-
How to get the format of users local date and time?Hi, In my one application I ma having a MFC CDateTimeCtrl control. The requirement is that, the format of date and time of this control and the users local date and time should be same. Means if users format is 24hr clock my control should also display the time in 24hr format. I have following two questions regarding this. 1] How I can know that user changed the format of his time? (I can find the time change by ON_WM_TIMECHANGE message but what if user changed only format and not the time?) 2] How to get the current format of users local date and time? Regards, Hemant kulkarni
-
How to disable the drag and drop operation in WebBrowser controlHi, I am using WebBrowser control to display the HTML help files. My html help files contains some graphics like jpg and png images. When user tries to drag and drop the items from the help pages the WebBrowser control gives debug assertion error. How can I disable this Drag and Drop facility? I am also setting the RegisterAsDropTarget(VARIENT_FALSE)at runtime after the control in created, but still allowes to cdrag and drop the images. How can I disable this Drag and Drop facility? Regards, Hemant.
-
How to remove the AM/PM text in CDateTimeCtrl ?Thanks! I got the solution It is just to change the SetFormat() finction and not to pass tt t options in string
-
How to remove the AM/PM text in CDateTimeCtrl ?Hi, I created a CDateTimeCtrl control on my view. It is a 24 hour time format. But it still displays AM/PM . If it is 24 hr clock them AM/PM is not necessary there. SO I want to remove the AM/Pm text from control. How can I do this? Regards, Hemant Kulkarni.
-
What is difference between OnPaint and OnDraw?Hi, I am developing a application in which I need to draw the some text and graphics on the view. I can do this in OnPaint as well as in OnDraw. But when one should use OnPaing and when OnDraw()? What is difference between OnPaint and OnDraw? Regards, Hemant Kulkarni.
-
How to give "Pressed" look to static controlHi, I have a static control derived from CStatic class. When user clicks on it I want that the static control should look like as it is pressed. The control is not a button, so I cannot do this directly. How can I achive this? Regards, Hemant
-
How to achive application load balancing in win32 applicationHi, My application is having two threads. One is UI thread doing all UI operations. The another thread is doing some heavy work like writing to disk. How I can achive that only when the system have a light load then only the disk writer thread will run and in heavy load cases it will not schedule or scheduled for very low time? How can I know that when system is not heavily loaded and when it is heavily loaded? Is the "Load Balancing" word correct here or it is misleading? Regards, Hemant.
-
how to convert char[] to byte[] without loss of dataHi, How can I convert char[] to byte[] without loss of data? Regards, Hemant.
-
problem in adding text >64k in wmv file?Hi, I have a wmv file in which I wnat to add a text data as attribute. The data is >64k. I have written following code but it gives "The parameter is incorrect." error. try { // Create a WMEncoder object. WMEncoder Encoder = new WMEncoder(); IWMMetadataEditor metadataEditor = null; try { //create encoder object Qlikkit.WMFSDKWrapper.Functions.WMCreateEditor(out metadataEditor); } catch(Exception ex) { string str = ex.Message; int mydata = 0; } // open wmv file try { metadataEditor.Open("d:\\3333.wmv"); } catch(System.Runtime.InteropServices.COMException ex) { string mystr = ex.Message; string mystr2 = ex.StackTrace; int jj=0; } // get the IWMHeaderInfo3 interface IWMHeaderInfo3 headerInfo = metadataEditor as IWMHeaderInfo3; // get attribute count ushort Outindex = 0; headerInfo.GetAttributeCount(0,out Outindex); IWMEncDisplayInfo displayInfo = Encoder.DisplayInfo; readMetadataStream(); String mydaya22 = "data" ; System.Text.StringBuilder mydata33 = new System.Text.StringBuilder(mydaya22); Qlikkit.WMFSDKWrapper.WMT_ATTR_DATATYPE attrDataType2 = new Qlikkit.WMFSDKWrapper.WMT_ATTR_DATATYPE();//Qlikkit.WMFSDKWrapper.WMT_ATTR_DATATYPE.WMT_TYPE_STRING; attrDataType2 = Qlikkit.WMFSDKWrapper.WMT_ATTR_DATATYPE.WMT_TYPE_STRING; try { // add attribute headerInfo.AddAttribute(0, "Author", out Outindex, attrDataType2, 0, //myDataptr, mydata33, (uint)metadataSIze ); } catch(Exception ex2) { // TODO: Handle exceptions. string str = ex2.Message; } Also My defination of IWMHeaderInfo3.AddAttribute is void AddAttribute( [In] ushort wStreamNum, [In, MarshalAs(UnmanagedType.LPWStr)] string pszName, [Out] out ushort pwIndex, [In] WMT_ATTR_DATATYPE Type, [In] ushort wLangIndex, //IntPtr pValue, [In, MarshalAs(UnmanagedType.LPWStr)] StringBuilder data, [In] uint dwLength); is it correct? Regards, Hemant.
-
how to add delay in the wmv fileHi, I am creating a movie from some images it is not a real time video. My important question is How I can write a metatdata >64 to wmv file? Regards, Hemant
-
how to add delay in the wmv fileWhat is difference between "Video Image stream" and "regular video stream"?
-
How to get IWMHeaderInfo3 interface from WMEncoderHi, I want to write some big text datainto wmv file(>64k). So I need the IWMHeaderInfo3 . I have the WMEncoder object. How to get IWMHeaderInfo3 interface from WMEncoder? Regards, Hemant.
-
how to convert char[] to System.IntPtrHi, Thanks for urgent reply. How can I allocate a memry and get some data copy to that memory ad get its pointer back? Regards, Hemant.
-
how to convert char[] to System.IntPtrHi, I want to convert a char array to System.IntPtr. How can I do this? I written the following code wich gives error as cannot copy to null value string metadatapath2 = "C:\\BigMetadata.txt"; StreamReader myStreamReader1 = new StreamReader(metadatapath2); string bigdata = myStreamReader1.ReadToEnd(); char [] dataarray = bigdata.ToCharArray(); System.IntPtr myDataptr = new System.IntPtr(); Marshal.Copy(dataarray,0,myDataptr,dataarray.Length*2); Thanks in advance Regards, Hemant.
-
how to add delay in the wmv fileHi, In my application I created a wmv movie form 3 images. It also have the audio for 15 seconds. Audio per frame is variable means that we can have audiofor first frame for 2 sec , for second frame 10 sec and for 3rd frame 3 sec. How can I achive this? one solution can be variable frame rate for each frame. CAn we do this in wmv ? How can we do this? Is there any other alternative available to achive this All help and guidelines are welcome Thanks in advance Regards, Hemant.
-
How to add wave file to wmv fileIt is written in c#