|
The best you can get it a 100ns resolution. Search for the "multimedia timer" in MSDN.
|
|
|
|
|
Now, I wanna ask 2 questions about CDC::DrawText(...).
As you know, besides supplying the text to be drawn, you also gotta tell the function the bounding rectangle to draw the text in.
1) If we specify the bounding rectangle to be far much more larger than the text(for e.g : CRect(10,10,600,600) to hold just the word "Xeon", in small fonts), DrawText(...) will auto-shrink and auto-size the bounding rectangle to fit the size of the text, right?
2) Is this behaviour the same on all versions of Windows? MSDN doesn't say too much about this at all.
Please and thanks a lot!
......
|
|
|
|
|
1. DT_CALCRECT will make the rect fit the size of the text drawn without any actual drawing. If you don't specify this switch, I think DrawText leaves the rect untouched.
2. Unless otherwise noted, functions tend to behave the same across OSs. I don't see any reason to think this is different for DrawText . Have you detected any anomaly?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
If you don't specify this switch, I think DrawText leaves the rect untouched.
Hi there and thanks a lot, Joaquin! But I do think that DrawText(...) do fit this rect to the overall size of the text.
I did an experiment on a dialog-based program with a grey background. I called CDC::DrawText(...) as in :
<br />
void CMyProgramDlg::OnPaint()<br />
{<br />
else<br />
{<br />
CPaintDC dc(this);<br />
dc.DrawText("I am Xeon.",CRect(10,10,1000,1000),NULL);<br />
CDialog::OnPaint();<br />
}<br />
}
And guess what? The text is drawn within a rectangle that fits the text exactly, cos' u see, the background color of the text is white, and the style is OPQAUE. And white against a grey background, we can easily see the size of the rect used to hold the text.
Joaquín M López Muñoz wrote:
. Unless otherwise noted, functions tend to behave the same across OSs. I don't see any reason to think this is different for DrawText. Have you detected any anomaly?
No.....I haven't a chance to detect any anomalies, cos' I don't have more than 1 OS to test out. But 'm always really suspicious of a same program running on different Windows OSes. I've heard that lotsof programs behave in different ways across different OSes, and that's a total headache.
......
|
|
|
|
|
Hi All - I'd love to know how I can get DevStudio VC6 to fire calls at my Addin's OnIdle() method - or at least to tell me somehow it's not doing anything and that I could do something during idle time.
Since the addin's are not allowed to run their own message pump (aka DevStudio application model is not thread safe) I can't just go ahead and slap a message queue in there with a thread to manage it.
What I've got is a socket connection to another server WITHIN MY ADDIN, and I want to be able to check whether there's any input on the socket during idle time.
I was also wondering if I could create a another thread then kinda 'post' messages across this thread boundary - but it requires that I hook something into the DevStudio message loop - which I don't know how to get hold of.
Any help is massively appreciated! Thank you.
--
John Clayton
|
|
|
|
|
Anyone know how to do this?
Spy shows the system tray as a single window (with no children) so getting the window rect for that is no problem but can I then locate where my icon is within the systray?
|
|
|
|
|
I have very strange behaviour of application. It´s transfer of data with TCP/IP. I´m using ovellaped WSARecv, WSASend. There was no problem on Windows 98, NT 4, 2000...but on XP it doesn´t work. For example, when transferring data block whom size exceed 3760 bytes, on W2000 is complete, but on XP is limited to 3760. I´m talking about tests on local machine, but on network was result similar(i´dont know exactly how many bytes was transferred).
Sorry, my English it´s not very good, but I believe you understand
|
|
|
|
|
Maybe just the XP stack has a lower MTU? Start by checking that (getsockopt with SO_MAX_MSG_SIZE).
|
|
|
|
|
Thanks but...maybe I said it wrong, I talked about connection oriented socket, not UDP.
|
|
|
|
|
Hi i tried to reduce my memory leak.I reduced that,but still only few bytes of memory leak.I checked everything,but still i cant find.Pl anybody can help.Thanks in advance.
HRESULT hr;
IXMLDOMDocument2 *pIXMLDOMDocument2=NULL;
IXMLDOMNodeList *pIXMLDOMNodeList=NULL;
IXMLDOMNode *pIXMLDOMNode=NULL,*pIXMLDOMNode1=NULL;
IXMLDOMNamedNodeMap *pIXMLDOMNamedNodeMap1 = NULL;
VARIANT_BOOL boolvalue;
long Tablelen;
CComVariant Tablename;
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IXMLDOMDocument2, (void**)&pIXMLDOMDocument2);
CComVariant varValue="testing.xml";
if (FAILED(hr))
return(hr);
if(SUCCEEDED(hr))
{
hr=pIXMLDOMDocument2->load(varValue,&boolvalue);
pIXMLDOMDocument2->selectNodes((_bstr_t)"DATABASE/TABLE[@Left]",&pIXMLDOMNodeList);
pIXMLDOMNodeList->get_length(&Tablelen);
HWND hListBox=GetDlgItem(hDlg,IDC_LIST);
pIXMLDOMNodeList->reset();
for(int i=0;i< Tablelen;i++)
{
pIXMLDOMNodeList->get_item(i,&pIXMLDOMNode);
pIXMLDOMNode->get_attributes(&pIXMLDOMNamedNodeMap1);
pIXMLDOMNode->Release();
pIXMLDOMNode=NULL;
pIXMLDOMNamedNodeMap1->getNamedItem((_bstr_t)"Name",&pIXMLDOMNode1);
pIXMLDOMNode1->get_nodeValue(&Tablename);
SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)(char *)(_bstr_t)Tablename);
pIXMLDOMNode1->Release();
pIXMLDOMNode1=NULL;
pIXMLDOMNamedNodeMap1->Release();
pIXMLDOMNamedNodeMap1=NULL;
}
CHECK_AND_RELEASE(pIXMLDOMDocument2);
CHECK_AND_RELEASE(pIXMLDOMNode1);
CHECK_AND_RELEASE(pIXMLDOMNodeList);
CHECK_AND_RELEASE(pIXMLDOMNode);
CHECK_AND_RELEASE(pIXMLDOMNamedNodeMap1);
}
CoUninitialize();
|
|
|
|
|
Jesus!!! Does this code work???
<br />
(_bstr_t)"DATABASE/TABLE[@Left]"<br />
What is this? Never, never do like this. Do:
<br />
_bstr_t(OLESTR("DATABASE/TABLE[@Left]"))<br />
<br />
pIXMLDOMNode->Release();<br />
pIXMLDOMNode=NULL;<br />
It's not bad, but pIXMLDOMNode = 0 is enough.
<br />
(LPARAM)(char *)(_bstr_t)Tablename<br />
Should be:
<br />
reinterpret_cast<LPARAM>(static_cast<TCHAR*>(_bstr_t(Tablename)))<br />
Such a bad cast should be explicit.
<br />
pIXMLDOMNode->get_attributes(&pIXMLDOMNamedNodeMap1);<br />
You are working with very smart pointer. Instead, do like this:
<br />
pIXMLDOMNamedNodeMap1 = pIXMLDOMNode->attributes;<br />
What is:
<br />
CHECK_AND_RELEASE(pIXMLDOMDocument2);<br />
May be it a:
<br />
#define CHECK_AND_RELEASE(x) x->AddRef()<br />
I don't know.
Summary.
1. Never, never use c-casts (like (_bstr_t)x, (LPARAM)y, etc). They are the worst evil, unless you damn sure that you do. It's very hard to find a bug in a such code.
2. Read about _com_ptr_t. Learn how it's intended to use.
3. Avoid macros.
4. Optional, but strongly recommended. Get a Stroustrup.
|
|
|
|
|
Hello,
I have programmed a dialog based application and now i want to add a nice jpg image in the dialog.
Does someone know a simple way? Or does someone know a place where i can download a Control, which i can add to my project.
Thank you,
Willem
Sorry for my bad english..
|
|
|
|
|
This may be of some use,
http://www.codeproject.com/bitmap/cximage.asp[^]
Michael
"I've died for a living in the movies and tv.
But the hardest thing I'll ever do is watch my leading ladies,
Kiss some other guy while I'm bandaging my knee."
-- The Unknown Stuntman
|
|
|
|
|
|
hi
is there a way to copy a file to the same directory and renaming the file all in one. I've tried CFile::Copy, then rename, then copy again, but it seems a bit clumsy...
Thanks
|
|
|
|
|
Adrian2 wrote:
is there a way to copy a file to the same directory and renaming the file all in one. I've tried CFile::Copy, then rename, then copy again, but it seems a bit clumsy...
What exactly do you want to accomplish? Say you have a folder :- c:\abc. Now say you have a file one.gif. You want to copy c:\abc\one.gif to c:abc\two.gif and then rename one.gif to something else??? Is that what you want to do? If so, copy abc.gif to one.gif. Now rename abc.gif to whatever.gif! Pardon me if I misinterpreted your requirement.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
jip
c:\file1.txt must become c:file2.txt
|
|
|
|
|
|
Or use ShFileOperation, which I think let you move/copy files when they are open.
|
|
|
|
|
I'm preparing to develop a web stress testing software.Could someone give me some advices, such as how to realistically reproduce multiple
browsers requesting pages from a web application, what technologies should we adopt...
Our software is aiming to realize three main fonctions:
1. simulate a request to the web server, and trace the process, in order to see if the web
application works normally. If there is a problem, we could know where is it. web server?
database? etc
2. automatize the test, that means to set the test automatically executed in a fix time.
3. simulate multiple users send the request to a website simultaneously, to verify if the web
application works properly under a given enough great number of users.
Thanks a lots!
rick
LOVE LING
|
|
|
|
|
ricklau wrote:
3. simulate multiple users send the request to a website simultaneously, to verify if the web
application works properly under a given enough great number of users.
This can be done using multiple threads. Start n threads and get them all to attack a particular portion of the web site at the same time.
ricklau wrote:
2. automatize the test, that means to set the test automatically executed in a fix time.
You can either feed in a predefined set of URLs. Or you can parse the URLs in a web page and go to each of them automatically. And you'd also have to populate the form text and other fields with random data (sounds rather like a lot of work to me).
ricklau wrote:
1. simulate a request to the web server, and trace the process, in order to see if the web
application works normally. If there is a problem, we could know where is it. web server?
database? etc
I doubt if you can locate the error precisely. It might be a db error but the error might be due to buggy server side scripting.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
|
Hi there,
I want to capture screenshot as well as keystrokes pressed in DOS mode. I have worked on Windows API for achieving these results. It is working fine in case of windows application. I just want to know why it is not happening in DOS promp mode. Is there anyway to achieve this.
I need expert guidance from all of you before reaching any conclusion on this part.
Thanks in advance,
Shitij.
|
|
|
|
|
Hi there,
I want to capture text and password field for an active window. Is there anyway to achieve this.
Thanks in advance,
Shitij.
|
|
|
|
|