|
Did you remember to end your struct definition with a ';'? Also, there's a shorthand method to declaring structs like that:
typedef struct _X_PStruct{
...
} X_PStruct, *X_P;
X_PStruct MyStruct;
X_P pMyStruct;
One last thing, there's nothing called Create() that you can call like that (at least that I remember ).
|
|
|
|
|
Sorry, that was typo that I left ";" when I was typing this question. Create() is a function that I created that has a return type struct X_Pstruct
|
|
|
|
|
Oh ok, that makes more sense...
|
|
|
|
|
Post the line of code where the error occurs.
Post the entire func1 if possible.
Are there any other errors or warning before the line that you mention?
|
|
|
|
|
Hello All
I know signed on user name and i provide the user an edit box to enter the corresponding password.
Now is there a way to validate it?
Regards
|
|
|
|
|
Take a look at the LogonUser()[^] API.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
|
Hi
i am using this control in my Application, There i don't have enough horizontal space show entire link. i wanted show that link in multiline.
Is it possible?
|
|
|
|
|
I've not used this control and so I'm not sure if there is a separate URL and Text property.
If there is you could put a \n or \r\n within the Text to split it in 2 lines.
|
|
|
|
|
Hello every one
I am working in mfc application in which I want save file name in unocode format. That means if I save file other that english then application gets crashed.. plz help me
here is my code... throgh which applicayin cant crashed but file name shows garbage value
CT2W pszConvertedString(_strPath,CP_UTF8);
CW2A pszConvertedAnsiString(pszConvertedString,CP_UTF8);
std::string strFileName(pszConvertedAnsiString.m_psz);
std::fstream outputFileStream;
outputFileStream.open( strFileName.c_str(), std::ios_base::out|std::ios_base::binary );
|
|
|
|
|
Did you look at the call stack? Where exactly does the crash happen?
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
it goes ???? instead of string..
Crash could be solve by given code but proper name cant be showin... it shows garbage value
|
|
|
|
|
Start watching the string under your debugger, and find out at which step the value garbles. That might give you a lead.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
Try using the std::wstring and std::wfstream classes.
|
|
|
|
|
Spot on! High vote offered.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
Thanks Rajesh!!! You're too kind...
|
|
|
|
|
Hello
I have the following question.
I am new at MFC (I am using it with VC ++ 6.0).
I am trying to create a very simple window with a PushButton on it, supposed to activate a messagebox whenever it's clicked.
The wizard set the application with a MainFrame class, a View derived class, a Doc derived class (it's a SDI) and the usual App class.
On my behalf I added a simple CButton derived class.
This class has a constructor which receives the button's coordinates, calls the base constructor CButton () and then the Create () method on those coordinates.
I instantiate the button derived object on the InitInstance() method of the App derived class.
This object is a heap object , so I first declare a pointer and then call the contructor with some coordinates.
The pushbutton appears regularly, but when it comes to managing the BN_CLICKED event,things begin to get confusing.
I added the ON_BN_CLICKED () macro to the parent window's message map (which is the View class object), as MSDN suggests, and gave it my personal message handler's overload.
Well it seems that the BN_CLICKED event is never triggered : all I can detect is WM_LBUTTONDOWN
which I can manage, but the problem is, this event is triggered whenever I click on the window, no matter if I click on the button or not.
My question is : why does MSDN state that BN_CLICKED is triggered when a push button is clicked ? What can I do to get that event triggered and possibly managed ?
To avoid misunderstandings, I want to make it clear that I am NOT using a pushbutton in a Dialog , but right in a main window.
Thank you
|
|
|
|
|
Have you set the button's parent CWnd to the same window that has the message map?
The best things in life are not things.
|
|
|
|
|
Yes Richard.
Though it wasn't clear at the beginning which one it was, since i had no pointer to the single objects , I figured out it was the MainFrame window object created by te wizard since it's the only one which seems to receive the WM_LBUTTONDOWN when I click the mouse.
I don't know if it is important but, peeking the system messages with Spy++, I couldn't see any BN_CLICKED , when instead I was seeing a lot of BM_SETSTATEs .
|
|
|
|
|
You say its parent is the MainFrame but your message map entry is in your view; I suspect this may be wrong. Also note that BN_CLICKED [^] is a notification not a message, and gets sent to your application via a WM_COMMAND message.
The best things in life are not things.
|
|
|
|
|
This is something I am confused about : I see the only message I get is intercepted by the view object /message map but, inquiring the start of the application with the debugger, I came to the comclusion that the only window pointer that the wizard makes available in the application source is the MainFrame's one : I maybe wrong on this but I suspect it creates the CThread object for the current thread, then derives a CApp object from the Cthread class , and then it assignes the m_pMainWnd pointer of the CThread object to the CApp object , then assignes this one to the MainFrame's object.... following all thisnon the debugger is not the best so I could have misunderstod many things ....
I couldn't find any other window pointers related to the Doc, View , and user App objects.
|
|
|
|
|
I suspect your problem may lie with where you created your button. From your earlier description of where you want to capture the button click, I think your button should be a child of (and created in) your CView class.
This is one of the issues with using a Wizard, it is not always as flexible as you need in special circumstances. You may also like to rethink the design of your application, particularly with regard to why you want this button. Could it be replaced by a simple toolbar button?
The best things in life are not things.
|
|
|
|
|
This idea slightly surfaced in my mind, but I had rapidly dismissed it on the basis of what I had understood (if well understood) about MCF : I was convinced that the only source code I should put my hands on was the xxxApp class , but ... is it right ? Maybe not .....
Anyway, I'll try to test this : I should redesign my application creating the Push Button in the OnDraw () message handler of the View class, I suppose : right ?
Well you know , this "application" I just made out of curiosity , to skill myself , so I should try to solve as many problems as I can without totally rethinking the architecture, which is already so simple.
Thank you
|
|
|
|
|
tiwal wrote: I was convinced that the only source code I should put my hands on was the xxxApp class
No, that's probably the one class that you won't need to change very much. The majority of actual work in your application will be done, first in the CDocument class, which handles the data that you are to process, and second in your CView class where your data will be presented to the user. Outside these two classes there is only a small bit of administration to link things together.
tiwal wrote: creating the Push Button in the OnDraw () message handler of the View class
I don't think so! The OnDraw() handler should only be concerned with rendering your data onto the view for the user to read. If you need to have a button on your view then you should make it a member of your view class and create it in the OnCreate() function of the view class.
It is probably worth looking for some introductory MFC articles to get a feel for how these classes fit together, and what each should do during the life of the application.
The best things in life are not things.
|
|
|
|
|
You were right Richard ... now it works perfectly !!
So my mistake was in thinking that all I should modify was the CApp derived class.
Thank you for your precious support, you really dragged me out of a mud pond .....
greetings and regards,
Leo
|
|
|
|