|
thanks for reply.
yes, you are right, i mean the dimensions as constant values.
my compiler has problems with int ** ppInt = new int[nRows]; .
error: int* cannot convert in int**
and with ppInt[i] = new int[nCols]; .
error: int* cannot convert in int
what´s wrong?
nRows and nCols are integers in my program.
MFC
|
|
|
|
|
MFC is the Best wrote:
ppInt[i] = new int[nCols];.
try
ppInt[i] = new int*[ncols];
-c
No matter how fast light travels it finds the darkness has always got there first, and is waiting for it.
-- Terry Pratchett,
|
|
|
|
|
I need to display XML ( heirarchical view ) like in IE in a Edit box .
I am using the XML DOM mechanism to extract XML from the xml file .
the XMLnode->xml returns the XML string to me .
When i display it now I get text which doesnt look pretty .
as for eg I should get
<parent>
<child1>hello
<child2>hello2
all i get now is
<parent><child1>hello<child2>hello2
Please if anyone knows a better Control or Method of displaying this lemme know !
|
|
|
|
|
The .NET framework contains methods to return XML nicely formatted, if that's not available to you, I don't know if there is anything else, or if you'll need to parse it yourself. It's not hard though, just keep track of how many tabs in you are, and put returns after a >.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
In the code below IDC_EDIT1 is a dynamically created control. Does the MSG structure identify what control had focus when the message was sent? The outer IF statement works just fine, how do I write the inner IF statement?
Thanks
BOOL CTestDlgDlg::PreTranslateMessage(MSG* pMsg)
{
static int iCount=0;
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_CHAR)
{
//if(dynamically created edit control IDC_EDIT1 has focus)
//{
TRACE("got %d\n", iCount++);
// }
}
return CDialog::PreTranslateMessage(pMsg);
}
|
|
|
|
|
an MSG struct has an hwnd member.
if (pMsg->hwnd = GetDlgItem(ID_...)) ...
-c
No matter how fast light travels it finds the darkness has always got there first, and is waiting for it.
-- Terry Pratchett,
|
|
|
|
|
Do I feel silly or what...
thank you Chris
|
|
|
|
|
Hi,
After trying my VC+ 6.0 with different things wihout any
success, can any one help me just to set my ListBox (as a ListCtrl)
BackGround becomes Black & the Text color becomes White?
Many thanks,
|
|
|
|
|
Does not CListCtrl::SetBkColor work?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I am sorry about this, since I am working on a big project that involves ListBoxes & ListCtrl's ... I did mixed-up my message ListBox (as ListCtrl) ... I appologize for this!
Actually, I could not set BackGround color & Text color for my ListBox (not a ListCtrl)
You still can help?
Sorry & regards
|
|
|
|
|
One solution is to design a custom-draw.
http://www.codeproject.com/listctrl/xlistctrl.asp
Kuphryn
|
|
|
|
|
Hi,
I am sorry about this, since I am working on a big project that involves ListBoxes & ListCtrl's ... I did mixed-up my message ListBox (as ListCtrl) ... I appologize for this!
Actually, I could not set BackGround color & Text color for my ListBox (not a ListCtrl)
You still can help?
Sorry & regards
|
|
|
|
|
The only way I believe to change the color of a listbox is via owner-draw. You have to derived a class from CListBox or whatever and draw your own boxes. There are classes available that allows you to change its color.
Kuphryn
|
|
|
|
|
Hello,
I'm trying to write a small program that connects to an Oracle database.
Oracle delivers an oci.lib file when installing the Oracle client.
I'm also using a stream template to facilitate the working with Oracle API.
I include the oci.lib in my project's link tab, specify the location where the lib file can be found and everything works as expected. So far so good.
When I transfer my small program to a computer which doesn't have an Oracle client installed, the program complains about missing dll's. This, I can understand.
My question is: is it possible to statically link all the libraries/dll's in the lib file to my executable?
If I look at the dependecies, my program requires a lot of (Oracle) dll's. Will all of these dll's be statically linked to my executable?
And what exactly is a lib file. Just someting Visual C++ exports when you create a dll so other people can easily make use of the dll?
Thanks in advance
Wim
|
|
|
|
|
is it possible to statically link all the libraries/dll's in the lib file to my executable?
No, there's no way to have DLLs bundled into your .EXE. However, you can install them along with your executable (possibily in the same directory) if you use some sort of installation program to ship your app.
And what exactly is a lib file
There are two types of static libraries:- Regular libs are just compiled pieces of code you can link and use without further dependencies from DLLs.
- Import libs are static libraries you can use to dynamically link functions from a DLL. These import libs search the DLL at tun-time, locate the functions and load them for the app to use, roughly speaking. DLLs can be used without this aid, though usually is best to rely on import libs to do the job.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
As pointed out... a .lib file could be a static library, or simply an import library to a DLL.
Import libraries have the advantage that you can call DLL functions as if they were regular functions. You don't need to call LoadLibrary to get the DLL, and GetProcAddress to get functions. And you get type checking. The disadvantage is that if the DLL doesn't exist, your code won't run at all. And your code will show an ugly, and not very user-friendly error message complaining that it can't find the DLL.
A good rule I follow: use import libaries for DLLs when you are certain the DLL will exist (e.g., you install it.) Use the regular DLL functions (like LoadLibrary, GetProcAddress) if there is a chance the DLL might not exist, and you want to handle that situation gracefully.
It is technically possible to include DLL's in an EXE, but it is highly ugly, and the only time I've ever done it was to create a self-extracting installer. (Basically, you include the DLL as a resource in your EXE. Yuck!)
Just make sure your installer puts these DLLs in the proper location when installing your product, and you should be good to go.
"Time spent with cats is never wasted." - Colette
|
|
|
|
|
Navin wrote:
The disadvantage is that if the DLL doesn't exist, your code won't run at all. And your code will show an ugly, and not very user-friendly error message complaining that it can't find the DLL.
one trick is to use delayed loading. when your app starts, do a LoadLibrary on the DLL. if it isn't found, complain nicely but bail. if it is present, do nothing, and the import lib will do its thing normally.
-c
No matter how fast light travels it finds the darkness has always got there first, and is waiting for it.
-- Terry Pratchett,
|
|
|
|
|
Hi,
Thanks for your answer. Everything is very clear to me now, but I still have one question.
As Oracle moves along to new versions, they tend to rename the dll's too.
So I used a Oracle 8i lib file, but I tried the program on a computer which had a Oracle 7 client installed and the program failed, because some dll's had the version number in their name.
So, the best way to go is to use LoadLibrary and GetProcAddress as you pointed out.
Now, my question is: is it possible to generate some sort of a header file out of a lib file. Although the dll names changed over time, the actual function names stayed the same.
So if I should be able to generate a header file, which maps the dll functions to a GetProcAddress(..., ...), the only thing I have to write then is a LoadLibrary part.
Wim
|
|
|
|
|
Hello,
the subject says everything...
does anybody know how to do it? Do this is possible?
If not how should I do it?
Moreover I need them in the first subitem...
Thank you in advance...
|
|
|
|
|
the only two ways of doing this, (that I know of)
are , creating the check box at runtime as child of the listctrl and show/hide them on top of the item when nedded, or use a CImageList with icons to fake the checkboxes.
Dont know any outher way but the topic is interesting (I will do some testing )
Casa.Sapo.pt
|
|
|
|
|
Hi,
I have a design/OOP question. I am trying to find the most elegant solution or design of the object. I want to create several instances of an object, and then have each of those objects perform the same function at the same time when called upon to do that task. An example of what my question is this: for instance you wanted to create a bunch of door objects and you want them to open simultaneously at the appropriate time.
How would one design something like that? A real life example is in a horse race and the gates the horses are kept in. You want all the gates to open at once at the start of the race instead of having one person walk to each of them and open them manually. I’ve tried several ideas with the static keyword, but unfortunately, my design skills are not up to par.
If there is anyone who could show me a c++ example of how to design such an object, you would have helped me a lot.
|
|
|
|
|
Use a static member variable or (more generally) forward to a static member function, just like this:
class gate
{
public:
void open(){static_open();}
bool is_open(){return static_is_open();}
private:
static bool m_open;
static void static_open();
static bool static_is_open();
};
bool gate::m_open=false;
void gate::static_open()
{
m_open=true;
}
bool gate::static_is_open()
{
return m_open;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
So how would I use this?
int main(){<br />
<br />
gate x;<br />
gate y;<br />
gate z;<br />
<br />
bool gate::m_open = true;<br />
<br />
return 0;<br />
}
??? Thanks in advance for your help!
|
|
|
|
|
In Joaquín's example you would do this:
<br />
int main(){<br />
<br />
gate x;<br />
gate y;<br />
gate z;<br />
<br />
x.open();<br />
<br />
return 0;<br />
}<br />
I personally would remove the member functions and the gate class would look like this:
<br />
class gate{<br />
public: <br />
static void static_open(); <br />
static bool static_is_open();<br />
private:<br />
static bool m_open; <br />
};<br />
bool gate::m_open=false;<br />
void gate::static_open()<br />
{<br />
m_open=true;<br />
}<br />
<br />
bool gate::static_is_open()<br />
{<br />
return m_open;<br />
}<br />
Then your program could use it like this:
<br />
int main(){<br />
<br />
gate x;<br />
gate y;<br />
gate z;<br />
<br />
gate::open();<br />
<br />
return 0;<br />
}<br />
This is closer to what is really happening design-wise.
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!
|
|
|
|
|
Is this weird?
I have an array with some entries I want to suppress from showing in the CListCtrl. WIthout thinking about index mismatch and conflict(and all I reallly need here is to populate the ctrl), I did:
for (int i3 = 0; i3 < pDoc->m_nNumItems; i3++)
{
fClearAllForList1 = TRUE;
if(pDoc->m_docFldHolder[i3] == "CDE")continue;
if(pDoc->m_docFldHolder[i3] == "XYZ")continue;
int nItem = m_list1.InsertItem(i3,pDoc->m_docFldHolder[i3]);
}
The entries all show up with no blank rows where the item was suppressed. SO if I didnt put in element # 3 of the arrray, the fourth element shows up where the third one shhould have been though if you look at the indices above, technically it should have skipped a row...
Is this safe or should I put use two indices, one for the rows and one for the array? AgainI really need to populate it only. I'm not doing any processing with the item number in the ctrl.
Appreciate your help,
ns
|
|
|
|