|
see this link
http://www.codeproject.com/buttonctrl/cbuttonst.asp
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
aoa
well i have i CDocument class and it has a member CString m_Name.
i want to attach this doc to two views,one is the CEditView n the other is a CForm view so that on pressing a toolbar button both of the views appear so that both can access m_Name.....
THANX
|
|
|
|
|
Whats stopping you?
I assume you created your 2nd View class through the wizrd or add class, and have both assigned to the same document.
This means there both have access to CDocument& pDoc.m_Name
We do it for the joy of seeing the users struggle.
|
|
|
|
|
Hi! friends,
I m developing an Image editor for a scanner. After processing the image, the user can view the same with other application like MSWord, MSPaint, POWERPOINT etc. So please give me some suggession how to do that. Currently i m creating a process with that EXE and passing the image file name ascommand line parameter but the problem is it is displaying as ascii text. Please help me out in this regard.
Thank you very much in advance...
Debabrata Debnath
Senior software engineer,
India
|
|
|
|
|
If you do a commandline 'excel myface.gif' (or what ever drawing format you are using) each of my office things opens them correctly. So, are you correctly passing the file extension? The other reason then should be your image file itself, perhaps a corruption from the normal file coding that your own program forgives?
We do it for the joy of seeing the users struggle.
|
|
|
|
|
Oh dear, you are right. I just had a go with a Word2000 and it seems that all of the commandline options have gone except that it assumes what ever is on the commandline is a filename. Even then it takes no account of the file type. Sorry.
I haven't actually done much app-app communications of this kind but I suspect you may have to use the ole interface. I'm afraid I'm not the best person to help you with that.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
I have a string formatted as such:
"The last word is \ggreen"
I want to place this text in a Rich Edit Control, replacing '\g' with the change of color to green. At the moment I'm thinking of making a loop to cycle through the string placing each letter in one at a time and changing the default color when \g is encountered. This seems grossly inefficient, is there a better way to do it (Escape codes ala DOS??)
- X
|
|
|
|
|
I'm not sure how much better a solution this would be but here goes, you could try searching for the '\g' and place everything previous to it into the control, then change the colour and then place the rest of the text. I think this would be more efficient because it would then only require the rich edit control to call your EditStreamCallback function twice in the case of your sample string (as opposed to the 20 odd calls it that would be required if you did it character by character).
Just a thought...
Ben Burnett
"It's all absolutely devastatingly true -- except the bits that are lies"
- Douglas Adams
|
|
|
|
|
- I use a static data member of a class. But the following codes have an error and a warning,
"C:\TestConst\TestConst.cpp(8) : error C2057: expected constant expression
C:\TestConst\TestConst.cpp(8) : warning C4200: nonstandard extension used : zero-sized array in struct/union"
- I do not know why.
(Such are my codes.)
#include "iostream.h"
class a{
private:
static const int s ;
int i[s];
};
const int a::s=20;
void main()
{
cout<
|
|
|
|
|
Maybe the compiler is trying to allocate memory for i[s] before it reachs the const a::s=20; line, causing an error because s would equal 0.
Hope this helps
- X
|
|
|
|
|
- Thanks pal!
- Your reply helps a lot. I still have a question. Another pal says, "the variable is a constant the compiler knows the value at compile time". I do not know what is meaning.
- Can you help?
- Regards,
Maer
|
|
|
|
|
I know constants in VB are known at compile time, but these are equivalent to #define's in VC. The const keyword means that the variable cannot be altered during the execution of the program.
- X
|
|
|
|
|
- Thanks pal!
- Your reply helps a lot. I still have a question.
- Can "const" and "static" use together? (Like, const static int s=10; )
- Can you help?
- Have a nice weekend,
Maer
|
|
|
|
|
Hello
I tried the following code using GNU C++ compiler on Linux [Debian 2.2]
It compiled and ran fine
#include "iostream.h"
class a{
public:
static const int s ;
int i[s];
};
const int a::s=20;
void main()
{
cout<<sizeof(int);
cout <<"\r\n";
cout<<sizeof(a);
cout <<"\r\n";
cout<<a::s;
cout <<"\r\n";
}
Sonork ID 100.9786 voidmain
|
|
|
|
|
- Thanks pal!
- Have you tried with VC++ 6.0? It do have problems.
- Can you help?
- Regards,
Maer
|
|
|
|
|
You have used integer array as an data member in the class.Memory is allocated to the array at compile time itself.So arrays always want constant expression.So it gives an error.
Hope this helps....
|
|
|
|
|
Since the variable is a constant the compiler knows the value at compile time. Therefore it's ok to use a const variable to declare a non-dynamic array. Anyway, here is what you can do...
#include "iostream.h"
class ClassA
{
private:
const static enum { s = 20 };
int i[s];
public:
int Func(int n);
static int StaticFunc(int n);
};
int ClassA::Func(int n)
{
return ClassA::s + n;
}
int ClassA::StaticFunc(int n)
{
return ClassA::s + n;
}
void main()
{
cout << sizeof(int) << endl;
cout << sizeof(ClassA) << endl;
cout << ClassA::StaticFunc(1) << endl;
ClassA a;
cout << a.Func(2) << endl;
}
It's not necessary to specify ClassA:: before the variable name (s) in the class member functions, but I like it this way
Sprudling
|
|
|
|
|
- Thanks pal!
- Your reply helps a lot. I still have a question. What means "variable is a constant the compiler knows the value at compile time" in your reply?
- Can you show me an example?
- Regards,
Maer
|
|
|
|
|
Actually memory for the array isn't allocated at all since the class is never instanciated.
But the forward reference for the value of s does make it impossible for the compiler to lay out the class structure fully until the reference is satisfied. It's just being a lazy compiler.
|
|
|
|
|
- Thanks pal!
- Your reply helps a lot. I still have a question. Another pal says, "the variable is a constant the compiler knows the value at compile time". I do not know what is meaning.
- Can you help?
- Regards,
Maer
|
|
|
|
|
- Thanks pal!
- But I think the error occurs with the statement "const int a:: s=20; "
- Do you agree with me?
- Can you help?
- Regards,
Maer
|
|
|
|
|
Anyone know how I can find what the size of the current cursor is?
Thanks
Jeremy Davis
http://www.astad.org
|
|
|
|
|
use GetSystemMetrics with SM_CXCURSOR,SM_CYCURSOR
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
It is possible to export functions from an exe, to be used by another process, so that the exe functions a bit like a DLL? I want one file which can be run directly and also used from another applciation. Is this possible?
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
COM is the standard way to achieve this.
Michael
|
|
|
|