|
I have several views reside in ChildFrm, when one of them already created, I want it to appears using SetActiveView(Specific View), but that doesn't work
-- modified at 5:18 Thursday 27th October, 2005
After calling the view's ShowWindow(SW_SHOW/SW_HIDE) in synchronized manner, I solved the problem. But I thought SetActiveView(...) will do it once for all, namely it would bring the specific view on the top of the others and automatic hides other views, but...
|
|
|
|
|
hey...
in my program i am assigning a value to a 'long' variable..on compilation it gives following warnings
1)truncation from Const_int64 to long
2)truncation of Const Value
...though the value is large(13 digit) but it is in the range of 'long' datatype (i.e. -9,223,372,036,854,775,808 to -9,223,372,036,854,775,807)...
what could possibly be wrong ?
thanks
|
|
|
|
|
That's perfectly normal: your compiler doesn't know what is the value contained in your Const_int64 variable ! So it just warns you that you are copying this value into a long that is shorter so a loss of data may occur.
To get rid of the warning, make an explicit cast:
Const_int64 Var1 = ....;<br />
long Var2 = (long)Var1;
In this case, you explicitly tell the compiler you know what you are doing
|
|
|
|
|
Isn't a long 32 bits in VC?
For VC6, sizeof(long) == 4
This gives (according to LIMITS.H):
ULONG_MAX 4294967295 (0xffffffff) Maximum unsigned long value
LONG_MAX 2147483647 Maximum (signed) long value
LONG_MIN –2147483647–1 Minimum (signed) long value
So IMO, a value with 13 digits should be truncated, big time...
You might considder to use the LONGLONG data type. That's a 64-bit signed integer.
|
|
|
|
|
Hi,
i want to use in vc++ 6.0 on windows Xp, xp like scrollbars, but i`m creating the scrollbar control in a dialog witch is in a dynamicaly linked dll...
NG
|
|
|
|
|
Neagoe Gabriel wrote: i want to use in vc++ 6.0 on windows Xp, xp like scrollbars
You can use
manifests[^] for that
|
|
|
|
|
I keep getting compiler errors from this file
wincrypt.h
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinCrypt.h(249): error C2501: 'HCRYPTPROV' : missing storage-class or type specifiers
I've downloaded tutorials from this site..http://www.ultimategameprogramming.com/
The open gl tutorials for windows.
Normality is a weakness...
|
|
|
|
|
#define _WIN32_WINNT 0x0600
#define WINVER 0x0600
and u better use the latest sdk from ms - its free
|
|
|
|
|
Where do I put these declarations? I put them in wincrypt.h and in winbase.h. Still no luck...
Thanks for your help.
Normality is a weakness...
|
|
|
|
|
put them in your stdafx.h or in the source file where you include wincrypt.h you should not be modifying system headers! dingbat!
|
|
|
|
|
Well I tried that with a project having only one source file and no stdafx.h and it didn't work.
Normality is a weakness...
|
|
|
|
|
As a last measure, u can define it in your code:
<br />
typedef unsigned long ULONG_PTR;<br />
typedef ULONG_PTR HCRYPTPROV;<br />
|
|
|
|
|
Hi
I wrote this.
int SelectTest(char * strTest,...)
{
va_list marker;
char *temp = NULL;
va_start( marker, strTest );
temp = strTest;
while(temp)
{
//doing something with 'temp'
temp = NULL;
temp = va_arg( marker, char*);
}
va_end( marker );
...
}
if I call the function with 2 params like SelectTest("test1","test2");
va_arg is called 3 times rather than once.
and last two calls return garbage value (like "\?" )
And I know it would be better to call with Null parameter
(SelectTest("test1","test2",NULL);
Except this, any better idea?? thanks.
|
|
|
|
|
Well, u said it yourself, u better call with NULL in the end of arguments. Coz if u dont, how would your loop know where to end?
The thing is that va_arg doesn't see any 'end_of_args' marker simply because there isn't any end - its just stack and stack all the way down
|
|
|
|
|
plowstar wrote: Except this, any better idea??
Nope. Variable-argument lists must have a terminator.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
How do you interpret this:
while (*p++);
|
|
|
|
|
LABEL:
if(*p)
{
++p;
goto LABEL;
}
Think about it!
INTP
Every thing is relative...
|
|
|
|
|
I actually thought about it, and your interpretation doesnt seem to match what is working.
This piece of code is from:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/obtaining_a_file_name_from_a_file_handle.asp
where p initially points to a:
A:\\0C:\\0D:\\0\0
where \0 represents a single NULL character.
|
|
|
|
|
I am surprised I even looked at that code.
What I showed you was a litteral interpretation of the code you presented. I could even present it in assembly if required (which I will not do).
Let's break it down:
1) Copy the current value into a temporary variable.
2) Increment the current value.
3) Check if the temporary value has a value other than zero. If it does not then stop looping.
That is how it works!
INTP
Every thing is relative...
|
|
|
|
|
With your solution p will point to the first NULL from the beginning, which is not really correct. it will point to the char after the first null. try to trace it and see. but be careful with the string you use, or your program might crash. for eg, use "a\0bb\0ccc\0\0dddd"
I can understand, the code is very deceptive. only a few get it right the first time, and I am not one of them either
thanks!
|
|
|
|
|
Lets make it more accurate then:
343: char* p = "123";
0043CA51 mov dword ptr [ebp-14h],offset string "123" (004df014)
344: while( *p++ ) {};
0043CA58 mov eax,dword ptr [ebp-14h]
0043CA5B movsx ecx,byte ptr [eax]
0043CA5E mov edx,dword ptr [ebp-14h]
0043CA61 add edx,1
0043CA64 mov dword ptr [ebp-14h],edx
0043CA67 test ecx,ecx
0043CA69 je main+4Dh (0043ca6d)
0043CA6B jmp main+38h (0043ca58)
345: return 0;
0043CA6D xor eax,eax
0043CA6F jmp __tryend$_main$1+2Ch (0043cac0)
START_LOOP:
value_type = *p;
++p;
if( value_type == 0 )
goto END_LOOP;
goto START_LOOP;
END_LOOP:
INTP
Every thing is relative...
|
|
|
|
|
Looks like someone is trying to write hard to read code, that does nothing.
I believe that * gets called before ++, which would mean that a pointer is dereferened, and incremented, then the new value is returned. This code will run until that value is zero, and it's basically the same as
*p = 0;
but it will take a little longer.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
that someone is none other than a micrsoft sample code.
This piece of code is from:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/obtaining_a_file_name_from_a_file_handle.asp
where p initially points to a:
A:\\0C:\\0D:\\0\0
where \0 represents a single NULL character.
I dont understand what you maen by *p = 0, but this piece of code doesnt modify any data, only pointer advancement. and how that works is still mysterious to me.
|
|
|
|
|
It actually does the ++ first, which means that it increments the pointer until it points to NULL.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: It actually does the ++ first, which means that it increments the pointer until it points to NULL.
Welcome to the gang! you are not alone
PS: check out other posts
thanks!
|
|
|
|