|
Are you sure that the variant in vtProp is a BSTR ? You should always check the value of vtProp.vt , as that tells you which data member of vtProp is valid. You can then convert vtProp to be a string using the VariahntChangeType function.
|
|
|
|
|
I used vtProp.vt parameter and it's returning 3 and in debug window its showing I4 = 255. Now what should i do to print this value?
|
|
|
|
|
Easiest way is to change the variant to a BSTR using VariantChangeType
VariantChangeType(&vtProp, &vtProp, 0, VT_BSTR);
AfxMessageBox(vtProp.bstrVal);
|
|
|
|
|
i want to display multiline tooltip on popup menu when mouse is moved over popup menu.
thanks in advance.
|
|
|
|
|
|
|
I have created an SDI application which i want to start maximised and disable the Restore button. For which i have written the following line in IniInstance().
m_pMainWnd->ModifyStyle(WS_MAXIMIZEBOX,0);
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
m_pMainWnd->UpdateWindow();
With the above lines the window is shown maximised and the Restoredown button looks disabled. But when I double click the Titlebar, the window is being restored and can not be maximised then.
I want the window to be maximised or minised, but not to be resotred down.
How to do that.
Thank you
Saadhinchaali
|
|
|
|
|
You're probably better off handling WM_GETMINMAXINFO , and telling Windows what you want the minimum and maximum size of your window to be (hint: same size as the screen!).
|
|
|
|
|
Try handling the WM_SYSCOMMAND messages (OnSysCommand) and swalow the restore (SC_RESTORE) message. Don't know how reliable that is though...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
|
Check out this[^]and this[^]. Those links will be helpful.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
i hv a button(IDC_NEXT) thats functionality against mouse clicking is to switch to another dialog thats all fine but when i press space bar then execute the button clicking code and move to next dialog , i want to restrict it. for this i hv used pretranslate Message where capturing space bar event but still it execute function onNext() that is called when click next button so how to restrict this
if ((pWnd->GetDlgCtrlID() == IDC_NEXT))
{
if(ConfigMessage==VK_SPACE)
{
}
}
|
|
|
|
|
Is the input focus on your next button? Because if yes, then don't wonder it gets pushed when someone hits SPACE, it's written that way. If you don't see the focus rect, press ALT on your keyboard, that should make it appear, and if it sits on your button... if you only want the command message from the button when the user clicks on it and not when he uses the keyboard -and in my humble oppinion you shouldn't do that unless it is absolutely needed- you will have to subclass the button and overwrite its keyhit-handler(s).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
timeSetEvent is used to use multimidea timers and setTimer() is used to windows timer
either we can use boht timers at a time to perform different task
or is there any problem to use both timer at a time
what u will prefer we should use only one timer or can we use combination according to requirement
|
|
|
|
|
You can use them both at once. SetTimer is better integrated with the window messaging infrastructure (because it sends a WM_TIMER message on expiry). Multimedia timers are more accurate and have a higher resolution than SetTimer , but are harder to use (I suspect your callback runs in a different thread than the one you call timeSetEvent . Also, there are limitations on what you can call in hte callback).
|
|
|
|
|
My function:
void ConvertToUpper ( char name[] )<br />
{<br />
cin >> name ;<br />
int i = 0;<br />
while(name[i] != '\0')<br />
{<br />
if(name[i] > 'Z')<br />
name[i] += 'A' - 'a';<br />
i++;<br />
}<br />
}<br />
Why when entered, will it take John_Doe, and convert it to JOHN?DOE
|
|
|
|
|
yeah, just think about it a second (or 2 or 3 ) more.
Do/run/simulate your "algo" on paper, and see what happens to the "_" caracter.
This signature was proudly tested on animals.
|
|
|
|
|
void ConvertToUpper(char name[])
{
cin >> name;
int i = 0;
while(name[i] != '\0')
{
if(name[i] >= 'a' && name[i] <= 'z')
name[i] += 'A' - 'a';
i++;
}
}
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
Manish, thanks for the response, I meant--when you input John_Doe, it should translate to JOHN DOE with a space.
Now I see that "_" ASCII value is 95; if I add A - a to "_", i'll get "?".
So where would I add -63 to get a " " instead of a "?" when converting a "_"?
|
|
|
|
|
Why on earth would you wish to make it as cryptic as adding -63 to the numerical representation of the _ character?
Consider the following addition to your unchecked code:
void ConvertToUpper ( char name[] )
{
cin >> name ;
int i = 0;
while(name[i] != '\0')
{
<code>if (name[i] == '_')
name[i] = ' ';
else </code>if(name[i] > 'Z')
name[i] += 'A' - 'a';
i++;
}
}
EDIT: made an error and assigned the = character to name[i] if it was previously _
|
|
|
|
|
I hope you are doing some C/C++ string exercises. Well, I've modified the program for you. It converts small to caps, ignore capital and numbers and converts all symbols to space. Please have a look at it.
void ConvertToUpper ( char name[] )
{
cin >> name ;
int i = 0;
while(name[i] != '\0')
{
if( name[i] >= 'a' &&
name[i] <= 'z' )
{
name[i] -= 32;
}
else if (( name[i] < 'A' ||
name[i] > 'Z'))
{
if( name[i] < '0' ||
name[i] > '9' )
{
name[i] = ' ';
}
}
i++;
}
}
I just thought about my old C/C++ string lessons.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I can only presume you already know about the toupper function built into the C runtime library and want to write the case conversion by hand? Because that's what I'd be using. Or the C++ version, which is locale-aware?
|
|
|
|
|
jonig19 wrote: Why when entered, will it take John_Doe, and convert it to JOHN?DOE
Because that's what you've instructed it to do. Do the math. If the underscore's ASCII value is 95, then:
95 + (65 - 97) = 95 + (-32) = 63, which is the ASCII value of the question mark.
Perhaps you meant to do something like this which only affects lowercase letters:
while (name[i] != '\0')
{
if ((name[i] >= 'a') && (name[i] <= 'z'))
name[i] = name[i] - ('a' - 'A');
i++;
}
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
HI, i am currently developing application in windows ce using c++ language
and i need to be able to execute command line in my program
i ever use system(String) in vs2005 with no problem in xp however,
in windows ce, i always get error that system identifier is not found
do u guys know what keyword that has same functionality with system?
thanks
Arif Liminto
|
|
|
|
|
Hi all,
How does this translate to c++:
string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));
HashAlgorithm XHash = HashAlgorithm.Create("MD5");
byte[] keyArray = XHash.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
XHash.Clear();
TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
tdes.Key = keyArray;
tdes.Mode = CipherMode.ECB;
tdes.Padding = PaddingMode.PKCS7;
This is what I did but i am not sure if its correct because I didnt do the UTF8Encoding part.
TCHAR szKey[] = _T("Key");
DWORD pwlen = _tcslen(szKey);
result = CryptCreateHash(hProv,CALG_MD5,0,0,&hHash);
result = CryptHashData(hHash,(BYTE *)szKey,pwlen,0);
result = CryptDeriveKey(hProv,CALG_3DES,hHash,0,&hKey);
BYTE PadMode = CRYPT_MODE_ECB;
result = CryptSetKeyParam(hKey, PKCS5_PADDING, &PadMode, 0);
Please help me clarify things.
Thanks,
Jayjay
|
|
|
|