|
Oki, have gotten around the warning dialogue using this class. But the fact that the button still not can be presses is bugging me. Must be a way to press it since there are comercial products out there that does just what I wanted to do, more ideas please
|
|
|
|
|
|
Symantec apparently has a nice library of controls. I've alway likes their UI. I personally
can't stand UI coding so I'd sure like to use their code
Sorry, what was your question again?
Mark
|
|
|
|
|
In VC++, for following program,
class A
{
int a;
char b;
};
void main()
{
A a;
cout<
|
|
|
|
|
because the members are alligned on the size of the bigger member...
|
|
|
|
|
In order to acheive 1Byte alignment,try the following :
#pragma pack (1)
class A
{
int a;
char b;
};
#pragma pack (1)
Eli
|
|
|
|
|
this shouldn't be done unless you are on a very specific requierement (and plateform).
if you have to save some memory from the object size, better rearrange the members order first.
|
|
|
|
|
Hi toxcct ,
toxcct wrote: this shouldn't be done unless you are on a very specific requierement (and plateform).
It's correct , but from his question , i think that he ment that the data
should be 1Byte aligned.
toxcct wrote: if you have to save some memory from the object size, better rearrange the members order first.
It is not always possible (for example if you got an ICD of another
machine and you need to "Speek" with the same language of that machine -
you can't change the members order ).
Regards,
Eli
|
|
|
|
|
It is called padding - the size of the structure is padded with empty space to optimize its access. A 32-bit system moves data in 32-bit chunks faster than data that is not sized at 32-bits.
Note tha packing may also impact the size of the structure - structure members are normally aligned in order to optimize their access (non-aligned access is allowed x86 architecture, but it takes a performance hit). 32-bit values are aligned to start at a 32-bit boundary, 16-bit values are aligned to a 16-bit boundary, etc. by moving the start of the structure in memory so that it lies on its natural boundary (32-bit boundary, for example).
struct STest
{
DWORD m_dwValue;
char m_cValue;
};
struct STest2
{
DWORD m_dwValue;
char m_cValue;
int m_iValue;
};
struct STest3
{
DWORD m_dwValue;
short m_siValue;
char m_cValue;
};
The sizes of the structures (with default 32-bit padding) are 8 , 12 and 8 bytes, respectively, and are layed out in memory as follows:
FF FF FF FF 61 <code>CC CC CC</code>
FF FF FF FF 61 <code>CC CC CC</code> 11 00 00 00
FF FF FF FF 12 34 7A <code>CC</code> Bold ed bytes are the padding/packing bytes.
When laying out the order of members in a structure, if you place them so that they are more likely to fall on their natural alignment, you can reduce the footprint of the structure.
You may have to force the packing of a structure when sharing serialized (saved to some medium) data between two different applications/systems, like when sending data over a socket to a server - both systems have to agree on the packing/padding of the data in order to read it correctly.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hello, I have a problem that I simply can't solve on my own.
Background:
I have a single document MFC application where the user may doubleclick on a piece of text and thereby call forth a dialog window for editing the text. That text is displayed in a Static text box. If I make a change to the text I can use Ctrl+Z or Ctrl+Y to Undo/Redo and that is great but some users do not know all short-commands so I also want to make an Undo button and a Redo button to do the exact same things. Outside the dialog in my application the accelerators Ctrl+Z and Ctrl+Y are tied to my own-defined Undo/Redo functions that are specific to my application so how do I find out what events the Ctrl+Z and Ctrl+Y accelerators in the dialog triggers?
Problem:
Since Ctrl+Z/Ctrl+Y works in my dialog although they are not defined in my IDR_MAINFRAME Accelerators they must obviously be connected to functions that are specific for performing Undo and Redo in a Dialog window. How do I connect those functions to two Undo Redo buttons as well?
Visual Studio version:
Microsoft Visual Studio 2003
|
|
|
|
|
The standard edit control has its undo/redo functionality built it, just as the Rich Edit control does - you do not really have to do anything to and you get it for free.
You can implement the button handlers so that they send EM_UNDO messages to the edit control. Lookup the EM_UNDO message for more details.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks a bunch, that was just the info I neeeded!
|
|
|
|
|
How can i hide from user my "h" files and "cpp" files ?
I have a visual c++ 6.0 project , CDialog base aplication what can i do ?
Bravoone
|
|
|
|
|
i don't understand...
who is the "user" ?
a user of the application, or another developper that will have to use your code, but whom you want to hide the implementation details ?
|
|
|
|
|
a user of the application!
Bravoone
|
|
|
|
|
so, how could a user of the application get your source files (.h and .cpp) ???
do you used to distribute them with your exes ?
|
|
|
|
|
THIS IS MY QUESTION what can i do to hide my files from the user ?
Bravoone
|
|
|
|
|
you don't have to !!! where would he get them from ?!?!
and you didn't answer mine : do you used to distribute them with your exes ?
if yes, i really don't understand why ! an exe is standalone (regarding of the source codes)
|
|
|
|
|
please can you tell me more ... what files i must distribute for user ?
Bravoone
|
|
|
|
|
|
ok ! i glad you enjoy but this not help me !!!
what files? "obj","sbr","rc" ?
Bravoone
|
|
|
|
|
.exe !!! unless you don't build for Windows plateforms ?
dude, what files do you double click on when you start a program ?
seriously, are you on drugs ? or why are you so lost ?
oh, i forgot to say ; to have the exe, you must Build the solution (in release mode, it's better for a final delivery)
|
|
|
|
|
i now but not all CDialogs are displayed just the first CDialog the second the aplication will exit;
Bravoone
|
|
|
|
|
Dude, that's enough !
now if you have a problem, stop posting a single sentence question. write the whole problem ; explain in details what you have, what you already tried, where it issues...
we're not geniuses and we cannot guess what you're doing wrong if we have no cards to play with.
|
|
|
|
|