|
Tab order depends on the order of child windows. Well, you can change the child window order by calling SetWindowPos()[^].
Check this link[^]. Its exactly what you're searching for.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi All
I am filling some cluster of Harddisk with some data, It is running fine with all other operating system except Windows Vista.
WriteFile() function is getting fail in Vista.
Can anybody help me?
|
|
|
|
|
What is the error code returned by GetLastError() after calling WriteFile?
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
|
|
|
|
|
Hi,
I am new to the concepts of vc++...in my application i want to access the hid device properties.
Ex: If I connect a new HID device from my port the HID category in the devicemanager is populated with an additional HID entry in which USB Human interface device will be the category for the device...
I want to access the "location" property"for that device..
can anybody suggest me the right approcah for doing this????????
|
|
|
|
|
See: GetRawInputDeviceList()[^]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Let's say I have a class called MyClass. I want to store objects of this class in a dynamic array and by dynamic I mean the ability to add any number of object one by one, not a predefined number. I have googled it and "dynamic array" appears to mean that you can assign a dynamic length when you create the array but that's not what I'm looking for. I want an array with an unspecified length that I can add any number of objects to.
Would something like this work?
MyClass *MyObjects = new MyClass[];
MyObject[0] = MyObject1
MyObject[1] = MyObject2
MyObject[2] = MyObject3
If I have understood arrays, increasing the number will make it jump to the next place in the memory (8 byte jump forward if the object takes 8 bytes). 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.
I haven't tested the code, I just came to think of it.
Would the code work? is there another way of doing it? Is it possible at all?
Any help appreciated.
|
|
|
|
|
You could try the CArray class in MFC or you can use the vector class in STL.
Sunday8PM wrote: Would the code work?
No it will crash.
|
|
|
|
|
Naveen wrote: Sunday8PM wrote:
Would the code work?
No it will crash.
[added]
I was wrong:
[/added]
No. As it stands, it will not compile.
[added]
See Naveen's reply.
[/added]
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]
modified on Monday, August 25, 2008 6:26 AM
|
|
|
|
|
CPallini wrote: No. As it stands, it will not compile.
If you are telling this because of the empty [], you are wrong. A few days back, I came to know that an empty [] will return a pointer pointing to a memory of size 1 byte. Thats why I said, it will crash.
Just try..
|
|
|
|
|
I just tried it! I can't believe it.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
Naveen wrote: If you are telling this because of the empty [],
Yes.
Naveen wrote: you are wrong
Yes. I just tried it.
Naveen wrote: A few days back, I came to know that an empty [] will return a pointer pointing to a memory of size 1 byte.
Good to know.
Naveen wrote: Thats why I said, it will crash.
And you're, of course, right.
Thank you for pointing out.
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]
|
|
|
|
|
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.
|
|
|
|
|