|
Hello,
yes you have right, i delete my previous message because is wrong, i change it like you said!
regards
termal
|
|
|
|
|
To use _aligned_malloc() with Visual Studio 6 you will need to download and install the Microsoft Platform SDK.
http://www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB[^]
Side Note: The aligned memory allocation functions are generally used for optimizing memory for MMX/SSE/SSE2 instruction usage. Although the standard size of a register is 32 bits (on 32 bit processors), not all registers are 32 bit sized. MMX registers are 64 bits wide and SSE registers are 128 bits wide. When moving, modifying or copying memory the operations are much faster when the data in memory is aligned on these boundries. Hope this helps.
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
Hello Randor,
yes that help's me, i dont know that before!!!
With best regards
Termal
|
|
|
|
|
Hi
In my Modal dialog besed page. I am making a Tab control three page
but when i compile and build this application four button at the buttom of the each page display ( named Ok,Cancel,Apply,Help) . Now According to my
program requirment i need to defined action for each page .
How can i remove all four button. OR
Is it possible the there would be only two button named save and cancel and
Save button behave differently for each page.
The coding for that three page is below.
CPropertySheet property(" New Student...");
CStudentGeneral st_gen;
CStudentFee st_fee;
CStudentAdditional st_add;
property.AddPage(&st_gen);
property.AddPage(&st_add);
property.AddPage(&st_fee);
if(property.DoModal() == IDOK)
{
}
Regard's
Kaushik
|
|
|
|
|
Following code should help -
property.AddPage(&st_fee); //Your code.
property.m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;//To remove Apply and help button.
property.SetFinishText("Save");
|
|
|
|
|
Thanks for reply
Sir ji if i apply your code an error occur
error C2065: 'PSH_NOCONTEXTHELP' : undeclared identifier
I want to remove all button from here.
Regard's
Kaushik
|
|
|
|
|
I am sorry, it was for version 5.80.
To remove all buttons, use SetWizardButtons(0);
and it should work. Good Luck 
|
|
|
|
|
Thanks sir
Regard's
Kaushik
|
|
|
|
|
Is your sheet a wizard (i.e., have you called SetWizardMode() )?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You can set a parameter that says which page is opened. Then switch the funcionality of your button according to the sheet.
Or
you can make more buttons (one per sheet), put specifical code in every button, and make them visible/invisible according to the actual sheet.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
In the sheet's OnInitDialog() method, you can move and hide any of the four buttons. For example:
CWnd *pWnd = GetDlgItem(ID_APPLY_NOW);
ASSERT(NULL != pWnd);
pWnd->ShowWindow(SW_HIDE);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
As I mentioned in another message, I have to connect my program with a PLC of Siemens. I have found a quite good DLL to do that. Now I'm reading the documentation and the examples that come with the DLL, but there are somethings that I don't understand very well and the help/tutorial is supposing a high level in plain C (that I don't reach
My programm is made in VC++ 6.0, I would like to have some explanations about the following things and to know if in VC++ 6.0 are needed these commands/prerrogatives.
In the header file
1)
#if defined( _MSC_VER ) && _MSC_VER > 600
#pragma pack( push, 1 )
#else
#pragma pack( 1 )
#endif
2)
#if defined( _MSC_VER ) && _MSC_VER > 600
#pragma pack( pop )
#else
#pragma pack()
#endif
These 2 blocks mean that depending on the version the parameters of those functions are different. I have taken a look in the help but I have not understood it well.
MSDN says:
push (optional)
Puts a specified packing alignment value, n, on the internal compiler stack, and sets the current packing alignment value to n. If n is not specified, the current packing alignment value is pushed.
pop (optional)
Removes the record from the top of the internal compiler stack. If n is not specified with pop, then the packing value associated with the resulting record on the top of the stack is the new packing alignment value. If n is specified, for example, #pragma pack(pop, 16), n becomes the new packing alignment value. If you pop with identifier, for example, #pragma pack(pop, r1), then all records on the stack are popped until the record with identifier is found, and that record is popped and the packing value associated with the resulting record on the top of is the stack the new packing alignment value. If you pop with an identifier that is not found in any record on the stack, then the pop is ignored.
But... wtf does it mean?
In the *.cpp
1) #define WIN32_LEAN_AND_MEAN // we don’t need all specifications
2) __cdecl
A decent explanation will be very wellcome.
Thanks
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
this 2 block will delimit every 1-Byte-aligned structs/classes/unions between the pack and the pop .
the subtlty is in the syntax understood by the compiler.
#if defined( _MSC_VER ) && _MSC_VER > 600 searches if the version of the compiler is higher that Visual C++ 6. if so, it tells to the compiler to user the 1 byte alignment with #pragma pack( push, 1 ) . but it the compiler is more recent #pragma pack( 1 ) is sufficient. Same applies to the #pragma pop syntax.
you have to know that the compiler manages such alignments with a stack of integers. the current alignement is the integer at the top of the stack. but at any time, you can add a new value (push), or remove some (pop)...
|
|
|
|
|
Hi toxcct,
First of all... Thanks for your answer.
But the problem was not with the version of compiler.
The things that I didn't understand are the pragma pack (...), the WIN32_LEAN_AND_MEAN and the __cdecl
Anyways thanks.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
as explained in the MSDN, "When WIN32_LEAN_AND_MEAN is defined, a large number of header files are deliberately excluded by windows.h". read here[^] for a short brief.
for the __cdecl, this is what we name a "calling convention".
a calling convention is for the compiler to which of the caller or the callee is to clean the call stack.
I explain myself. when you call a function, a call stack is implicitely created to push the parameters and some extra informations such as the execution pointer. but once the function called ended its process, the memory then allocated has to be freed. such a memory can me cleaned by either the caller or the callee, but the important point here is that BOTH must accort themselves to use the same convention (imagine the leak if none is freeing the memory, or the disaster if both are cleaning a one and only memory place).
that is, several calling convention exist such like __cdecl, __stdcall, __fastcall, __thiscall...
google/MSDN can help you more than me for sure.
|
|
|
|
|
I already was tin MSDN and didn't understand it well. With your explanation I can now imagine some things. I will make my own try-errors to check if I have got it. Thanks
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Are you not understanding stacks (e.g., pushing and popping), or byte alignments?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Also...
In a simple mode with a comparison: The stack is a box with two doors, where the allocation of the memory are packets incoming through the "push" side, then the cpu use the info that is inside (like toxcct said, the pointer to an application that is running to have access or communication). Once the information is not needed anymore, then the box is discharged through the "pop" side to let the box containing new usefull things. If the box is overloaded, an error comes and the things doesn't work fine anymore.
about the bytes alignment... Maybe is a problem of language, but I can not relate the term with anything logical.
For me is like:
----Byte----
----Byte---- They are aligned
-Byte-------
------Byte-- They are not aligned
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Using your analogy, a stack would only have one door, whereas a queue would have two doors. A stack gets items pushed and popped from the same end. A queue gets items pushed onto one end and popped from the other end.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Ahmm, ok
then it can happen like in the step7. If one programmer opens/calls a lot of different functions/processes, without closing the previous ones... there must be a moment where the stack overflows and then the programm/cpu crashes.
What about the bytes alignment? Was I right?
What I still don't understand (sorry if I ask a lot) is what a relation has the alignment of the Bytes with the question of the stack.
If the Bytes of a stack are pushed and popped through the same entry... with what should to be aligned?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
You seem to be confusing structure alignment (the byte packing stuff) with stack operations.
The #pragma pack(n) preprocessor directive specifies packing alignment for structure and union members. For example, for n having a value of 1, 2, 4, 8, or 16, each structure member after the first is stored on the smaller member type or n-byte boundaries.
Each occurrence of #pragma pack (push) stores the current packing alignment on an internal compiler stack. Each occurrence of #pragma pack (pop) retrieves the value at the top of an internal compiler stack and makes that value the new packing alignment.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes I was mixing concepts.
Thanks, I don't understand it perfect, but more than before. This is in a level higher than mine. But at least I can now read the info without thinking is written in japanese :P
Thank you both
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I have created a custom control which contains two buttons. I want these buttons to display the same arraows which are displayed on a scrollbars buttons. So, I create a font using the Marlett face name and instruct the button to use this font via WM_SETFONT. I also set the buttons text to "3" 4, 5 or 6 ( which maps to the arrows ). But the button still displays the number instead of the arrow. The marlett font doesn't contain any ASCII characters, it's all pictographs!
I have verified that the button is using the font via WM_GETFONT. Everything appears to be correct except that the arrows are not being displayed. Any clue as to what's gone wrong?
HFONT hFont = NULL;
hFont = (HFONT)SendMessage( m_hButtonUp, WM_GETFONT, 0, 0 );
if ( ! hFont )
hFont = (HFONT)GetStockObject( DEFAULT_GUI_FONT );
if ( ! hFont )
hFont = (HFONT)GetStockObject( ANSI_VAR_FONT );
if ( hFont )
{
LOGFONT lf;
GetObject( hFont, sizeof( LOGFONT ), &lf );
_tcscpy_s( lf.lfFaceName, LF_FACESIZE, _T("Marlett") );
hFont = CreateFontIndirect( &lf );
SendMessage( m_hButtonUp, WM_SETFONT, (WPARAM)hFont, TRUE );
SendMessage( m_hButtonDown, WM_SETFONT, (WPARAM)hFont, TRUE );
SendMessage( m_hButtonUp, WM_SETTEXT, 0, (LPARAM)_T("3") );
SendMessage( m_hButtonDown, WM_SETTEXT, 0, (LPARAM)_T("4") );
}
Waldermort
|
|
|
|
|
The returncodes of the SendMessage() and try an Invalidate() of the controls
Greetings from Germany
|
|
|
|
|
SendMessage( m_hButtonUp, WM_SETFONT, (WPARAM)hFont, TRUE );
Have you checked the return value ? I mean has the font got set ? If not, check using different fonts like arial etc.
|
|
|
|
|