|
Do you have the same version of MDAC installed on both machines?
Also does the release version work on your development machine?
Michael
|
|
|
|
|
Hi,
I´m making a thing that seems to work ok, but I´m not quite sure if it´s right done or not ( my ANSI C experience tell me... NAAAAA ! MALLOC MAAAN AND COPY THE BUFFER.... ), it´s quite basic asigning to a text node an (char *).
char buf[255];
MSXML2::IXMLDOMNodePtr pCostSelNode = _pXMLClonedDoc->selectSingleNode((BSTR) strCostSelNode);
if(pCostSelNode != NULL) {
itoa(iIndex, buf, 10);
pCostSelNode->text = buf;
}
Is correct to assing to the bstr that buffer in that way ( I suposse if it´s _bstr_t friendly it should but... ).
Thanks in advance, greetings
Braulio
|
|
|
|
|
What is the type of strCostSelNode ?? If it is not BSTR, you must convert it. Typecasting is not enough, in the case of a BSTR. Ex:
<br />
USES_CONVERSION;<br />
wchar_t *strCostSelNodeW;<br />
char *strCostSelNodeA;<br />
_TCHAR *strCostSelNodeT;<br />
<br />
BSTR bsCostSelNode1 = W2BSTR(strCostSelNodeW);<br />
BSTR bsCostSelNode2 = A2BSTR(strCostSelNodeA);<br />
BSTR bsCostSelNode3 = T2BSTR(strCostSelNodeT);<br />
<br />
MSXML2::IXMLDOMNodePtr pCostSelNode = _pXMLClonedDoc->selectSingleNode(bsCostSelNode1);
<br />
::SysFreeString(bsCostSelNode1);<br />
::SysFreeString(bsCostSelNode2);<br />
::SysFreeString(bsCostSelNode3);<br />
Tell me if you need more info.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Thanks for the tip,
Sorry, I forgot to write there the type of strCostSelNode, and it was "CComBSTR".
Anyway is a perfect example for me, if I have to convert from all that types to BSTr, thanks a lot.
Braulio
PS.: If I declare a variable in MFC using _bstr_t, do I need to free it, before it goes out of scope ?, b.g.:
void MyMethod()
{
_bstr_t MyVar = "MyText";
(...)
}
|
|
|
|
|
I want to display the CFontDialog dialog with the DoModal() method, but the font and it's properties (size, style, colour) already selected.
For example when the dialog is displayed, the Arial 12 italic RED is selected.
How do I do that ?
|
|
|
|
|
After you've created you dialog, but before DoModal(), modify the m_cf member of your dialog. Set m_cf.Flags to CF_INITTOLOGFONTSTRUCT and m_cf.lpLogFont to point to a LOGFONT object of your choice.
You can use CFont::CreateFont() to initialize a font, and then use CFont::GetLogFont() to get the underlying LOGFONT.
|
|
|
|
|
I have tried like you told me:
CFontDialog dlg;
LOGFONT* logf;
logf=new LOGFONT;
font1.GetLogFont(logf); //font1 is a valid font created before (Arial 12)
dlg.m_cf.Flags=CF_INITTOLOGFONTSTRUCT;
dlg.m_cf.lpLogFont=logf;
dlg.DoModal();
It doesn't work. I get an assertion failure at the DoModal method. If I debug it, the error is at the line:
ASSERT(m_cf.Flags & CF_ENABLEHOOK); in the CFontDialog::DoModal method, defined in dlgfnt.cpp.
If I don't debug it and I choose Ignore, It says: "There are no fonts installed. Go to the Control Panel.......".
What is the problem ?
|
|
|
|
|
it's ok. I resolved that. I had to set also the flags CF_ENABLEHOOK | CF_BOTH | CF_EFFECTS.
Thanks.
|
|
|
|
|
It should be set like:
dlg.m_cf.Flags |= CF_INITTOLOGFONTSTRUCT;<code><br />
to keep old flag values.<br />
<br />
Your solution will probably work aswell.
|
|
|
|
|
Does anyone remember where the standard cursor resources (such as IDC_SIZEALL) are located (which file)?
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
I'd say they are in shell32.dll.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Not sure, but I'd go for the mfc dlls.
/moliate
|
|
|
|
|
Something like that is definitely going to be in one of the Windows DLLs. I just didn't want to have to manually open each one and search through its resources. Thanks anyway!
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
USER32.DLL, then...
Guess you already found it, though.
/moliate
|
|
|
|
|
Yeah But thanks!
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Is there a simpel way to create a monochrome bitmap from a multicolor bitmap?
I need to create a mask for MaskBlt. This mask should be monochrome according to MSDN. Assuming only one color will apply to 1 and the rest to 0 in the mask.
Any help would be appreciated.
|
|
|
|
|
are u meaning at runtime or design time?
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
Thanks, I did mean at runtime.
|
|
|
|
|
The sample is in MSDN. Try looking for "transblt", "transblit" or something like that.
|
|
|
|
|
Roger.
TransparentBlt(), Thanks.
|
|
|
|
|
At www.wdj.com they have my Sept 2001 article online, which does exactly this to draw a bitmap with color keying, which is what I presume you want to do.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Thanks for your reply. I came up with some unexpected results regarding timing of the calls during a profiling.
I tried four different methods to draw an ellipse. The first method is obviously direct, the following three uses precreated bitmaps or icons.
I put them in a loop and:
% of time spent | call |
---|
18,91 | pDC->Ellipse(...) | 19,58 | pDC->DrawState(...) | 12,89 | pDC->DrawIcon(...) | 35,59 | pDC->MaskBlt(...) |
MaskBlt didn't at all perform as I expected. Do you have any clue to why?
(One reason could be the size of the drawings. The actual ellipse drawn has a radius of 3, while the icons and bitmaps I used was of size 32 by 32 including the ellipse, still sized with a radius of 3)
(I used your method to create a monochrome bitmap.)
Christian Graus wrote:
At www.wdj.com they have my Sept 2001 article online
BTW, is there any site where you don't post articles? I bet a search on AltaVista for NOT "Christian Graus" will give me no hits at all
|
|
|
|
|
Hoho, that was some nice formatting
It should have read:
Thanks for your reply. I came up with some unexpected results regarding timing of the calls during a profiling.
I tried four different methods to draw an ellipse. The first method is obviously direct, the following three uses precreated bitmaps or icons.
I put them in a loop and:
(Skipping <table> fancy stuff this time)
% of time spent call
18,91 pDC->Ellipse(...)
19,58 pDC->DrawState(...)
12,89 pDC->DrawIcon(...)
35,59 pDC->MaskBlt(...)
MaskBlt didn't at all perform as I expected. Do you have any clue to why?
(One reason could be the size of the drawings. The actual ellipse drawn has a radius of 3, while the icons and bitmaps I used was of size 32 by 32 including the ellipse, still sized with a radius of 3)
(I used your method to create a monochrome bitmap.)
Christian Graus wrote:
At www.wdj.com they have my Sept 2001 article online
BTW, is there any site where you don't post articles? I bet a search on AltaVista for NOT "Christian Graus" will give me no hits at all
|
|
|
|
|
I have been at work for 15 hours, and I'm stuck on this - it used to work but now doesn't. Basicaaly I have an XMLDocument and it has a set of child nodes in a NodeListPtr, which I want to copy into another document, so I set through them all and use appendChild to copy them to the other document, and cloneNode(VARIANT_TRUE) to make sure I put in a deep copy. It now blows up on the appendChild call, every time that the node has come from another parent document. The docs seem to say I *can* do this, I'm sure I *have* done this ( this is old code that just stopped working ), so can anyone tell me where I am going wrong ?
The code looks something like this:
IXMLDOMNodeListPtr ptList = spDoc1->FindNode("/XML/blah"); // works OK
IXMLDOMNodePtr ptOther = spDoc2->CreateNode("/XML/location"(; // Works OK
while (ptNode = ptList->nextNode()) // works OK
{
ptCopy = ptNode->cloneNode(VARIANT_TRUE); // works OK
ptOther->appendNode(ptCopy); // This blows up, no matter how I slice & dice it
}
This is a rough idea, but the lines marked with 'works OK' work, if there's any error in my post, it's not present in my code.
Thanks.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Hi Chris, this is a shoot in the dark, so I hope I won't hurt anybody. Could it be that ptCopy is not implementing OK the AddRef /Release stuff? Why don't you try using a local variable?
while (ptNode = ptList->nextNode())
{
IXMLDOMNodePtr ptCopy = ptNode->cloneNode(VARIANT_TRUE);
ptOther->appendNode(ptCopy);
} I doubt this will fix the problem, but it is easy to give a try.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|