|
Could you please point me towards a good tutorial on this subject as I'm totally new to this stuff. From what I gather I would have to write my own paint events - is that right??
|
|
|
|
|
That's right. If you search this site for user control, you'll get heaps of hits.
This[^] and this[^] look like good places to start.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi all, I've run into some problems with a template I'm trying to do.
First of all I declared a class and its members in a header file.
eg:
class SomeClass
{
public:
SomeClass(void);
~SomeClass(void);
int SomeFunction(int &, int &);
private:
int someVars;
};
and then defined the class and its members in a source file.
This all worked fine, and run as expected.
but because it's for a library I'm writting, I need it to handle multiple datatypes, so naturally I turned the relivent parts into templates.
The problem is, the template only works if the whole class is declared and defined in the header file. If I try to put the definitions into a source file, I get undefined errors popping up everywhere.
Is there a way and could someone explain how I can declare a template in a header file and define it in a source file. It just keeps things somewhat tidy.
Regards
|
|
|
|
|
hello again :P, my modifing is broken. anyway on a final note to defining / declaring template...
in the eg shown above I had added something similar to
template <typename datatype="">
class SomeClass
{
...
}; replaced all the int's with DATATYPE.
in the source file I was messing around and have tried a few things like
template <typename datatype="">
SomeClass<datatype>::SomeClass(void) { }
... etc etc
I've tried other variouis things, but I haven't found a solution, the net hasn't been much help as of yet.
N/B: Not to worry, I have just read they have to be declared and defined in the same file, grrr. well I have to live with what I've got
Freedom doesn't come without a fight.
|
|
|
|
|
I have made it.
So:
Create cpp file and h file. the cpp file will have strange error. Right click on that cpp in solution explorer. Find Precompiled headers under C/C++. Under option "Create/Use Precompiled Header" chose "Not Using Precompiled Headers"
|
|
|
|
|
hello,
i want to send an XML file as an argument to a function which is being tested in CPPUNIT. how do i parse the entire file
thanks
|
|
|
|
|
I had to google CPPUNIT to find out what it was.
It would be better if you would post the actual code so we can see what you are doing.
The System::Xml namesapce has a number of well-developed classes that can used to read XML data into memory. The most obvious is: XmlReader. But, in your case, (I'm guessing here) you might prefer XmlDocument or the Navigator object that be created for XmlDocument.
Read the documentation; these classes are easy to use and almost foolproof.
|
|
|
|
|
hi
I've started R&D work on a USB-232 converter cable (comply with FCC standards).
My application (C++ driver on Linux OS) tries to connect with a device & communicates via this cable.(the device is connected to the rs232 port & PC is connected to the USB port)
I'd tested with the RS232 cable & now I want to use this USB-232 converter cable.
Are there any libraries or sample source codes to do that.
Thanks
|
|
|
|
|
It's a bit misleading IMO, but C++/CLI is the managed C++ forum. Either way, I suspect this is the wrong place to ask how Linux provides USB libraries. By all means, ask in the C++ forum, but I'd be looking at also asking where more people use Linux.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi
I need to convert a char a[8000] to a String* (in .NET)
how do I do it?
<br />
String * b = (String *) a;
will crash at a certain point.
thanks alot
|
|
|
|
|
A String does not contain a char *, it's a Unicode string. At a minimum, you'd need to turn your pointer into a BSTR, I would think. Either way, you can't cast a char * to a string type, you need to pass the byte array into a constructor. That memory address contains an array of bytes representing character data, it does NOT contain an instance of hte String class, which encapsulates a Unicode string.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
char a[8000] = "hello";<br />
String * b = new String(a);
|
|
|
|
|
It works well for me.
you can try also this:
char a[8000] = "hello";
String * b = new String(S"");
b = Convert::ToString(a);
|
|
|
|
|
I've got an unmanaged varargs function:
print(char*, ...);
And I've got an exception:
catch (System::Exception *ex)
And I try to print it:
print("%s", ex->Message);
And I get 5 weird symbol characters in the output. What's going on? Am I doing something wrong here? I check Message in managed code and it's fine. Print works fine too, for everything else.
|
|
|
|
|
Just a guess, maybe it's because ex->Message is in Unicode? And your print function only works on ANSI NULL terminated strings?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
ur char* is probably pointing to sumthing in the memory thats not a string
so when u print it it shows u the ascii values of the numbers in the memory
give me the complete code and ill tell u wut ur doin wrong
|
|
|
|
|
Hey,
When migrating VC6 projects to VC7 I often get this warning when compiling the source files that were original VC6 project files that did not emit this warning:
[Warning C4005: 'UNICODE' macro redefinition] with the warning level set to 3
Is there an option or switch I have set wrong?
Best regards,
Bill
|
|
|
|
|
I have added reference of COM: "Microsoft DAO 3.6 Object Library"
Object *pLang = S"dbLangGeneral";<br />
Object *pSrc = S".\\Data\\Database.mdb";<br />
Object *pDes = S".\\Data\\Database.com";<br />
dao::DBEngine::ompactDatabase(pSrc->ToString(), pDes->ToString() , pLang, 0, NULL);
I Got "error C2352: 'dao::_DBEngine::CompactDatabase' : illegal call of non-static member function"
How can i correct it.
|
|
|
|
|
Saksida Bojan wrote:
dao::DBEngine::ompactDatabase
Should that read CompactDatabase ?
Saksida Bojan wrote:
I Got "error C2352: 'dao::_DBEngine::CompactDatabase' : illegal call of non-static member function"
The function you're trying to call is not static, and so needs an instance of the class to call it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I don't know how to do it. Can you please give an example.
Thanks in advance.
PS: Yes, It Shoud be CompactDatabase.
|
|
|
|
|
You need to create an instance of the DBEngine class before calling the CompactDatabase function.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks That Worked.
I have found DBEngine And DBEngineClass also exist
|
|
|
|
|
Hi all,
I have a form where I want to set some regions. When the mouse moves over these regions I want the cursor image to change.
My idea is to set up some rectangles and use the mousemove event (somehow) to check against the current position of the cursor.
I just want to know what properties do I need to use for this and is there a better way.
I suppose I'm basically asking how I can check if the mouse is over a certain area of a form.
Thanks in advance
Rich
|
|
|
|
|
Try override event MouseMove to get mouse position.
Or use MouseEnter, MouseHover or MouseLeave event to evulate if mouse is in or on certian controls.
|
|
|
|
|
So I've got a rectangle that defines an area. How do I then check whether the mouse position is in that area. I've tried using,
<br />
myRec.Contains ( this->MousePosition );<br />
but it doesn't seem to use the whole area. It only seems to work at a certain spot.
I'm obviously misunderstanding something.
|
|
|
|