|
pther wrote: But when i try this on SDI Application it does not work.
What class is your view derived from?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
are there cases where we should write our own copy constructor and assignment operator overloading in the class?
Thank you.
KIRAN PINJARLA
|
|
|
|
|
Please refer this[^].
When you have atleast a single member varibale as a pointer variable.
Regards,
Paresh.
-- modified at 8:15 Thursday 19th April, 2007
|
|
|
|
|
If your class have member variables that are pointers and/or allocate memory, you have to write a copy constructor and assignment operator. Probably even a "== " operator.
If you don't, the compiler will create those for you and they won't behave the way you want them to. It creates shallow copies, performs member wise comparison and so forth.
You can assume that you should write a copy constructor for each class you develop.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Yes. The first example that comes to my mind is for smart pointers for example. Another example would be for a string class (you need in fact to copy the contents of the char pointer, not just the char pointer itself).
|
|
|
|
|
hi
what ifdef do i need to use to run my application on desktop pc(x86 compiler) in visual studio 2005(VC++)?
my application is meant to work for both windows mobile and desktop pc.
thanks.
|
|
|
|
|
These two platforms run different versions of Windows and are not binary-compatible. In other words, you need two different .exe files, each compiled and linked for the appropriate OS. They use the same processors but the OS runtime DLLs are different and different APIs are supported.
Judy
|
|
|
|
|
i know that i'll be getting two different exe's. but i need the #ifdef for compiling under x86 platform. for windows mobile i am using #ifdef POCKETPC2003_UI_MODEL.
|
|
|
|
|
Sorry, couldn't tell how much you knew from the initial question. If you're compiling the code with any Microsoft tool, it assumes the x86 class of processors unless otherwise specified. I'm going to assume you're not asking about the define for x86 compilation but rather the define for regular desktop windows compilation versus mobile compilation. It's been a while, but last time I had a GUI that was written to compile under both VS for regular desktop and eVC for handheld (same source code files with a unique solution / workspace for each IDE), I used the handheld desktop define as the key for both situations. Stuff that was handheld only was #ifdef <handheld define> and desktop only stuff was #ifndef <handheld define> .
My memory may be faulty, but you could also try _WIN32 versus _WIN32_WINCE. I don't have eVC loaded to see if the _WIN32_WINCE is defined for all the different system selections.
Hope this answers your question, since I'm not sure exactly what you need.
Judy
|
|
|
|
|
When we inherit a class from another, as protected what happens how the protected and public members will be derived into this class.
KIRAN PINJARLA
|
|
|
|
|
see here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thank you.
KIRAN PINJARLA
|
|
|
|
|
Is it possible to learn MFC without learning or without going through Win32.
|
|
|
|
|
IMHO
MFC is a library that allow you to do a lot of things, but not all of them, yes, you can use MFC, but soon you'll be using win32 instructions and, who knows ATL or any other library that would allow you to do different things that you'll need...
hope this helps.
|
|
|
|
|
SumitMandal wrote: Is it possible to learn MFC without learning or without going through Win32
You will either pick up a lot of Win32 in the process or not learn MFC at all.
MFC ist for the most part just a C++ layer around the Win32-C API.
Failure is not an option - it's built right in.
|
|
|
|
|
Mostly likely learning C++ without going through C.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
MFC is nothing but the C++ wraper classes written over WIN 32. For example in SDK we have HWND , here in MFC we have a class CWnd . There are ready made classes and macros available for you.
Regards,
Paresh.
|
|
|
|
|
Yes.
BUT you will have to stay within the constraints of MFC structure and limitations.
if you want to do UI things that are not directly supported by MFC, then you will have to learn a little bit of Win32.
|
|
|
|
|
SumitMandal wrote: Is it possible to learn MFC without learning or without going through Win32.
Yes but IMO only if you never want to write your own code.
If you will only be using copied code you'd be ok.
In other words, you need to understand Windows programming to understand what MFC is doing.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I need to call ActiveX function from a thread so while it elaborate my app can go on.
I made my CMyThread class derived from CWinThread class, in which I and create the thread in my app when I need to call the ActiveX functions.
I have some problem:
1. In code when I need to create the Thread attach this code:
CMyThread * thread = AfxBeginThread(RUNTIME_CLASS(C4Thread));
but at compile-time it said "It's impossible to convert from 'CWinThread *' to 'CMyThread *'.
WHY this?
2. In which method of my CMyThread class I must put the code to peform (the call to the ActiveX functions) or I need to implement a new function? In thi case how?
Thanks a lot.
|
|
|
|
|
A little out of context: see this thread[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
For starters, you need something like this...
CSomeThread* pThread=(CsomeThread*)AfxBeginThread(RUNTIME_CLASS(CSomeThread));
it's much more advisable to start the thread suspended so you can prep the thread before it takes off to do work...
pThread=(CSomeThread*)AfxBeginThread(RUNTIME_CLASS(CSomeThread),
THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
// Set up the thread members (if any)
// Then call resume thread to let it loose
pThread->ResumeThread();
However, you have a slight issue with what you are trying to do. As far as I know, most ActiveX controls (if not all) expect to have a parent container so they can feed off of it's ambient properties. There are many different types of COM objects and some aren't designed to need a container. If your COM object is indeed an ActiveX control, it will likely need some sort of container to appease it. If I need to get the functionality of an ActiveX control but don't necessarily want it to show itself, I create a dummy container for it...
// Need a parent container window to host the ActiveX control.
// Make it invisible and popup
CWnd wndInvisible;
CString sWndClass=AfxRegisterWndClass(0);
if (wnd.CreateEx(0,sWndClass,NULL,WS_POPUP,CRect(),NULL,0)) {
// Use the dummy CWnd as a container for the control
}
|
|
|
|
|
Sorry, I want to say that I try your second solution...
I don't have access to the source code for the ActiveX, so I try the UI-Thread.
I try to explain my problem: on my thread I must fill a grid control (the ActiveX) and while this i need to refresh a progress bar.
This is the code I use:
Start the thread in which I'll fill the grid
C4ThrGrid * thread = (C4ThrGrid *)AfxBeginThread(RUNTIME_CLASS(C4ThrGrid));
Call the thread's function that fill the grid
thread->openGrid(&m_wndGrid,str,m_inUseSource);
Close the thread is it right
thread->PostThreadMessage(WM_QUIT, 0, 0);
Is it the right way to obtain what I need?
Why at runtime when I create the thread appear a message box that said "Insufficent Memory"
Help!!!!
|
|
|
|
|
Wow, that was the exact same post, word for word, that you posted as a reply to Roger Stoltz yesterday Your response from yesterday[^]
I see Mr. Stoltz has summed it all up by basically saying you may want to further investigate COM and threads before you go any further with this.
I am starting to feel this way myself. Maybe give those topics some more research and it may seem easier the second time around.
I hope that helps.
|
|
|
|
|
Hi
All
i can change font of menu item but the font of Top menu items like File,Edit,Help etc is unchanged.So how can i do this.Is there any specific way to change font of top menu.
Thanks and Regards
Atool
|
|
|
|