|
I would like to know if there is a way to store a character in a type int variable. I would still like the variable to be able to store integers, but if a certain charcter is entered I would like the program to do something else.
example:
int number;
cout<<"Enter a number: "; //This is where I would like to enter 'c'
cin>>number;
if(number=='c')
{
...
}
else
{
...
}
can you please help?
dudeoffrance
|
|
|
|
|
dudeoffrance wrote:
if(number=='c')
Which is equivalent to:
if (number == 99)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
well yes u can.....
character is just i byte where as and integet is four bytes.....
by doing the above code.....that u have listed.....u will get the ascii value of the character......
search for the ascii table....it will give the corresponding values for a character variable.....
in ur case the character 'c' has an intef=ger value of 99.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
currently i have the SID of all group. I would like to iterate the list of sid and enumerate all group names. how could i do this?
you can tell me another way
thanks in advance.
Sebastien
|
|
|
|
|
Try LookupAccountSid() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hiho@ll
my app uses a tray icon, which show some information using a tooltip if the mouse is over the tray
on my windows XP service pack 2 it works
on another windows xp service pack 1 it works
on another windows xp service pack 1 it doesn't work
and so on
it seems that my tray isn't notifyed, if the taskbar hasn't the focus
i mean something like this:
the working method:
1. click my app to the systray
2. do something other (open other windows, browser, office etc.)
3. move the mouse cursor over my tray icon -> show some information
the confusing method:
1. click my app to the systray
2. do something other (open other windows, browser, office etc.)
3. move the mouse cursor over my tray icon -> it doesn't show any information
4. click in the taskbar on any free space
5. move the mouse cursor over my tray icon -> it shows the information needed
????
can the taskbar have a focus?
why doesn't it work?
thx@ll
|
|
|
|
|
hiho@ll
i've solved the problem!
did ya know that windows differs between always on top in the tray?
well if the application is set to always on top before minimize to tray it gets every mouseover etc. event
if it's not it only gets notified if the icon has been clicked
|
|
|
|
|
Hi,
I developed ini read and write file, it doesn't support multilanguage, it means the ini file containing more than one language, how do i read multilanguage.
Always welcome for your suggestions,
Regards,
Inbhakumar.
|
|
|
|
|
can someone send to me netcons.h please.
sebnadeau@gmail.com
|
|
|
|
|
What's it for (i.e., what needs it)?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hello to all members
i am making vc++ desktop service application. this application communicate with clients on the port 3310.
i want to exchange data through SOAP objects. how can my service read and
reponse to client using SOAP.
i am new in vc++ services so i don't know how to handle this type of programming. please help me to sortout my problem.
ur suggestions are required.
thanks in advance.
Ashutosh Tripathi
|
|
|
|
|
Hi,
I have a CDHtmlDialog derived class that is causing me a problem. Every 3rd time I create an instance and call DoModal() I get an access violation occuring inside the CDHtmlDialog::OnInitDialog method and it is being caused by the m_wndBrowser member being NULL .
The problem occurs in this part of the method:
if (m_pBrowserApp == NULL)<br />
{<br />
m_wndBrowser.CreateControl(CLSID_WebBrowser, NULL, WS_VISIBLE | WS_CHILD,<br />
rectClient, this, AFX_IDC_BROWSER);<br />
lpUnk = m_wndBrowser.GetControlUnknown();<br />
if (FAILED(lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp)))<br />
{<br />
m_wndBrowser.DestroyWindow();<br />
DestroyWindow();<br />
return TRUE;<br />
}<br />
}
The call to m_wndBrowser.CreateControl() fails causing the m_wndBrowser to be set to NULL.
I tried reusing one instance of my class and repeatedly calling DoModal() on the same object and the same thing happened. Can anyone suggest what might cause the create call to fail after two previous successful calls?
All help appreciated because this has been bugging me for a while now.
Thanks,
Ewan
|
|
|
|
|
Are you calling the base class OnInitDialog() before trying to use the m_wndBrowser ?
Also, I assume that the m_pBrowserApp variable is set back to NULL at appropriate times, so that your tests are valid.
|
|
|
|
|
The code I showed was from the base class implementation not from my code. I only included it to illustrate where the problem was occurring. I'm not touching any of the members of the CDHtmlDialog class. That's why I'm confused by what is happening because none of my code does anything other than call CDHtmlDialog::OnInitDialog() .
|
|
|
|
|
This seems a bit strange.
If your code is encapsulated enough, can you post the example of where/how you create the dialog instance and where you call DoModal() and anything you do to the dialog class instance between creating the instance and calling DoModal()?
It seems like sometimes either the browser widnow is not crated or the browser pointer is not null. Can you look into why that might be the case? It seems strange to me that the base class code does not verify that the create window call succeeds prior to trying to create the com interface.
|
|
|
|
|
Did you ever figure out what was going on? I'm having the same issue...or very close..
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Just been taking a quick look over the SDK for DirectX and see that it has support for DVDs. Does anyone know whethere its possible to use the API to grab images from a DVD?
Cheers
|
|
|
|
|
Hi,
I'm trying to fire an even from an C++ ActiveX that has a "by reference" parameter:
dispinterface _IMyEvents
[id(4)] void ButtonClicked(IMyProperty * prop, [in, out, ref] VARIANT_BOOL * bDataChanged);
However, the Fire_Event proxy code generated by the wizard complains about the byref value:
pvars[0] = bDataChanged;
it's just a warning (short * truncated to bool), but it clearly indicates it doesn#t work as intended (CComVariant does not support reference values).
So - anything I can do?
The only alternatives I see are:
- write the fire_xxx wrapper myself (yuck!!!)
- provide a COM object with a "SetModified" flag instead (seems overkill)
- hack CComVariant into accepting a VARIANT_BOOL * as BYREF value (yuck yuck)
(The mechanism I need is similar to IPropertyNotifySink, but I want to support VB clients, so I can't work with S_OK / S_FALSE return value)
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
ALOK
I WANT TO CONVERT BACK A BSTR FILE TO A STRING FILE. IS IT POSSIBLE to CONVERT BSTR TO WIDE CHARACTER AND THEN (USING WideCharToMultiByte )TO CHARACTER
|
|
|
|
|
There are many ways to convert BSTR TO STRING , here i am mentioning TWO!
1.wcstombs(...)
2.using String Conversion Macro LIKE W2T ,T2BSTR ....., but you have to enable String Conversion Macro by using USES_CONVERSION; macro
yeah you can use
WideCharToMultiByte , but this api always confuse me lot!
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
BSTR AND WIDECHARACETR(UNICODE) R SAME.
|
|
|
|
|
Buddy!
BSTR and Wide Character has almost same format for character representation. so you can use wcstombs or string conversion macro stated above!! to convert them from wide character to multibyte character string, just try!!!
or if you are using MFC , CString expose some function for BSTR tooo,like CString::SetSysString , CString::AllocSysString
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
Please don't shout! My ears hurt.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
BSTR is just a WORD string (16 bits for each value).
if the BSTR contains 0 (zero), you can not convert it to CString because CString can not contain zero.
if not, do this way:
//assume length of BSTR is iNum
//cs is CString, bstr is BSTR
for(i=0;i<iNum;i++)
{
cs+=(char)bstr[i];
}
very easy
includeh10
|
|
|
|
|
I am using the Following code :
When i call it first time to copy data , then i paste it in any MS word or Excel it works , On Second time when i copy the data the Program Crashes At the statment :
/////pData->SetClipboard();
CopyData()
{
CDC* dcRef = GetDC();
tagSTGMEDIUM * data;
data = new tagSTGMEDIUM;
CMetaFileDC * dcMeta;
dcMeta = new CMetaFileDC();
if(!dcMeta)
{
AfxMessageBox("Unable to Load data on Clipboard");
return;
}
COleDataSource* pData = new COleDataSource;
//replace "ImageName" with a description of this image
dcMeta->CreateEnhanced(dcRef, NULL, NULL,"Cca-Graph" );
dcMeta->SetMapMode(MM_TEXT);
dcMeta->SetAttribDC(dcRef->m_hAttribDC);
//actually draw to the device context
CRect rcWnd;
GetClientRect(&rcWnd);
//draw meta file :: do what ever you want to do: bitmaps, lines, text...
DrawChart(dcMeta, rcWnd, false);
//done drawing
data->tymed = TYMED_ENHMF;
data->hEnhMetaFile = dcMeta->CloseEnhanced();
pData->CacheData( CF_ENHMETAFILE, data );
////////////// Crashes Here when called Second time //////////////////////
pData->SetClipboard();
// Release the meta file attributes
dcMeta->ReleaseAttribDC();
delete dcMeta;
delete data;
}
Regards.
|
|
|
|