|
I am a beginier with c++ and I was reading an article to make an XP button, and I don't know how to rename the CButton... can any one help?
|
|
|
|
|
Goto your dialog class header file (*.h) that contains the button you want to change to XP style.
It will be like this :
----------------------------------------
class CMyDialog : public CDialog
{
public:
.
.
CButton m_btn;
.
.
.
};
----------------------------------------
Change "CButton" word to your XP style button class name.
For example : CButton -> CXPButton.
Don't forget to include your XP style button class header before this dialog class header.
For example : #include "XPButton.h"
Hky
|
|
|
|
|
OKi Doki
thanks for helping me
but I did every thing, and i put the XPBtton.h inside the project, but when it compile it i got these errors
boya.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CXPButton::~CXPButton(void)" (??1CXPButton@@UAE@XZ)
boyaDlg.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CXPButton::~CXPButton(void)" (??1CXPButton@@UAE@XZ)
boyaDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall CXPButton::CXPButton(void)" (??0CXPButton@@QAE@XZ)
Debug/boya.exe : fatal error LNK1120: 2 unresolved externals
any idea?
|
|
|
|
|
May be compiler can't find "definition" of constructor and destructor. Check your constructor and destructor for its completeness and validness declaration (usually in .h file) and definition (usually in .cpp file).
If it still can't help, confirm me.
Hky
|
|
|
|
|
Thanks man.
I put the XPButton.h and XPButton.cpp inside my project and then it worked, i forgot to put it inside my project folder,
put thanks for helping, and you will be tired of Myq uestions here
thanks alot and see yeah
|
|
|
|
|
How can I make my programs Unicode ready?
How do I compile them for Unicode?
What header files do I include?
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
Please, look at International Programming Topics in MSDN
|
|
|
|
|
I need to position my child window (formview) at position 0,0 each time it starts up. I tried the line of code below but it doesn't seem to do the trick.
SetWindowPos(NULL, 0, 0, -1, -1,SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
Without the code, its position is set at 0,0. But each time I open that same window up, it keeps changing to the next cascading position. How can I prevent this and have it start at position 0,0 each time?
Thanks!
|
|
|
|
|
You are supposed to do this by modifying the CREATESTRUCT in PreCreateWindow , so:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.x = 0;
cs.y = 0;
return TRUE;
}
|
|
|
|
|
I inserted the above code and it still doesn't work. Each time I close the window and open it back up again, it moves to the next cascading position. I tried inserting similar code into BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) and it gives me the same result.
|
|
|
|
|
Rather than a round of the guessing game - - mail me a minimum copy of a project exhibiting the problem.
|
|
|
|
|
Hi,
I need to use a class that is outside of my DLL in my DLL. I've tried every way I know of, but I can't seem to accomplish it. I know you can export from a DLL, but can you import into a DLL?
The outside class is not in another DLL, it's free-standing in the project.
I'm not very experienced with DLLs, so any help is greatly appreciated...Thanks!
|
|
|
|
|
Keylee717 wrote:
it's free-standing in the project
If this means the class is in source-form, then just copy it over!
If it means it's part of an EXE, then Im afraid there is no easy way (if any) to import!
Bikram Singh
|
|
|
|
|
Hi Bikram
I would copy it over, but that class relies on other classes in the project. I can do it as a last resort and just copy all of the classes needed into the dll, but if I do that I may as well not use a dll and just put it all into the client project.
Thanks for your help!
|
|
|
|
|
Well, you needent really make a copy of the class and the classes it depends on...
Just add the class and the related classes to the VC++ file view..
Keylee717 wrote:
I can do it as a last resort and just copy all of the classes needed into the dll, but if I do that I may as well not use a dll and just put it all into the client project
So why not use a DLL? It's always better to do that, so that in future you have only one copy of the classes to maintain. With multiple copies, you, for example, fix a bug and you've got to fix the bug in all copies...
Bikram Singh
|
|
|
|
|
Hi there,
Is it okay to allocate memory using the new operator and then to reallocate it (expand/shrink it) by using realloc ?
...Or is there any better method that I should be thinking about?
Thanks,
David
|
|
|
|
|
No, new and realloc() are not compatible.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks for the reply.
DavidCrow wrote:
No, new and realloc() are not compatible.
What would you advise me to do then? Should I just new a new portion of memory, memcpy the contents and then delete the old one?
What would you say?
dNimrod#X
________________________
|
|
|
|
|
new is an operator, while realloc() and memcpy() are functions. If you want to be able to use realloc() , use malloc() instead of the new operator. Memory allocated by malloc() should be freed by calling free() .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
dNimrod#X wrote:
Should I just new a new portion of memory, memcpy the contents and then delete the old one?
You can but new is best used for allocating fixed-size memory blocks and objects.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
You can but new is best used for allocating fixed-size memory blocks and objects.
Ha, I see... so I'm better off using malloc from the start.
Thanks a lot for the valuable feedback.
dNimrod#X
________________________
|
|
|
|
|
What are you trying to do.
Is the memory for an object with a constructor/destructor ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
cmk wrote:
Is the memory for an object with a constructor/destructor ?
No it's for a variable-sized custom control own content buffer -- it may need a larger/lesser quantity of memory at a given time. I therefore need to expand/shrink the buffer according to the needs at that exact time.
dNimrod#X
________________________
|
|
|
|
|
forget aout reallocating memory, for most.
a) new/delete call Ctor and DTor of the element(s), which alloc does not
b) realloc isn't as useful or performant as one would wish, unless you have a single-threaded application and all the reallocations happen in one "block" (in which case it's typically possible, if painful, to calcuilate the total length first and allocate once).
The worst performance hit is not overallocation, but fragmentation, and typical "container" or "string builder" classes are designed to minimize that. The overhead of allocating a larger buffer and copying data is often negligible.
I would recommend using a container with contiguous memory (such as std::vector<byte> for this.
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
If the memory is just for 'blob' data (ie no constructors/destructors need to be called) then just use ?alloc/realloc/free.
The only real reason to use new/delete is to have the constructors/destructors called automatically.
...cmk
Save the whales - collect the whole set
|
|
|
|