|
Hi,
Is there any standard for return values from a function, for example if my function returns only two value(true/false) then i would like to assign bool as its return value, but if i have got three values(0,1,2), then what data type should be the used as return value.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language, so please don't mind if i do some grammatical or spelling mistakes in my messages."
|
|
|
|
|
you have plenty of types. if the function may return little integers, char is good enough. but short, int, long are possible choices.
|
|
|
|
|
If the function may return only a small set of integers (such as {0,1,2}) then the enum type is a good choiche. Usually you can assign to each member of the set a meanigful name:
enum TrustLevel
{
LOW = 0,
AVERAGE,
HIGH
};
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.
|
|
|
|
|
return int . so you can return up to 2 billion.
dlfkgj lsdfkglfkgjlfgl jldfk fldkk jk
|
|
|
|
|
Kenan Aksoy wrote: 2 billion
That's all? What if you need more in the future? You have to think ahead, you know.
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Actually 4 billions
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.
|
|
|
|
|
i'm new in programming c++. i only learn to use win32 console application..
i want to load, view an image(any jpg,bmp,gif) to my program. the picture will be view after i click some number and the picture will be assign to that number only..
i try to use 'swicth', but then i only manage to click number but don't know how to assign picture to that number..
|
|
|
|
|
You can use of CImage class for load bmp,jpg,gif,png.
CImage m_Image;
m_Image.Load(your file);
|
|
|
|
|
where should i put that code?
i've try to put in like this, but it get error.
<br />
void test(int z){<br />
<br />
CImage m_Image;<br />
<br />
cout << "You have press " << z << endl ;<br />
switch (z)<br />
{<br />
case 1 : cout << "Picture 1 is\n":<br />
m_Image.Load(pic1.jpg);<br />
<br />
break;<br />
.........<br />
....}<br />
}<br />
is it the same as CxImage?
|
|
|
|
|
Whats the error? and not its not same with CXImage.
|
|
|
|
|
Are you using MFC, or just the Win32 API? Is this a console or GUI appliocation?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
just win32 API console application..
|
|
|
|
|
Console applications cannot display GUI images.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
so i have to use win32 app or mfc?
it is still using c++ programming?
or the different is just the Project?
|
|
|
|
|
You can develop a console application using Win32, MFC, or both. You can also develop a GUI application using Win32, MFC, or both.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello All
I want to programatically send email to my ID (Yahoo or gmail) with an attachment. I am very new to email programming. Can any one suggest where to start with?
Thanks for your time
BlrBoy
|
|
|
|
|
|
Hi All,
I use dc.GetPixel() dc.SetPixel() functions to render bitmaps with my color and then StretchBlt on to my Paint dc.I do StretchBlt of around 16 bitmaps on Paint DC.As a result my painting is delayed by 3 secs.
So, Is there any otherway other than GetPixel() and SetPixel() to reduce the delay?
Thanks in Advance
Today is a gift, that's why it is called the present.
|
|
|
|
|
A replacement to GetPixel, is to use GetBitmapBits and access the memory directly.
<br />
BITMAP bm= ###;
<br />
int datasize = bm.bmWidth*bm.bmHeight*bm.bmPlanes;<br />
COLORREF* lpClrData = (COLORREF*)LocalAlloc(LPTR, datasize * sizeof(COLORREF));<br />
DWORD ds = GetBitmapBits(hBitmap, datasize * sizeof(COLORREF), lpClrData);<br />
<br />
COLORREF pixelColor = lpClrData[y*imageWidth+x];<br />
<br />
This is much faster that GetPixel...
I haven't had to deal with SetPixel (but i'm sure with the above you should be on your way to finding a solution).
Cheers,
Jubjub
"If you're too careful, your whole life can become a f---in' grind." - Mike McD ( Rounders)
|
|
|
|
|
Jubjub,
is this work with any color resolution?I remember that I try something similar in past,...and I remember that I fonund many problem if the system was 16k colors, where 2 Bytes are used to define the pixel color.
Russell
|
|
|
|
|
narayanagvs wrote: to render bitmaps with my color
What do you mean by this? What are you actually doing with the pixel values?
This would determine how best to efficiently access the pixels IMO.
If you need pixel access then I would recommend using a DIB section, which gives you an HBITMAP
for GDI operations along with a pointer to the pixel bits for direct manipulation.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Hi everyone
I called CFileDialog.DoMOdal() like this, for save file.
CFileDialog OpenDlg(FALSE ,"Lic", "*.Lic",OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, "*.Lic", this);
if exist new file name in selected path I want show a warring for file replacing.
How do you do it? Please help me.
|
|
|
|
|
Have a look at OFN_OVERWRITEPROMPT flag.
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.
|
|
|
|
|
thank u very much
good luck & Good bye
|
|
|
|
|
Hi All,
I'm writing an ActiveX control, and one of the methods needs to return an array of bytes. This array then needs to be used in Javascript and posted via the MSXML2.XMLHTTP (send).
I've create a method in my ActiveX class that returns a VARIANT, but what ever way I try to create the VARIANT, this fails.
Either I get "type mismatch" when I try to use the data returns, or I get a "Variable uses an Automation type not supported in JScript".
Does anyone know some easy way to return a byte array and use in javascript?
Cheers,
Jub
"If you're too careful, your whole life can become a f---in' grind." - Mike McD ( Rounders)
|
|
|
|