|
|
Are you protecting your file .h>/code> against multiple inclusion? (with <code>#ifndef DATA_TYPE_H s and stuff, you know.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
In data types.h add something like this:
#if !defined DATATYPES
#define DATATYPES
....
#end if
Best regards,
Alexandru Savescu
|
|
|
|
|
Hii all ,
how I can get Information about the space available and the total space in the memory of a Pocket PC or Its aditional card !!
thanks alot
|
|
|
|
|
How to retreive the system font?
|
|
|
|
|
GetStockObject(SYSTEM_FONT)
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I'm trying to use CImage in an ATL Active X. I only use methods from CImage Load, Draw and Destroy (which is noting strange). The problem is that when the application that uses the control ends, the DLL of the control can be unload. Any idea of what's the matter ?
|
|
|
|
|
I have two List Control boxes in a dialog. and I wish the user can select a few items from the first list and some items from the second list, and then the user can see all the items he just chose are still highlighted in both lists.
now after i selected one or some items in the first list(they'll get highlighted at this time), when i click in the second list and select items there, the first list will lose focus and the highlighted items in the first list will lose highlighting. Anybody can suggest me how to solve it? thx a lot in advance.
|
|
|
|
|
Just a guess, but the list view control has a 'Show selection always' property...
If that doesn't do the trick then you'd have to devise something using owner draw...
Either way only one item can ever have focus so I hope you don't desire the focus rectangle also...?
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
hi Hockey?!, ...
thx a lot for ur tips! i tried to use the property of 'Show selection always', it works!
only thing now is that the highlighted color turns from blue to gray once the list losing focus. anyone got any idea about still keep it in blue besides using owner draw?
thx a lot again!;P
|
|
|
|
|
You will have to add a message handler OnCustomDrawList to your listCtrl class
using
ON_NOTIFY(NM_CUSTOMDRAW,IDC_LIST_CTRL,OnCustomdrawList)
Check out an article by Michael Dunn at
http://www.codeproject.com/listctrl/lvcustomdraw.asp
You will also find some similar implementations(of OnCustomDraw) on www.codeguru.com as well.
Happy Coding !!
-Mahesh Shimpi
Ideas multiply by sharing!!
|
|
|
|
|
thx a lot, Mahesh!
seems i got no choice now, ...
but the coding process is really wonderful!
|
|
|
|
|
hi
i like to use combobox for storing items in vc++. but the problem is it
can't store more than 32,735 items because of integer datatype limit is 32735. But in MFC int lenght is around -2 crores to +2crores. even it accepts only 32735 items only.why? please explain how can i add items into combobox more than 32,735. how can i overcome this limit
please help about this
thank you
from
venu
|
|
|
|
|
the comboBox has not the limit 32735,the limit is (int)
|
|
|
|
|
Hi!
I have a C++ class with a callback function. Now I wanna use this class in .NET enviroment. So according the guide, i wrap it in a managed class.
But the problem is the callback. The unmanaged class must have an ability to callback the managed class. How can the callback function in unmanaged class get the pointer of the delegate(or something like that) of the managed class?
any suggestion?
|
|
|
|
|
I am not sure about this, but it may have something to do with delegates. Read about them in the documentation.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi,
I have an application developed using VC++ & MFC.Here i
need to display Japanese strings.
I do m_staticname.SetWindowText(the_name);
where m_staticname is member of type CStatic.
This doesn't work.
But GetDlgItem(IDC_NAME)->SetWindowText(the_name); works.
Could anyone please tell me how to make this
m_staticname.SetWindowText(the_name);
statement to work.
Regards
Neha
|
|
|
|
|
Delete your m_staticname declaration.
Then open Class Wizard.
Goto the member variables tab.
Double click on the IDC_NAME id.
Create a member variable named m_staticname of type CStatic that is associated with the IDC_NAME resource.
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
I have the folowing piece of code
<br />
typedef struct _HEAP_STRUCT<br />
{<br />
struct _HEAP_STRUCT *next;<br />
struct _HEAP_STRUCT *prev;<br />
}HEAP_STRUCT, *PHEAP_STRUCT;<br />
<br />
<br />
PHEAP_STRUCT pStruct;<br />
<br />
<br />
<br />
char HeapSpace[4096];<br />
<br />
void Init(void)<br />
{<br />
<br />
pStruct->next = (PHEAP_STRUCT)HeapSpace[4096];
pStruct->prev = (PHEAP_STRUCT)HeapSpace[0];<br />
<br />
<br />
<br />
<br />
};<br />
Every time it comes to the init procedure, it gives me the access violation. Even i attempt to put
pStruct->next = NULL;<br />
it still give me access violation.
Does anyone have any idea?
Thanks
|
|
|
|
|
That is because pStruct is declared as a PHEAP_STRUCT object which is actually a pointer to a _HEAP_STRUCT object. This means that no memory has been allocated to the structure itself, just the pointer. Therefore when you try to dereference the next parameter, you will get an access violation. In order to fix this you can do a number of things:
1) Declare pStruct as a HEAP_STRUCT object instead, then it will not be a pointer and memory will be allocated for this object on the stack.
<br />
HEAP_STRUCT struct;<br />
void Init()<br />
{<br />
struct.next = HeapSpace[4095];<br />
struct.prev = HeapSpace[0];<br />
}<br />
2) You can dynamically alloate memory for your pointer to your struct inside of your Init function and that will associate memory with your object.
<br />
PHEAP_STRUCT pStruct;<br />
void Init()<br />
{<br />
pStruct = new HEAP_STRUCT;<br />
pStruct->next = HeapSpace[4095];<br />
pStruct->prev = HeapSpace[0];<br />
}<br />
Finally, I do not know if this was a typo, but you assigned the HeapSpace[4096] element to the next variable. However for the array that you declared the 4095 index is the last element in the array that you delcared.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Excellent answer! It explains everything !!!
Thank you very much!!!! I really appreciate it!!!
|
|
|
|
|
Hello,
In CMyClass I have those members:
<br />
private:<br />
MSXML2::IXMLDOMDocumentPtr m_pxmlDoc;<br />
MSXML2::IXMLDOMNodeListPtr m_pxmlLlistaNodes;<br />
MSXML2::IXMLDOMNodePtr m_pxmlNode;<br />
I allocate memory for the document in this way:
<br />
this->m_pxmlDoc = new MSXML2::IXMLDOMDocumentPtr("MSXML2.DOMDocument.4.0");<br />
and in my ~CMyClass (the destructor of my class) I try to deallocate it using:
<br />
this->m_pxmlDoc->Release();<br />
delete this->m_pxmlDoc;
Could you give me an advice on how to deallocate that memory?
thank you in advance...
|
|
|
|
|
I see a few things that might help you out:
1) When you call release on your document, there is no need to call delete. That is because internally when the reference count to your document goes to zero, the COM object will automatically destroy itself. That is probably why you are getting the memory exception when you try to delete the object.
That brings me to my next point,
2) Is there a reason that you are not allocating the document pointer this way:
<br />
IXMLDOMDocumentPtr pDoc;<br />
HRESULT hr = pDoc.CreateInstance(MSXML::CLSID_DOMDocument);<br />
if (FAILED(hr))<br />
{<br />
...<br />
}<br />
AFAIK you are not supposed to use new to allocate COM objects, unless these smart pointers overload the new operator to call CoCreateObject. And even if they do overload the new operator, for the sake of clarity in your code I would recommend the method that I showed you above. Although you may need to find the correct CLSID that matches the version that you are trying to create.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
That's because I didn't know nothing about this other method...
I'll try it...
And thank you very much!
|
|
|
|
|
Hello,
I have two dialog windows with edit boxes in C++ MFC (Multiple document interface). Through menu bar in my GUI interface I am opening one dialog window and entering set of data in edit boxes and closing that window to open another dialog box to enter another set of values in edit boxes. After closing second dialog box, there is Menu item called "execute" to run my code routine by using the values entered in previous edit boxes in Dialog windows. And the result should be displayed in Listbox control. Can somebody help me out with code example. I am a beginner and trying to learn for one of my assignment. I apprecaite any help.
|
|
|
|