|
tunminhein wrote: but we didn't put anydata to last_time ?
I assumed you knew that must be done and how to do it.
"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
|
|
|
|
|
I haven't known yet how to put the previous date data to last_time.
but I tried it that u advice's coding.
here we are,
time_t osBinaryTime;
time(&osBinaryTime);
CTime now(osBinaryTime);
CString strTime = now.Format(_T("%d/%m/%y "));
CString strClock = now.Format (_T(" %H:%M:%S"));
/* CString last_time = strTime.Format (_T("%d/%m/%y "));
//
Cstring str;
if (last_time != strTime){
//m_file.WriteString(_T("\n"));
str.Format(_T("%s, %s, %s, %s, %3.0lf%%, %s , %s\n"), lesson, s, sentence, attempt, score, strTime,StrClock);
m_file.WriteString (str);
)*/
but i got error on the CSting last_time = strTime.format(_T(" %d/%m/%y"));
I'm a beginner in the MFC application. I really sorry u, if u got any inconvience.
thanks again.
|
|
|
|
|
tunminhein wrote: but i got error on the CSting last_time = strTime.format(_T(" %d/%m/%y"));
And rightly so, since CString::Format() has no return value.
"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
|
|
|
|
|
|
Hello,
i found one sample on msdn how to use Singly Linked Lists, and when i try to
build i got this error:
error C2065: '_aligned_malloc' : undeclared identifier
error C2065: '_aligned_free' : undeclared identifier
Can someone explain me how to fix this?
regards
termal
|
|
|
|
|
did you forget some of the #includes ?
|
|
|
|
|
Hello,
thanx for reply, i dont know, i copy all from this site on msdn!
My local msdn dont know this function!
regards
termal
|
|
|
|
|
OK. _aligned_malloc is a memory allocation function in the Visual C Runtime, MSVCRT*.dll.
It isn't usually called directly although I think it is exported. _aligned_free is the matching memory deallocation function. You need to check your project settings for which CLibrary/CRuntime you're using and look at the code to see whether it's using new or malloc or calloc or calling _aligned_malloc directly. Then you may need to add a #include or two. It's difficult to give you more details without knowing which Visual Studio version you're using and closely examining the sample.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hello,
thanks for assertion, i use VS6 and my sample is from msdn, link to the site is in my first post!
regards!
termal
|
|
|
|
|
Hmm I'm confused now, The message that turned up in my email is not the message you posted here?!?
Hi,
i change the original line with _aligned_malloc:
pListHead = (PSLIST_HEADER)_aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT);
to:
pListHead = (PSLIST_HEADER)malloc(MEMORY_ALLOCATION_ALIGNMENT);
and i dont have errors! [confused]
regards
termal
Anyway you'll need to change that to
pListHead = (PSLIST_HEADER)malloc( sizeof(SLIST_HEADER) );
or you certainly will get errors when you run it. The original problem may be that _aligned_malloc is no longer exported from the Visual C Runtime, or it might require you to add an addtional include over and above memory.h e.g. #include <dbg.h> from the C Library source. Either way I wouldn't recommend calling _aligned_malloc directly from your code as it's intended to be an internal function. It will get called from malloc anyway, at least in debug mode, several levels down. If you installed the C Library source code along with VC++ 6 you can step into the malloc call in the debugger and marvel at the amount of stuff that happens just to get you a few bytes of memory to play with. Enjoy.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
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.
|
|
|
|