|
Thank a lot david,
I'll try it now.
regards,
tunminhein
|
|
|
|
|
Excause me again, David
How can i get the data from excel column 6.
thanks a lot.
|
|
|
|
|
tunminhein wrote: How can i get the data from excel column 6.
Without any more data than you've provided, I don't know. I would presume in the opposite manner in which you are setting the data in column 6.
"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
|
|
|
|
|
Thanks for respone.
the following is codeing -
#include "StdAfx.h"
#include "DataCollector.h"
#include "lmcons.h" // for UNLEN and DNLEN [Dave]
CDataCollector::CDataCollector(void)
{
}
CDataCollector::~CDataCollector(void)
{
}
void CDataCollector::Open(LPCTSTR path)
{
m_file.Open (path,CFile::modeCreate | CFile::modeNoTruncate |
CFile::modeWrite | CStdioFileEx::modeWriteUnicode );
m_file.SeekToEnd ();
}
void CDataCollector::Close()
{
m_file.Close ();
}
void CDataCollector::Write(LPCTSTR lesson,
LPCTSTR sentence, LPCTSTR attempt, double score)
{
// To get user name
CString s;
DWORD userNameLength = UNLEN + 1;
TCHAR userName[UNLEN + 1]; // System user name length + 1.
if (GetUserName(userName, &userNameLength))
{
/* get network name */
// The NetApi calls are very time consuming
// This technique gets the domain name via an
// environment variable
TCHAR domainName[DNLEN + 1]; // System domain name length + 1
if (ExpandEnvironmentStrings(_T("%USERDOMAIN%"), domainName, DNLEN + 1))
{
s += domainName;
s += '-';
} /* get network name */
s += userName;
}
//create the time object
time_t osBinaryTime;
time(&osBinaryTime);
CTime now(osBinaryTime);
CString strTime = now.Format(_T("%d/%m/%y %H:%M:%S\n "));
CString str;
str.Format(_T("\n"));
str.Format(_T("%s, %s, %s, %s, %3.0lf%%, %s \n"), lesson, s, sentence, attempt, score, strTime);
m_file.WriteString (str);
}
thanks a lot
|
|
|
|
|
tunminhein wrote: str.Format(_T("\n"));
str.Format(_T("%s, %s, %s, %s, %3.0lf%%, %s \n"), lesson, s, sentence, attempt, score, strTime);
What exactly are you expecting this to do? The second call to Format() just overrides what the first one did.
In any case, you need to compare:
if (last_time != strTime)
m_file.WriteString(_T("\n"));
str.Format(_T("%s, %s, %s, %s, %3.0lf%%, %s \n"), lesson, s, sentence, attempt, score, strTime);
m_file.WriteString (str);
"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
|
|
|
|
|
Thanks a lot david
but we didn't put anydata to last_time ?
Regards,
|
|
|
|
|
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
|
|
|
|
|