|
Ok lets think its the data member of the class.How does it matter?
|
|
|
|
|
BK Pradeep wrote:
How does it matter?
Not very much. But you have to call new in order to create your array --and-- you need to delete it.
a.what actually does stringarray "Add" do??
It adds the string at the end of the array.
b.Do i need to make "cstring temp" in fun1 heap allocate or static allocate will do?(that is should the string exist even after adding to the string array?)
No. CStringArray copies your string.
c.if i do RemoveAll for the string array, will deallocation of the memory of the strings takes place?
Yes.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Thanks a lot Pal.You have been helping me a lot!
|
|
|
|
|
Answers:
a) Add function adds (copies) a string to array, allocating necessary space for it.
b) No, you don't have to keep the insterted string. E.g. code like:
arr.Add("hehe");
will work fine
c) Yes, RemoveAll deallocates any memory used by this array. It is not frees any memory allocated by you. e.g. pcsTemp in this code won't be freed:
CString* pcsTemp = new CString("hehe");
arr.Add(*pcsTemp);
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Thanks Thanks a lot patrick.I think you understood my problem and your solution clears all my doubt.
Thanks again.
|
|
|
|
|
Hi,
i'd like to ask if someone have tried to do this:
sending keypress to another window.
not by sending window messages to the hwnd
{ i mean ::SendMessage(HWND,WM_CHAR,LP,HP) tecnique }
but by emulating keypress itself!
Someone knows how to do this ?
Any help would be apprecied!
See ya,
D3sty
|
|
|
|
|
Use keybd_event or SendInput.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
thanks for your reply.
it was really useful!
D3z
|
|
|
|
|
Hi,
I have developed a set of classes that allow developers to incorporate screen designer functionality into an application so that end users can customise screens in a controlled fashion, i.e. still accept updates.
The classes allow existing fields to be added, hidden, moved and new fields to be added.
Even if all of your application has been developed using a resource editor (as most app's are) it will still allow those controls to be modified at run-time.
It works on CView, CDialog, CPropertyPage derived classes.
I need some help in testing the code - before it is released, I think I can manage about 5 "BETA" testers - anyone willing to help?
Regards
Novo Star
|
|
|
|
|
Hi,
I have two sound blaster in my computer.
I'm working with win 2000 pro.
I would like to knew how (which command)can I approach each of them ?
thanks.
|
|
|
|
|
Hi,
Not sure what you mean by approach? But you should look at waveIn* APIs. Just look for waveInOpen, waveInClose etc. on MSDN.
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Does anybody have any B+ tree implementation in C++?
Thanks!
Wanderley
|
|
|
|
|
Hi all,
Iwould like to load a bmp picture in to my dialog during runtime and if the actual size of the bitmap is less than my dialogs view area the bitmap should be displayed as such exactly in the centre and if its size is greater the dialogs view area the bitmap should confine to the view area with scrolling capability.How can i achieve this?.Can anyone help me?.
With regards
Shibu
|
|
|
|
|
The scrolling is an issue, the rest is easy. Assuming you have a HBITMAP ( which a CBitmap can return ) you can do this:
BITMAP bm;
GetObject( bm, sizeof(BITMAP), myhBitmap);
This structure tells you the width and height of your bitmap, the rest is simple maths. Draw the bitmap using BitBlt in your WM_PAINT handler, and if you want scrolling, you'll also need to draw two scrollbars, and use GetClientRect to find out the size of your dialog, then make the scroll range of each equal to the size of the bitmap - the size of the screen. i.e. if your bitmap is 200 wide and your dialog is 150 wide, you need the scrollbar to have a range of 50, so you can scroll across to see all of it. Then handle the scroll messages, and in them invalidate your dialog. Your draw routine should now draw the bitmap taking into account the scroll pos of the two scrollbars.
To centre, it's just some basic math. And you're done.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Hi, recently I came across the following code and was wondering if you could help me understand some syntax.
#if 0
for (int i = 0; i < _Points; i++)
_aTape[i] = 1600 * sin (2 * PI * 1000. * i / _sampleRate);
#else
for (int i = 0; i < _Points; i++)
_aTape[i] = 0;
#endif
What are these #if and #else directives. Are they like the normal if/else. Also, what does the #if 0 evaluate to???
Thanks for any reply.
Cheers,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
#if, #else and #endif are preprocessor directives. #if 0 is used to quickly comment out part of the code. In your case, only the second version of the loop will be compiled.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
hmmmmm... I wonder why the guy used it then. I mean, if I understood you correctly only the second version of the loop will ever get executed, right?
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
pankajdaga wrote:
I wonder why the guy used it then
He can quickly switch between two versions of the loop by changing '#if 0' to '#if 1' and recompiling. It's easier that using /* and */
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Got it! Thanks man!
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hi
I'm trying to set item image with this code:
CImageList m_ImageList;
m_ImageList.Create(IDB_BITMAP1,18,10,(COLORREF)0xFFFFFF);
int nCount = m_ImageList.GetImageCount();//after that nCount == 7
m_Tree.SetImageList(&m_ImageList,TVSIL_NORMAL);
m_Tree.InsertItem( "text", 1, 1 );
, but it doesn't work properly. New added item has empty image(white) and looks like it would be shifted on the right (by the image width). I don't have the faintest idea what is wrong.
thanks for any help
|
|
|
|
|
|
Your m_imageList seems to be local variable, despite the m_ prefix. It's destroyed as soon as program leaves the scope; tree control is left with invalid image list handle.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Great thanks
Of course solution was really simple and my mistake was really stupid but the most stupid errors are the most difficult to solve out.
|
|
|
|
|
hello
in my programm im lookin for some system information
how do i get information about:
the installed windows service pack
and the rights of the loged in windows user
(e.g. admin, power user)
I use VC++ 6 and W2k
|
|
|
|
|
can we call dynamic_cast in OnInitDialog
|
|
|
|