|
The variable declaration specifies the type and the link-name of the data. You usually put declarations to header files. When a .cpp file compiles and includes a header that declares a variable then that .c/.cpp file can use the variable despite the fact that the location of the variable isn't known because it can generate code that uses the specified type as needed and the link-name of the variable is known so later you can link the generated object file of your .c/.cpp to the object file of another .cpp that actually contains the data. A variable definition specifies the type and the link-name of the data like the declaration, but it also specifies the actual location of the data. The variable is located where you put the definition. For a variable you can use only one definition in one of your .c/.cpp files, your variable will be located in the generated object file of this .c/.cpp file, but you can have many declarations in other .c/.cpp files by including in a header with the declaration to many .c/.cpp files. This way the generated object file of the other .c/.cpp files will just have a reference by name to the defined variable if you actually used the declaration where you included it.
|
|
|
|
|
int x;
int x = 5;
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
|
Hi, dear all,
I have a MFC application created in C++ 6.0, it works fine in Window XP. When run this application in Window 7, if the dialog has progressbar on it, this dialog cannot be launched, but if you remove this progressbar or for dialog without progressbar, everything is fine.
But no all Window 7 computers have this error, only very few computer have this problem.
Is there anybody having this issue? or any idea?
Thanks!
|
|
|
|
|
I've used progress bars on Win7 with no issue. What do you mean it didn't launch? Was there an error? If so, what was the error?
|
|
|
|
|
Thanks for your reply.
As I said, most of the Window 7 computers have no problem to run this application, but some did have this issue.
If the dialog has progressbar on it, when you call Dialog.Domal(), even the OnInitDialog() function is not called.
I put a messagebox at the first line in OnInitDialog() function, when I open the dialog, no any message, just nothing, no any response.
|
|
|
|
|
If the same .exe file runs on some W7 machines and not others, then the problem is clearly something environmental on the machines that fail. Check for missing DLLs on the failing machines. Or build your application with MFC and C RTL as static libraries and try it that way.
|
|
|
|
|
Thanks for you suggestion.
Yes, you are right, it's because some files are not correctly registered.
|
|
|
|
|
The OnInitDialog() occurs after the creation of a window, so there's the possibility that the creation is failing and you're not checking that. Check the return of DoModal() and GetLastError() for errors.
|
|
|
|
|
We are all familiar with the sizeof operator, but is there an operator to get the offset of a structure member within the structure?
Example:
struct SampleStruct
{
DWORD Member1;
DWORD Member2;
}
DWORD Result = offset(SampleStruct.Member2)
I need something that would work with bit fields as well.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
How about:
DWORD Result = &SampleStruct.Member2 - &SampleStruct.Member1;
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Yeah, that would work with most types, but not bit fields. It gives an error if you try to take the address of a bit field.
I was hoping that there might be an operator.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Pretty sure there's no simple operator for what you want, you're going to have to make your own.
|
|
|
|
|
Try offsetof[^].
Since bits are not addressable I don't think you will find anything for them.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard MacCutchan wrote: Try offsetof[^].
Hooray!! Thanks for that.
I'll have to compute bit fields myself.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Richard Andrew x64 wrote: I'll have to compute bit fields myself.
Emphasizing what was already said - you cannot address a bit field.
The syntax that does that in the language uses an address AND bit manipulation.
|
|
|
|
|
Yup, that was understood.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
re bit fields:
The standards (C and C++) explicitly state that the address-of & operator cannot be applied to bit fields, and consequently there are no pointers to bit fields.
Given that the layout of bit fields within some integral type is implementation-dependent, that all makes a lot of sense.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Not really anything to do with the language, more the fact that the hardware cannot do it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I'm not really sure this deserves the joke icon.
What a surprise! Language standards reflecting hardware reality!
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
No, I think the joke icon is well deserved.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
#define EA {B11110000,B01001000,B01001000,B01111000,B01001000,B11001000}
#define EB {B11110000,B01001000,B01001000,B01111000,B01001000,B11110000}
#define EC {B11110000,B10010000,B10111000,B10000000,B10010000,B11110000}
#define ES {B11111000,B10011000,B10000000,B11111000,B00001000,B11111000} // END1
#define UA {B01110000,B11001000,B11001000,B11111000,B11001000,B11001000}
#define UB {B11110000,B11001000,B11001000,B11111000,B11001000,B11110000}
#define UC {B01110000,B11001000,B11000000,B11001000,B11001000,B01110000}
#define UD {B11110000,B11001000,B11001000,B11001000,B11001000,B11110000}
#define UE {B11111000,B11111000,B11000000,B11111000,B11000000,B11111000}
#define UF {B11111000,B11000000,B11000000,B11111000,B11000000,B11000000}
#define UG {B11111000,B11001000,B11000000,B11011000,B11001000,B11111000}
#define UH {B11001000,B11001000,B11001000,B11111000,B11001000,B11001000}
#define UI {B11111000,B01110000,B01110000,B01110000,B01110000,B11111000}
#define UJ {B11111000,B00110000,B00110000,B10110000,B10110000,B11110000}
#define UK {B11001000,B11010000,B11100000,B11100000,B11010000,B11001000}
#define UL {B11000000,B11000000,B11000000,B11000000,B11000000,B11111000}
#define UM {B11011000,B11111000,B10101000,B10101000,B10001000,B10001000}
#define UN {B10001000,B11001000,B11101000,B11111000,B11011000,B11001000}
#define UO {B11111000,B11001000,B11001000,B11001000,B11001000,B11111000}
#define UP {B11110000,B11001000,B11001000,B11110000,B11000000,B11000000}
#define UQ {B11111000,B11111000,B10001000,B10101000,B10010000,B11101000}
#define UR {B11110000,B11001000,B11001000,B11110000,B11010000,B11001000}
#define US {B11111000,B11001000,B11000000,B11111000,B00011000,B11111000}
#define UT {B11111000,B10101000,B00100000,B00100000,B00100000,B01110000}
#define UU {B11001000,B11001000,B11001000,B11001000,B11001000,B11111000}
#define UV {B11001000,B11001000,B11001000,B11011000,B01110000,B00100000}
#define UW {B10001000,B10001000,B10101000,B10101000,B11011000,B10001000}
#define UX {B10001000,B11011000,B00100000,B00100000,B11011000,B10001000}
#define UY {B10001000,B11011000,B01010000,B00100000,B00100000,B01110000}
#define UZ {B11111000,B10001000,B00010000,B00100000,B01001000,B11111000} // ends here
#define BA {B01110000,B10001000,B10001000,B11111000,B10001000,B10001000}
#define BB {B11110000,B10001000,B10001000,B11110000,B10001000,B11111000}
#define BC {B11111000,B10000000,B10000000,B10000000,B10000000,B11111000}
#define BD {B11110000,B10001000,B10001000,B10001000,B10001000,B11110000}
#define BE {B11111000,B10000000,B10000000,B11110000,B10000000,B11111000}
#define BF {B11111000,B10000000,B10000000,B11110000,B10000000,B10000000}
#define BG {B01110000,B10001000,B10000000,B10011000,B10001000,B01110000}
#define BH {B10001000,B10001000,B11111000,B10001000,B10001000,B10001000}
#define BI {B11111000,B00100000,B00100000,B00100000,B00100000,B11111000}
#define BJ {B00111000,B00010000,B00010000,B00010000,B10010000,B01100000}
#define BM {B10001000,B11011000,B10101000,B10101000,B10001000,B10001000}
#define BN {B10001000,B11001000,B10101000,B10101000,B10011000,B10001000}
#define BL {B10000000,B10000000,B10000000,B10000000,B10000000,B11111000}
#define BO {B01110000,B10001000,B10001000,B10001000,B10001000,B01110000}
#define BP {B11110000,B10001000,B10001000,B11110000,B10000000,B10000000}
#define BQ {B01110000,B10001000,B10101000,B10011000,B01111000,B00001000}
#define BR {B11110000,B10001000,B10001000,B11110000,B10001000,B10001000}
#define BS {B01110000,B10001000,B01100000,B00010000,B10001000,B01110000}
#define BK {B10001000,B10010000,B11100000,B11100000,B10010000,B10001000}
#define BT {B11111000,B00100000,B00100000,B00100000,B00100000,B00100000}
#define BU {B10001000,B10001000,B10001000,B10001000,B10001000,B01110000}
#define BV {B10001000,B10001000,B10001000,B10001000,B01010000,B00100000}
#define BW {B10001000,B10001000,B10101000,B10101000,B10101000,B01010000}
#define BX {B10001000,B01010000,B00100000,B00100000,B01010000,B10001000}
#define BY {B10001000,B01010000,B00100000,B00100000,B00100000,B00100000}
#define BZ {B11111000,B00001000,B00110000,B01100000,B10000000,B11111000}
#define LA{B00000000,B01110000,B00001000,B01111000,B10001000,B01111000}
#define LB{B10000000,B10000000,B10110000,B11001000,B10001000,B11110000}
#define LC{B00000000,B01110000,B10000000,B10000000,B10001000,B01110000}
#define LD{B00001000,B00001000,B01111000,B10001000,B10001000,B01111000}
#define LE{B00000000,B01110000,B10001000,B11111000,B10000000,B01110000}
#define LF{B00110000,B01001000,B01000000,B11100000,B01000000,B01000000}
#define LG{B00000000,B01111000,B10001000,B01111000,B00001000,B01110000}
#define LH{B10000000,B10000000,B10110000,B11001000,B10001000,B10001000}
#define LI{B00100000,B00000000,B01100000,B00100000,B00100000,B01111000}
#define LJ{B00010000,B00000000,B00111000,B00010000,B10010000,B01100000}
#define LK{B10000000,B10010000,B10100000,B11000000,B10100000,B10010000}
#define LL{B01100000,B00100000,B00100000,B00100000,B00100000,B01111000}
#define LM{B00000000,B00000000,B11010000,B10101000,B10101000,B10001000}
#define LN{B00000000,B00000000,B10110000,B11001000,B10001000,B10001000}
#define LO{B00000000,B01110000,B10001000,B10001000,B10001000,B01110000}
#define LP{B00000000,B11110000,B10001000,B11110000,B10000000,B10000000}
#define LQ{B00000000,B01101000,B10011000,B01111000,B00001000,B00001000}
#define LR{B00000000,B00000000,B10110000,B11001000,B10000000,B10000000}
#define LS{B00000000,B01110000,B10000000,B01110000,B00001000,B11110000}
#define LT{B01000000,B01000000,B11100000,B01000000,B01001000,B00110000}
#define LU{B00000000,B00000000,B10001000,B10001000,B10011000,B01101000}
#define LV{B00000000,B00000000,B10001000,B10001000,B01010000,B00100000}
#define LW{B00000000,B00000000,B10001000,B10101000,B10101000,B01010000}
#define LX{B00000000,B10001000,B01010000,B00100000,B01010000,B10001000}
#define LY{B00000000,B10001000,B10001000,B01111000,B00001000,B01110000}
#define LZ{B00000000,B11111000,B00010000,B00100000,B01000000,B11111000}
#define SPACE{B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define NUM0{B01110000,B10011000,B10101000,B10101000,B11001000,B01110000}
#define NUM1{B00100000,B01100000,B10100000,B00100000,B00100000,B01110000}
#define NUM2{B01110000,B10001000,B00001000,B01110000,B10000000,B11111000}
#define NUM3{B11110000,B00001000,B00001000,B01111000,B00001000,B11110000}
#define NUM4{B10001000,B10001000,B10001000,B11111000,B00001000,B00001000}
#define NUM5{B11111000,B10000000,B11110000,B00001000,B10001000,B01110000}
#define NUM6{B11111000,B10000000,B11111000,B10001000,B10001000,B11111000}
#define NUM7{B11111000,B00001000,B00001000,B01111000,B00001000,B00001000}
#define NUM8{B11111000,B10001000,B11111000,B10001000,B10001000,B11111000}
#define NUM9{B11111000,B10001000,B11111000,B00001000,B00001000,B11111000}
#define DEVIDE{B00001000,B00010000,B00100000,B00100000,B01000000,B10000000}
#define TWODOTS{B01100000,B01100000,B00000000,B00000000,B01100000,B01100000}
#define DOT{B00000000,B00000000,B00000000,B00000000,B01100000,B01100000}
#define COMA{B00000000,B00000000,B00000000,B00110000,B00110000,B01100000}
#define LINE{B00000000,B00000000,B11111000,B11111000,B00000000,B00000000}
#define QUASTION{B01110000,B10001000,B00010000,B00100000,B00000000,B00100000}
#define MARK{B00100000,B01110000,B01110000,B00100000,B00000000,B00100000}
int latchPin = 10;
int clockPin = 13;
int dataPin = 11;
int clock = 9;
int Reset = 8;
int latchPinPORTB = latchPin - 8;
int clockPinPORTB = clockPin - 8;
int dataPinPORTB = dataPin - 8;
int i = 0;
long scrolling_word[6];
int array_turn=0;
byte your_text[24][6]={BW,BE,BL,BC,BO,BM,BE,SPACE,BH,BA,BV,BE,SPACE,BA,SPACE,BN,BI,BC,BE,SPACE,BD,BA,BY};//PUT YOU TEXT HERE
void setup(){
Serial.begin(9600);
pinMode(dataPin,OUTPUT);
pinMode(clockPin,OUTPUT);
pinMode(latchPin,OUTPUT);
pinMode(clock,OUTPUT);
pinMode(Reset,OUTPUT);
digitalWrite(Reset,HIGH);
digitalWrite(Reset,LOW);
setupSPI();
}
void display_word(int loops,byte word_print[][6],int num_patterns,int delay_langth){// this function displays your symbols
i = 0;// resets the counter fot the 4017
for(int g=0;g<6;g++)//resets the the long int where your word goes
scrolling_word[g] = 0;
for(int x=0;x
|
|
|
|
|
|
Hi,
I have a dialog box. I have created a static box on that dialog box. I want that static box should be movable after user run the application. After the dialog box displays, user should be able to move the static box.
Is it possible in a dialog based application in MFC.?
Anybody have any idea.?
Regards,
mbatra
|
|
|
|
|
it's not going to be simple, but it's totally possible.
it's going to look something like this:
void CMyDialog::OnLButtonDown(UINT nFlags, CPoint point)
{
m_bButtonDown = true;
m_startPoint = point;
CDialog::OnLButtonDown(nFlags, point);
}
void CMyDialog::OnLButtonUp(UINT nFlags, CPoint point)
{
m_bButtonDown = false;
m_endPoint = point;
ReleaseCapture();
CDialog::OnLButtonUp(nFlags, point);
}
void CMyDialog::OnMouseMove(UINT nFlags, CPoint point)
{
if (m_bButtonDown)
{
SetCapture();
m_staticControl.MoveWindow(...whatever);
}
CDialog::OnMouseMove(nFlags, point);
}
|
|
|
|
|