|
According to MSDN, GlobalRealloc should not be used, for reasons of speed as much as anything, unless you're doing something with DDE or the clipboard.
Generally speaking ( assuming you're not using DDE or the clipboard ), you should prefer the C++ memory management functions unless you're programming in C.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I have dialog base application(MFC).
I want my dialog be hidden.when I use:
showwindow(SW_HIDE);
nothing happend??
I also use this in InitInstanc():
CDlg dlg;
m_pMainWnd = &dlg;
m_pMainWnd->ShowWindow(SW_HIDE);
but run time error happen???
|
|
|
|
|
The above code creates an instance of a dialog box, but does not initialise it. You can't show or hide a window that has not been created.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
There's an article on CP describing how to DoModal() on a dialog and have it hide immediately.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Jon Hulatt wrote:
Sorry to dissapoint you all with my lack of a witty or poignant signature.
lol
Put quotes around it and you're there...;)
(sorry - I just couldn't resist it!)
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++
"I would be careful in separating your wierdness, a good quirky weirdness, from the disturbed wierdness of people who take pleasure from PVC sheep with fruit repositories."
- Paul Watson
|
|
|
|
|
Would u please tell me the link?
Thanks a lot
|
|
|
|
|
I don't know if Jon was referring to this post of mine, but anyway there you'll find how to have your dialog hidden on startup.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Why would you want to? compilation of file order is irrelevant!?!
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
The order maybe bases on your head files' order.;P
|
|
|
|
|
Hello,
I have a MDI app. and in the status bar I have a progress control.. The problem I am having is when ever a long function is taking place my app freezes until the function is finished (because of the progress control). If I remove the progress control everything is fast and smooth.. How can I create a progress control in the status bar with out killing my application performance? Here is a sample of the code I use to create the progress control.
void CMainFrame::DownloadProgress(long nProgress, long nProgressMax)
{
RECT MyRect;
m_wndStatusBar.GetItemRect(1, &MyRect);
if (m_bCreate == FALSE)
{
m_Progress.Create(PBS_SMOOTH | WS_VISIBLE | WS_CHILD
, MyRect, &m_wndStatusBar , 1);
m_Progress.SetRange(nProgress,nProgressMax);
m_Progress.SetStep(1);
m_bCreate = TRUE;
}
for (int i = nProgress; i < nProgressMax; i++)
{
m_Progress.StepIt();
}
}
Any pointers?
Thanks,
Rob
|
|
|
|
|
It sounds like you're doing everything in one thread, no? If so, read the VC forum FAQ (link at the top of the page) that addresses your question.
--Mike--
"Why you keep calling me Jesús? I look Puerto Rican to you?"
-- Samuel L. Jackson in Die Hard 3
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
You were correct, I am in a single thread.. Thanks for the post, everything works great.
Rob
|
|
|
|
|
Could anyone help me with the following expressions?
n5-=7+2/3*10
and also
f2=10.0-18.0/-3.0*2.5e-1
Geoffrey A Overley
|
|
|
|
|
Did you try writing a small program to see what results you would get?
Jon Sagara
What about ?
|
|
|
|
|
ok. saying "n5 -=" is equivalent to saying "n5=n5-". the rest of it is down to operator precedence. see "operator presecence" in MSDN.
but, you can make that expression clearer by writing it like this:
n5=n5- 7 + (2 / (3 *10)) ;
why? because in VC++, / has higher precedence that +
the second expression:
f2= 10.0 - (18.0 / (-3.0 * 2.5e-1));
In both cases, i suspect you're getting a different answer than you intended, due to operator precedence. It's good practise to always specify precedence with ()'s.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Jon Hulatt wrote:
n5=n5- 7 + (2 / (3 *10)) ;
This is wrong. It evaluates as I said in the lounge - 2 gets divided by 3 and the result multiplied by 10, so that part comes to zero ( because 2 and 3 are not floats ), but if it gets made 2.0 and 3.0, you get 6.666(10 * .66666), not 0.0666 (2/30). / and * have equal precedence, left to right.
So the correct way to use brackets to show order of operation is
7 + ((2/3)*10)
and the 2 and 3 should be floats in order to get an answer other than 7.
Also, are you recommending not using -= here, or am I misreading you ?
Jon Hulatt wrote:
f2= 10.0 - (18.0 / (-3.0 * 2.5e-1));
Again, this is wrong - put it into a console application and see for yourself. The result is 11.5, not 34 as your bracketing would evaluate to.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
That'll teach me to read the doc's more carefully. I forgot that * and / had equal precedence, in left-to-right order.
I wasn't recommending not using -= at all. from the guys original post it wasn't clear exactly what he was having trouble with.
Anyway, my incorrect answer to the question highlights why it's a good idea to always enforce your own precedence using ()'s. Especially if you use different languages frequently where precedence varies.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Jon Hulatt wrote:
Anyway, my incorrect answer to the question highlights why it's a good idea to always enforce your own precedence using ()'s. Especially if you use different languages frequently where precedence varies.
Absolutely - I use a lot of brackets especially in the case mentioned, where a multiply happens after a divide. It's always better to have brackets show what you assume will happen, just in case your assumption is wrong.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Could anyone help me with the following expressions?
n5-=7+2/3*10
and also
f2=10.0-18.0/-3.0*2.5e-1
Geoffrey A Overley
|
|
|
|
|
Geoffrey, while this question is probably better off here than in the lounge, it was general enough that I answered it there. Either way, please don't ask the same questions over and over, once here is enough.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
What is the best way to download a file with http protocol and actually test to see if that file really does exist? I have looked and looked to no avail. Any help will be greatly appreciated.
Bill? Who's this guy called Bill?
|
|
|
|
|
|
lol Why is it always the obvious things we overlook?
I used OpenURL() but no real way of checking if it exist or not; Unless I make it a complicated task.
Thanks Mike
|
|
|
|
|
Can some one tell me what the problems is...?
LPCTSTR GetBuffer()
{
LPSTR buff = "";
CopyMemory(buff, GlobalLock(m_hBuffer), m_nSize);
GlobalUnlock(m_hBuffer);
return buff;
}
CopyMemory fails!!! I've managed to use similar code for the SetBuffer function.
CopyMemory(GlobalLock(m_hBuffer), buff, m_nSize);
Why does the one work and not the other...?
TIA
"An expert is someone who has made all the mistakes in thier field" - Niels Bohr
|
|
|
|