|
Draw a couple spaces after the number? (ie "34 ")
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Wow!
I did
s.Format("%d ", position);
and that took care of it!
Thanks!!!
Appreciate your help,
ns
|
|
|
|
|
I've searched all over (CodeProject and the Internet at large) and I have not been able to find the answer to my problem, so here goes.
I have an MDI app where I would like to be able to open a document and immediately present the user with multiple views of the same document -- one will be the primary view, and I'd like to have two secondary views. I know that the CDocument class has a member function called AddView(), but I don't know where to add my secondary views. Where would I add my other views -- in MainFrm, ChildFrm, or elsewhere? And would using the AddView() member function be the appropriate way of accomplishing what I'm trying to do?
Thanks,
Dean
|
|
|
|
|
|
I know how to do a .Create() and make one, but what does one do after retrieving the address the
user enters? WHich control will accept this address and open the webpage it points to? Is there a sample that shows how the addressctrl communicates this info to the ctrl that actually opens the webpage (which also I need to know about)
Thanks
Appreciate your help,
ns
|
|
|
|
|
ARGH - this is killing me. All I am trying to do is take a dialog, bring it to the front, centered, and activated. And I CAN'T for the life of me figure out how to do all three! Here is some code I have tried, in the dialogs, OnInitDialog handler:
BOOL CongratsDlg::OnInitDialog()
{
...
CenterWindow();
ShowWindow(SW_RESTORE);
}
I have tried various parameters in ShowWindow , and I have tried it with the SetWindowPos stuff, and without it... and with it but not ShowWindow... etc.
So what is the magic combination to show and activate a window?
Some background: this is an MFC app. It has no main window - it launches some other app, waits for it to finish, and then pops up this dialog.
Muchas gracias.
Even a broken clock is right twice a day.
|
|
|
|
|
Hmm - I may have answered my own question. It seems like if I have the Start menu active at all - even if I activate it long before this dialog comes up, the window won't activate. It seems that in any other situation, the code I have above works.
Ah well.
Even a broken clock is right twice a day.
|
|
|
|
|
|
Hey guys
I just told someone on a forum that CString has an implicit const char* operator. Now I suddenly realized that this is actually wrong grammar or usage or whatever. I mean implicit operators are the ones the compile does for us huh? Like conversion of int to char etc... So I should not have used the word implicit there, right? But then it's not an explicit operator either cause the user need not actually put a cast there. So can someone gimme some info on best usage practices for such stuff, so that I wont confuse other people in future
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
It is more question of English language, than programming. Stroustrup writes something like "operator const char*() ... provided convenience of an implicit conversion..."(#20.3.7). I understand that as an operator provides some implicit action, but itself cannot be implicit. But again, I am not a native English speaker.
|
|
|
|
|
|
You should have said "an LPCTSTR operator" But seriously, since all operator TYPE() functions can be invoked implicitly, you weren't completely wrong.
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
|
Hi.
Anyone know of a portable way
of doing program icons
(the kind you see when looking in a folder)?
Got an example?
How do I go about making
the program icon a separate file
(so if i edit it, i don't have to recompile)?
Any reading you can point me to, i'd really appreciate it.
|
|
|
|
|
So far I'd been making projects with CFormView, so when I wanted to adda handler for the bn_clicked I would just dbl click on the control, say a button, and the ONButtonA type function would be created and automatic messagemap entries made.
Now I have a CView project and am having to add the controls using .Create() so I cant very well dbl click to add the handler automatically. In this case am I responsible for making messagemap entries? Is there no automatic mechanism for this?
Thanks
Appreciate your help,
ns
|
|
|
|
|
One solution is to add the messages to the message map.
afx_msg BtnHandler()
ON_BN_CLICKED(ID, Handler);
Kuphryn
|
|
|
|
|
Thanks for the information.
Appreciate your help,
ns
|
|
|
|
|
hey, i want to write an app that does low level screen capture based on a users selection of the screen, to capture video. i want it to capture an incoming stream until the user stops it (or their predefined harddrive limit is reached).
ive set up most of my app now, im just unsure how im going to grab and store the video from the selected area of the screen.
I figure i might have to take rapid screenshots and store that, maybe a little slower than the original video, i could live with a little bit of degredation , but i would like even more if their was better suggestions, thus, my plea to cp developers for help
any suggestions / ideas??
|
|
|
|
|
Hello,
I'm facing a tricky situation with my project using MSXML interfaces. Calling methods from my COM Object passing to it IXMLDOMDocument2 seems to leak after looping a while in a multi-thread environment. Here is an example code:
(...)
CComPtr<ixmldomdocument2> inDocXML;
CComPtr<ixmldomdocument2> outDocXML;
hr=myFunc(inDocXML,outDocXML);
(...)
HRESULT myFunc(IXMLDOMDocument2 *inDoc,IXMLDOMDocument2 **outDoc) {
(...) do some stuff
CComPtr<ixmldomdocument2> myTempDoc(inDoc);
(...) do some stuff
outDoc=myTempDoc.Detach();
return S_OK;
}
I'm using a ISAPI to call this COM Component (installed at COM+).
I tried almost everything and, when I used a [out] parameter for a Interface to DOM its seems to leak!!!
My components are Free Threaded.
Can anyone help me, or have faced with this problem already ?
Thanks,
Mário
|
|
|
|
|
1. Could you please give the complete code? The sudocode you provided is difficult to diagnose. The very places under suspicion would not probably compile in your example.
CComPtr inDocXML;
CComPtr outDocXML;
hr=myFunc(inDocXML,outDocXML); //I think it would not compile
(...)
HRESULT myFunc(IXMLDOMDocument2 *inDoc,IXMLDOMDocument2 **outDoc) {
(...) do some stuff
CComPtr myTempDoc(inDoc);
(...) do some stuff
outDoc=myTempDoc.Detach();//I doubt it would compile ether
return S_OK;
}
2. MSXML uses some funny memory management. How do you know there is actually memory leak? It could be that they just preallocate and hold memory.
|
|
|
|
|
1. the main code is:
STDMETHODIMP Cdemo::myDemo(BSTR docIn, BSTR *docOut)
{
HRESULT hr;
CComPtr<msxml2::ixmldomdocument> pDOMObject=NULL;
CComPtr<msxml2::ixmldomdocument> myDocTemp=NULL;
CComBSTR mOut=NULL;
hr= CoCreateInstance(CLSID_DOMDocument, NULL,CLSCTX_SERVER,
IID_IXMLDOMDocument2, (LPVOID*)(&pDOMObject));
hr=pDOMObject->loadXML(docIn);
try
{
hr=MyPrivateFunc(pDOMObject,&myDocTemp);
if FAILED(hr)
throw hr;
if (myDocTemp)
hr=myDocTemp->get_xml(&mOut);
else
mOut=L"Error";
*docOut=mOut.Detach();
}
catch (...) {
mOut=CComBSTR(L"Error").Detach();
}
return S_OK;
}
HRESULT Cdemo::MyPrivateFunc(MSXML2::IXMLDOMDocument *xmlin,MSXML2::IXMLDOMDocument **xmlout) {
IXMLDOMDocumentPtr myDoc;
CComPtr<msxml2::ixmldomdocument> myDocIn(xmlin);
CComBSTR mtemp;
if (myDocIn)
myDocIn->get_xml(&mtemp);
HRESULT hr=CoCreateInstance(CLSID_FreeThreadedDOMDocument30, NULL,
CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument2,
(void **)&myDoc);
if FAILED(hr)
return S_FALSE;
CComBSTR bstrDummy("<demo>");
bstrDummy.Append(mtemp);
bstrDummy.Append("");
myDoc->loadXML(bstrDummy);
*xmlout=myDoc.Detach();
return S_OK;
}
2.
I'm using Stress Tool to instance the object, using a ASP page. after running the stress with 40Threads and for 5/10 minutes the memory doesn´t stop growing...(very small chunks). Its there anything I should know about you said for "funny memory management"...
thanks again.
|
|
|
|
|
I assume that 'CComPtr' is really 'CComPtr<ixmldomdocument2>'. You are right there seems to be no leak point, except for 'BSTR *docOut', but it is used from script so we can assume it is released.
'mOut=CComBSTR(L"Error").Detach();' seems suspicious, but it would not leak mach anyway.
2. From our experience with MSXML we noticed that they preallocate memory with factor of 10 to size of actual document and it is not always released right the way, which in IIS environment could be frustrating. Plus if you use something like USES_CONVERSION it has the same simptoms because it uses stack memory allocation. Depends how big your leak is. I guess you can try your stress for couple of hours(days), see if you run out of memory. It could be normal IIS opertaion not to recicle until you reach phisical memory limit.
|
|
|
|
|
I already used the stress for some days, and the result was that I get 100/200 MB of RAM used for the component, and 100/200MB for the ISAPI/ASP page...
I don't know if this is normal, on that particular case the phisical memory has not been reached, so I will test again for more days, and see if the memory freezes or not.
thanks,
|
|
|
|
|
From listenning to others' experiences, it seems that the MSXML parser has all kinds of memory leaks.
Even a broken clock is right twice a day.
|
|
|
|
|
Hi i am working for a project where i need to provide an option of customization of the application to the user with only providing him the object file ( no source code will be given to user) all he need to do is start the customization utility and simply browse through some options and can get the executable as per his needs, i need to know any idea in order to achieve it.
urgent replies will be deeply appreciated.
thanks
gracias
gracias carol
|
|
|
|