MFC question

T

Tadeusz Jordan

Hello. I am trying to learn MFC but here is the question for which I was
unable to find the answer. Given this class definition:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
What does it exactly do? CMainFrame derives from OnCreate class? What do
arguments of the OnCreate class do?
I would appreciate any help.

Sincerely,

Tadeusz
 
K

kingfox

Hello. I am trying to learn MFC but here is the question for which I was
unable to find the answer. Given this class definition:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
What does it exactly do? CMainFrame derives from OnCreate class? What do
arguments of the OnCreate class do?
I would appreciate any help.

Sincerely,

Tadeusz

You should post this topic to a MFC group: microsoft.public.vc.mfc
 
P

Phlip

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
You should post this topic to a MFC group: microsoft.public.vc.mfc

In this case, the original poster should back off of MFC and then learn C++
from scratch. Nothing in the MFC documentation will assume you don't know
C++. Write simple console programs first...

....or switch to a softer language, such as HTML or Visual Basic, if you just
want to create a window with some buttons on it.
 
M

Massimo

Tadeusz Jordan said:
Hello. I am trying to learn MFC but here is the question for which I was
unable to find the answer. Given this class definition:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
What does it exactly do? CMainFrame derives from OnCreate class?
What do arguments of the OnCreate class do?

You should *definitely* learn C++ before trying to learn MFC.
An then, you really shouldn't be learning MFC, as it's quite an obsolete
technology; there are much better ones around now.

Anyway, "int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)" means
that's the OnCreate() method of the CMainFrame class, and it takes a
LPCREATESTRUCT as its first and only argument, returning an int upon
completion.


Massimo
 
M

Massimo

Anyway, "int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)"
means that's the OnCreate() method of the CMainFrame class, and it takes
a LPCREATESTRUCT as its first and only argument, returning an int upon
completion.

Addendum: based on the Hungarian notation which is often used in Windows
programming, I can guess LPCREATESTRUCT is a Long Pointer (LP) to a
CreateStruct data type; so it's probably a pointer to a library-defined data
structure you must supply in order for the method to use it.
That "OnCreate()" is definitely *not* a class definition: it's the
implementation of a method declared in the class CMainFrame, which, I'm
again guessing, is a user-defined frame class, derived from some kind of
super-frame-class declared in the MFC library.


Massimo
 
B

Branimir Maksimovic

Hello. I am trying to learn MFC but here is the question for which I was
unable to find the answer. Given this class definition:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
What does it exactly do? CMainFrame derives from OnCreate class? What do
arguments of the OnCreate class do?
I would appreciate any help.

Sincerely,

Tadeusz

I don;t know MFC (don't have high opinion on that library),
but I know winapi.
OnCreate is probably member function that is called on window
creation.
lpCreateStruct is probably pointer to structure that is passed to
message
handler on WM_CREATE message in lparam parameter. (mfc probably
casts that one for you and calls yours OnCreate function
from it's handler).
For details on structure and how and when it is passed ,
check msdn docs for CreateWindow function and
CREATESTRUCT structure.

Greetings, Branimir.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,212
Latest member
SteveMagga

Latest Threads

Top