|
led mike wrote: Why do you think you need to know "where it is"?
When you are used to one language, in order to learn a second you need to know how it compares and how it works. The English word brother has three translations in Chinese, what do I care what the other two are when I only know one? I will tell you after I go and insult somebody!
|
|
|
|
|
Ok... MFC is NOT a language. but whatever I was just wondering.
led mike
|
|
|
|
|
I did not imply that MFC was a language, and I appologise if you missunderstood. What I meant to say is somebody who is used to coding in C, then start learning the MFC side of C++, is going to be very confused. MFC does a lot of work behind the scenes, many of the functions we have come to learn and accept are no longer required. In my opinion, in order to start learning MFC 'from another language', you need to know what the 'translations' are, or what functions an MFC method is actually calling.
|
|
|
|
|
waldermort wrote: and I appologise if you missunderstood.
Nah, you did nothing wrong. It's probably me.
led mike
|
|
|
|
|
i don't really agree with your demonstration here.
MFC hides the main() function, and if it does, it is certainly for good reasons.
you don't have to know "where is" main() nor "what it does". you only have to know "where to start when using MFC"...
|
|
|
|
|
toxcct wrote: MFC hides the main() function, and if it does, it is certainly for good reasons.
That is probably true. And I would also go as far as saying that if you are using MFC then you have no need to access the main() function. But...
toxcct wrote: you don't have to know "where is" main() nor "what it does". you only have to know "where to start when using MFC"...
... if you already know what main() does, how it's used and what exactly it's purpose is. Infact if you have come to believe (not quite true I know) that every program must have a main() fuction, then you start with MFC, aren't you going to wonder WTF?
If you are starting out with MFC and C++ as a first language, then you don't need to know nor will you care. But when it's a second language you will start translating what you know into what you are learning.
|
|
|
|
|
waldermort wrote: toxcct wrote:
you don't have to know "where is" main() nor "what it does". you only have to know "where to start when using MFC"...
... if you already know what main() does, how it's used and what exactly it's purpose is.
i still don't agree. MFC provides an additional abstraction level which you don't need to "crack" at all. if you'r curious about the internal, read the docs, they're full enough. as an example, when you use a Windows API, you read the MSDN, so you know exactly how to use what or what function, right ? but do you go every time to the sources to try to understand how they coded the API ? i hope no so !
also, you know the program entry point is main(). but did you know that a program start is not really main() ? do you know all the initialisations the operating system does for you silently ?
|
|
|
|
|
toxcct wrote: i still don't agree.
Each to their own I suppose. MSDN has a wealth of info, so I agree, there is no need to go to the sources. But understanding what is going on under the hood, in a way that you are used to, is helpful to learning. I'm not saying you must know what is happening behind the scenes, but if you already know and simply don't understand whats in the foreground, don't you think you would learn it a hell of a lot faster by knowing what functions the wrapper is calling?
toxcct wrote: also, you know the program entry point is main(). but did you know that a program start is not really main() ? do you know all the initialisations the operating system does for you silently ?
I did mention that in my post, perhaps you missed it
|
|
|
|
|
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)<br />
<br />
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPCSTR lpCmdLine, int nCmdShow)
The first works along side TCHAR and is able to switch between UNICODE and ANSI, look at the LPCTSTR. The second will only work with ANSI builds.
|
|
|
|
|
Have you looked in ...\Microsoft Visual Studio\VC98\MFC\SRC\Winmain.cpp?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
your answers were so helpful. yes, _tWinMain() is same as WinMain(). it was define in tchar.h in include folder.
thank alot.
|
|
|
|
|
hi,
iam intersted to lear Windows CE and eVC++ plz tell which books are good to learn
|
|
|
|
|
Hi.
One can add the Tool-tips for the controls present on the Tool bar. But
How to add the Tool-tip for the Pushdown buttons present on the dialog box?
Thanks.
Rakesh
|
|
|
|
|
Rakesh_Thakur wrote: One can add the Tool-tips for the controls present on the Tool bar. But
How to add the Tool-tip for the Pushdown buttons present on the dialog box?
Hope this[^] helps.
|
|
|
|
|
You need to create tooltip and set TOOLINFO and Send TTM_ADDTOOL
|
|
|
|
|
hi;
i'm using dynamic c to program a rabbit IC
in my program i use rtc, the real time clock, but reasently we all changed form summer to winter time, and i thought that the rtc changed allong with my pc when i would compile and download it again but it doenst.
How do i change this, and not by just setting the hour myself everytime i download it, like in a sample of dynamic c manual
anybody an idea??
thx alot
grz muk
|
|
|
|
|
There are plentry of time functions here. I suggest you code up a little demo application to see how they all work.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi, all
i use
CString strString;
char *charstring = (char *) (LPCTSTR)strString;
to convert CString to char*. Run normal in NON UNICODE
but, i want to convert CString to char* in UNICODE, convert is not good.
How to convert? please, adv me.
Thanks for reading.
Huynhnb
.: Your success is also mine :.
|
|
|
|
|
huynhnb wrote: CString strString;
char *charstring = (char *) (LPCTSTR)strString;
!!
That's not good!!
Do this instead...
#include <atlconv.h>
USES_CONVERSION;
char *charstring = W2A(( LPCTSTR )strString ); Hope this helps.
|
|
|
|
|
Hello,
and what about CString::GetBuffer(int iLen);? Can this help?
regards
|
|
|
|
|
Hello,
Sorry, may I suggest you to use a bit better code:
USES_CONVERSION;<br />
char *charstring = T2A(( LPCTSTR )strString );
It works both in UNICODE and Multi-byte Char mode
ISerik
|
|
|
|
|
First of all, your string will have to be composed of ASCII chars.
Do a CString to WCHAR* in uniocode.
Then take every second byte from the WCHAR and put it into a char array.
This is because in memory a UNICODE string of ASCII chars looks like:
00 66 00 61 00 74 00 5F 00 62 00 6F 00 79 00 00
Note it is double null terminated when seen as a byte array string.
This text, when put into a char aray looks like:
66 61 74 5F 62 6F 79 00.
Which is:
fat_boyNULL
Truth is the subjection of reality to an individuals perception
|
|
|
|
|
Hello Comunity,
how to read content of an *.exe file, i use CFile to read and put the content in an CString,
but the CString::GetLength() returns a less character number as i read?
So i read 24576 chars from a file in to CString and this CString returns only 140 chars with GetLength()!
<code>
CFile pFile;
pFile.Open(csFileName, CFile:modeRead, &e)
...
while(0 != (uReadBytes = pFile.Read(acBuffer, 1024)))
{
acBuffer[uReadBytes] = '\0';
csFileContent += acBuffer;
acBuffer[0] = '\0';
uFileSize += uReadBytes;
}
int iLen = csFileContent.GetLength();
now how to open and read an exe?
regards
break;
|
|
|
|
|
break; wrote: So i read 24576 chars from a file in to CString and this CString returns only 140 chars with GetLength()!
Exe files can contain non printable characters. Don't trust CString to do the job for you. CString can only handle a null terminated string hence the invalid length returned.
You need to handle the data as a byte array. Take a look at CByteArray or simply create an array of bytes.
|
|
|
|
|
Hello Thomas,
thank for answer!
you mean something like this:
char acContentBuffer[100000];
FILE* pFile;
pFile = fopen(m_csExeFile, "r");
int i = 0;
char ch;
while(EOF != (ch = getc(pFile)))
{
acContentBuffer[i++] = ch;
}
acContentBuffer[i] = '\0';
break;
|
|
|
|