|
The code you have suggested means that the array elements can only be added in the source code - any dynamic changes in the code are not possible.
If you are wanting to dynamically add array elements at run time, this link may help you solve your problem.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
Dynamic arrays means - you are free to allocate any number of members at runtime. But still you should specify the number of items in you dynamic array. The only flexibility is - you could decide the count at runtime where in static arrays, you cannot.
Sunday8PM wrote: MyClass *MyObjects = new MyClass[];
You've to specify the array size.
int ArraySize = 10;
MyClass *MyObjects = new MyClass[ArraySize];
Sunday8PM wrote: I'm worried that since I haven't specified the length of the array before, it might write over something else since it isn't expecting the array to use it.
You cannot instantiate arrays without specifying the size.
Well, you could use stl containers such as std::vector where you'll be free from the array size headache.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I'm going to look into vector's, they sound interesting thanks!
|
|
|
|
|
Sunday8PM wrote: Would the code work?
No, because you have not told new how many MyClass objects to create. Since you do not know this information at the time of creation, perhaps a vector of MyClass objects would work.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Following code should be helpfull;
//... First - allocate class pointer array
MyClass **pArr = new MyClass* [dwClassCount];
//... Second - allocate class objects
for(i=0;i<dwClassCount;i++) pArr[i] = new MyClass;
//... Do the job
//... Release class objects
for(i=0;i<dwClassCount;i++) delete pArr[i];
//... Release class pointer array
delete pArr;
|
|
|
|
|
I am trying to merge two icons by drawing one image transparently on another, merging the masks and creting a new icon based on the new bitmap and mask.
The code looks like this:
GetIconInfo(hFirstIcon, &FirstInfo);
GetIconInfo(hSecondIcon, &SecondInfo);
.
dcFirstIcon.CreateCompatibleDC(NULL);
dcSecondMask.CreateCompatibleDC(NULL);
dcSecondIcon.CretaeCompatibleDC(NULL);
dcSecondMask.CreateCompatibleDC(NULL);
.
dcFirstIcon.SelectObject(FirstInfo.hbmColor);
dcFirstMask.SelectObject(FirstInfo.hbmMask);
dcSecondIcon.SelectObject(SecondInfo.hbmColor);
dcSecondMask.SelectObject(SecondInfo.hbmMask);
.
dcFirstIcon.BitBlt(0, 0, IconSize, IconSize, &dcSecondIcon, 0, 0, SRCINVERT);
dcFirstIcon.BitBlt(0, 0, IconSize, IconSize, &dcSecondMask, 0, 0, SRCAND);
dcFirstIcon.BitBlt(0, 0, IconSize, IconSize, &dcSecondIcon, 0, 0, SRCINVERT);
.
...
.
FirstInfo.fIcon = true;
hMergedIcon = CreateIconIndirect(&FirstInfo);
The result is fine, but on certain icons it kills the icon shadow and makes the shadow solid black and ugly. I tried to use TransparentBlt which in those problematic icons leaves the shadow untouched but this function erases the bits where the second icon should show up and make them white.
I guess it is related somehow to XP style icons or to Alpha channel, but am not familiar with those issues and will appreciate some advice here.
Haim
|
|
|
|
|
nafxcw.lib(thrdcore.obj) : error LNK2005: "class CWinThread * __stdcall AfxGetThread(void)" (?AfxGetThread@@YGPAVCWinThread@@XZ) already defined in mfc42.lib(MFC42.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "class CWinThread * __stdcall AfxBeginThread(unsigned int (__cdecl*)(void *),void *,int,unsigned int,unsigned long,struct _SECURITY_ATTRIBUTES *)" (?AfxBeginThread@@YGPAVCWinThread@@P6AIPAX@Z0HIKPAU_SECURITY
_ATTRIBUTES@@@Z) already defined in mfc42.lib(MFC42.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "void __stdcall AfxEndThread(unsigned int,int)" (?AfxEndThread@@YGXIH@Z) already defined in mfc42.lib(MFC42.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual void __thiscall CWinThread::Delete(void)" (?Delete@CWinThread@@UAEXXZ) already defined in mfc42.lib(MFC42.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::IsIdleMessage(struct tagMSG *)" (?IsIdleMessage@CWinThread@@UAEHPAUtagMSG@@@Z) already defined in mfc42.lib(MFC42.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CWinThread@@UAEHPAUtagMSG@@@Z) already defined in mfc42.lib(MFC42.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::ProcessMessageFilter(int,struct tagMSG *)" (?ProcessMessageFilter@CWinThread@@UAEHHPAUtagMSG@@@Z) already defined in mfc42.lib(MFC42.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual class CWnd * __thiscall CWinThread::GetMainWnd(void)"
|
|
|
|
|
It looks like you've conflicting libraries in Release build. Compare Debug settings with Release ones.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Hi,
Did you used Application Wizard to create this project. There is no libraries in the project. So check it out.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
you wanted to say this to the guy who asked the question, didn't you ?
|
|
|
|
|
Found a similar thread[^]. It says that this can happen when you mix up the static/dll usage of MFC libraries and CRT libs . Have a look at the thread. Might be useful.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
Sure. Well, this one is solved?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
No, not yet I want to make at least debug build complete then, I will work on the Release build.
|
|
|
|
|
Hi!
I've created a GUI. This GUI application has one Button. In the click event of this Button, I've run another application. The second application is running as an individual window. What to do if I've to run it inside the GUI application?
|
|
|
|
|
Am I wrong?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Nope it was a post a few days ago I think, about using ShellExecute() to execute an application, but within a dialog. I believe the answer was it couldn't be done
[Edit]
Found the link
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
modified on Monday, August 25, 2008 5:18 AM
|
|
|
|
|
|
As others said on the other occasion you asked this question, as you have the source code for both applications, why not just merge the two together, so that the window in the second application is created as a child window of the dialog in the first?
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
No. That's not the problem. I've done it. I merged the two source codes. After that only I got two windows running separate. What to do?
|
|
|
|
|
What the suggestion meant was that you need to make the window for your second application a child window of the dialog in your first application, so that when you run the application, the second window runs inside this dialog. To do this you will also need to make the second window modeless and captionless. You will need to change some of your source code for this - simply merging the source won't help.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
God is watching this!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
T.RATHA KRISHNAN wrote: What to do if I've to run it inside the GUI application?
Change your design. One application cannot run inside of another in the fashion that you describe. One solution would be to change your second application to be an ActiveX control instead.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi All!
I want on a tree control (under Win32 SDK) to retrieve item text by using NM_CLICK notification.
The problem i have is when I use NM_CLICK I retrieve NULL at HTREEITEM handle (I checked with NM_DBLCLK and i retrieved a handle).
would it be good idea to use TVHITTESTINFO with TreeView_HitTest?
The code is:
...
case NM_CLICK
{
char str[32];
int ret = 0;
TV_ITEM item;
HTREEITEM hItem = NULL;
// Get next selected item
// When i use NM_DBLCLK hItem is not NULL<-------
hItem = (HTREEITEM)TreeView_GetNextItem(hTree, hItem, TVGN_CARET);
if (hItem == NULL)
ret = 0;
item.mask = TVIF_TEXT;
item.cchTextMax= 32;
item.pszText= str;
item.hItem = hItem;
if (!TreeView_GetItem(hTree, &item))
ret = -1;
}
Thanks
|
|
|
|