|
CPallini wrote: The above will fail on fVal = 1.051000
How so? strTemp has a value of 1.
CPallini wrote: Actually it fails also on his input (610.15100000).
It worked fine for me. strTemp has a value of 610.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: It worked fine for me. strTemp has a value of 610.
But it needs to be 610.151. Thanks though!
KR
|
|
|
|
|
So use .3 instead of .0 then.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I think he wants to remove trailing zeroes in a general way, i.e. that his input was just an example.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: I think he wants to remove trailing zeroes...
Yeah, I read it wrong. I thought he wanted to remove everything after the decimal. Sorry for the confusion.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You may use strTmp.TrimRight(_T("0")); to the purpose.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
strTmp.TrimRight(_T("0")); works as long as I have numbers after the decimal, but if I don't, it leaves me with whole numbers that end with a decimal, i.e:
610.00000
would become: 610.
However, strTmp.TrimRight(_T(".0")); seems to work! Thank you much!
KR
|
|
|
|
|
Please tell me how to use the functions present in a DLL file in a new WIN32 console application.
I want to use a function from an existing DLL file, in a new program.
Thanks.
|
|
|
|
|
|
On Visual Studio, usually you have to:
(1) include the library header file
(2) add the library .lib file to you project.
(3) make the IDE know about the folder path of your library .lib file.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
There is a dialog and it has more than one controls.I want to get all these controls to set or change some their properties at runtime. To do this , i use that code.
<br />
CWnd* pChildWnd = wnd->GetWindow(GW_CHILD);<br />
<br />
while ( pChildWnd )<br />
{<br />
pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);<br />
} <br />
But i can't get controls and this while loop enters infinite loop. Please help me to get all controls. Thanks.
|
|
|
|
|
mehmetned wrote: There is a dialog and it has more than one controls.I want to get all these controls...
Can't you use EnumChildWindows() ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
It was very useful for my problem. thanks
|
|
|
|
|
Its good news for me it was helpful for you.
|
|
|
|
|
Hamid. wrote: Its good news for me it was helpful for you.
Hows life going dude... evrything ok at your END
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi Experts,
I have written a shell context menu COM dll. It is working fine on all files and folders. But this is not coming on briefcase. How can I achieve that.
|
|
|
|
|
I would suspect that the briefcase is not a real directory, but a namespace extension (like the recycle bin). In which case, you might be out of luck.
For this sort of thing, I use regmon from sysinternals. Navigate to the "directory", start regmon going, and see what COM reads explorer does when you right click on a briefcase item. It may not even look at the keys you have your extension registered under, which would be a hint to give up, or look if any of the keys it *does* look at give you any ideas.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hi!
I'm trying to make all DropDown-Menus transparent, using a WH_CBT hook.
Unfortunately it does not work ...
Here is the Hookprocedure:
<br />
LRESULT CALLBACK TransWindowProc(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
if (nCode < 0)<br />
return CallNextHookEx(g_hTransHook, nCode, wParam, lParam);<br />
<br />
<br />
<br />
if (nCode == HCBT_CREATEWND)<br />
{<br />
<br />
HWND handle = (HWND)wParam;<br />
<br />
LPWSTR szClass = new WCHAR[128];<br />
GetClassName(handle, szClass, 127);<br />
<br />
<br />
<br />
if (lstrcmpi(szClass, TEXT("#32768")) == 0)<br />
{<br />
<br />
SetWindowLong(handle, GWL_EXSTYLE, GetWindowLong(handle, GWL_EXSTYLE) | WS_EX_LAYERED);<br />
SetLayeredWindowAttributes(handle, 0, 200, LWA_ALPHA);<br />
<br />
}<br />
}<br />
return CallNextHookEx(g_hTransHook, nCode, wParam, lParam);<br />
}<br />
The hook itself is in a dll and is installed correctly. The if-statement is entered, but no transparency is set.
Can anybody please help ?
|
|
|
|
|
Hi,
I was trying to find some way to change a const value using pointers (just for the hell of it).
I guessed const is a compile time restriction and not a runtime one.
I came across this.
The code compiles and runs without any error.
It displays 12 20, even though the code suggests p and y must be having a value of 20.
I am surely missing something here. Please help.
<br />
void main()<br />
{ <br />
int *px;<br />
const int p = 12;<br />
px = (int *)&p;<br />
*px = 20;<br />
int y = p;<br />
cout << y << " " << *px; <br />
}
Then I tried this.
I made p a global variable. This one compiles without any error or warnings(highest level).
However throws access violation on *px = 20; at runtime! This is against my (wrong?) understanding of const.
Please can someone throw some light on this issue?
<br />
const int p = 12;<br />
void main()<br />
{ <br />
int *px; <br />
px = (int *)&p;<br />
*px = 20;<br />
int y = p;<br />
cout << y << " " << *px; <br />
}<br />
I used MSVS 6.0 compiler.
modified on Friday, April 18, 2008 9:38 AM
|
|
|
|
|
I have a (very loose) theory, but words escape me at the moment. Making a variable const only tells the compiler to not allow reassignment of p . The data (of p ) is not in a special location, it can still be altered by px (to 20). When you printed the value of p in the first example, even though it had been changed indirectly by px , the compiler knew that it was a const and thus returned its original, read-only value.
That's as bad of a description as I can give you at this point.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi David,
Thanks for the reply, I really appreciate it.
Definitely compiler is playing some role here. I will check the assembly code that's generated.
I am wondering how the runtime error is generated in the second part of my problem.
Thanks
Paul
|
|
|
|
|
In the second case the compiler has almost certainly placed p into a readonly segment as it's a global constant. I know MSVC 6 does this with strings so it's not really a great surprise it does it with an int.
In the first case I would speculate that you're falling foul of optimization. Try turning off all optimization in you compiler/project settings and see if it still occurs. I would certainly class that as a compiler bug though, not the only one in VC6 by a long chalk
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Matthew Faithfull wrote: Try turning off all optimization in you compiler/project settings and see if it still occurs. I would certainly class that as a compiler bug though, not the only one in VC6 by a long chalk
I turned off optimization and the misbehaviour still stands (even on VS2008 compiler).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
spot on Matthew!
I did a disassembly and ds:dword_4110E8 is indeed in .rdata and hence the error.
the first issue, I am still getting it even with optimization off.
<br />
_main proc near ; CODE XREF: start+AFp<br />
.text:00401080 push 14h<br />
.text:00401082 push offset unk_4140B0<br />
.text:00401087 push 0Ch<br />
.text:00401089 mov ecx, offset unk_417EE0<br />
.text:0040108E mov ds:dword_4110E8, 14h<br />
.text:00401098 call sub_4010B0<br />
.text:0040109D push eax<br />
.text:0040109E call sub_4014E0<br />
.text:004010A3 add esp, 8<br />
.text:004010A6 mov ecx, eax<br />
.text:004010A8 call sub_4010B0<br />
.text:004010AD retn<br />
.text:004010AD _main endp<br />
<br />
.rdata:004110E8 dword_4110E8 dd 0Ch <br />
modified on Friday, April 18, 2008 4:38 PM
|
|
|
|