|
What's the error ? I just did this:
#include "stdafx.h"
#include <vector>
#include <iostream>
using namespace std;
int MyFunc(vector<int> & vec)
{
return vec.size();
}
int main(int argc, char* argv[])
{
printf("Hello World!\n");
vector<int> MyVector;
MyVector.push_back(1);
MyVector.push_back(3);
MyVector.push_back(72);
cout << MyFunc(MyVector);
return 0;
}
and it works fine.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi friends!
Do you know the GradientFill function at Visual C++?
I have acquainted with this function when studying graphic.
And the contents are like below.
( for more information, please refer to MSDN )
/////////////////////////////////////////////
”Drawing a Shaded Triangle”
TRIVERTEX vert [4] ;
GRADIENT_TRIANGLE gTri;
vert [0] .x = 0;
vert [0] .y = 0;
vert [0] .Red = 0x0000;
vert [0] .Green = 0x0000;
vert [0] .Blue = 0x0000;
vert [0] .Alpha = 0x0000;
vert [1] .x = 100;
vert [1] .y = 0;
vert [1] .Red = 0x0000;
vert [1] .Green = 0x0000;
vert [1] .Blue = 0xff00;
vert [1] .Alpha = 0x0000;
vert [2] .x = 100;
vert [2] .y = 32;
vert [2] .Red = 0x0000;
vert [2] .Green = 0x0000;
vert [2] .Blue = 0xff00;
vert [2] .Alpha = 0x0000;
vert [3] .x = 0;
vert [3] .y = 32;
vert [3] .Red = 0xff00;
vert [3] .Green = 0xff00;
vert [3] .Blue = 0xff00;
vert [3] .Alpha = 0x0000;
gTRi[0].Vertex1 = 0
gTRi[0].Vertex2 = 1
gTRi[0].Vertex3 = 2
gTRi[1].Vertex1 = 0
gTRi[1].Vertex2 = 2
gTRi[1].Vertex3 = 3
GradientFill(hdc,vert,4,&gTRI,1,GRADIENT_FILL_TRIANGLE);
///////////////////////////////////////////////
And I have two questions.
1.GradientFill(hdc,vert,4,&gTRI,1,GRADIENT_FILL_TRIANGLE);
I’m curious to know the internal algorism of Visual C++’s materializing (as a picture) when there is given arguments on GradientFill().
2.vert [3] .Green = 0xff00;
I know RGB rule express 256 colors, from 0 to 255.
But GradientFill controls the color through hexadecimal.
I’d like to know how I can turn colors by hexadecimal into RGB 256 colors.
Maybe, there is a rule. I’d like to know what it is.
|
|
|
|
|
1. I dunno, but I'd imagine it's just the obvious one.
2. Green = 00ff00 because 0xFF = 255, so it's just a case of 0 Red, 255 Green, 0 Blue = Green. COLORREFs are created with the RGB macro which just shifts the values passed in to create the DWORD that holds it ( COLORREF is a typedef for DWORD ). To get the red/green/blue values out of a COLORREF ( which .xff00 is, just stated in hex ), just use the GetRValue/GetGValue/GetBValue macros.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Thanks!
But I want to know more information the first problem.
Please Help me!
|
|
|
|
|
At risk of stating the obvious, as M$ do not give us the source, I really cannot tell you more than the MSDN tells you.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
T.T.......................
I quite agree.
But I need to little a hint.
Please...................^^
|
|
|
|
|
jin sok cho wrote:
But I need to little a hint.
I'm confused as to why you think I know more than I have said. Do you know what linear means ? The MSDN says it's a linear transition, which is what I meant when I said it's probably the most obvious way. If you had 255 pixels you needed to do a gradient on, and you needed, for example, your red value to move from 0 to 255, how would *you* do it ? I'd step by 1 every pixel. If I had 510 pixels, I'd step by 1 every second pixel and if I had 127, I'd step by 2 every pixel. Extrapolate that to values that are a bit harder to calculate on the fly and that's about as much as I can tell you.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
jin sok cho wrote:
But I need to little a hint.
Here's a hint for you - if you're going to use a fake email address, at least don't ask for a cc email when people reply to you.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I am not sure this is the right section.
I am having a problem with the VS installer. I am creating a simple install file for a project with one executable. I have a shortcut in the start menu.
What I want to do is create an uninstall shortcut right next to the programs shortcut. I can't figure out how and I can't find any sources.
Can anyone help me, please?
|
|
|
|
|
I don't know, but FWIW I'll point out two things:
1/ the installer that comes with VC is a cut down version of Install Shield. Apart from being hard to use, the cut down version was useless in my opinion. We moved to Setup Factory.
2/ M$ recommend not doing what you want to do, because not all programs do it, and so expecting it stops users from realising there is an add/remove programs area in the Control Panel, which is where they should be going.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi,
all
Now I use this StretchBlt() function to display a
Rectangle bitmap ,It works perfect.But if I just want to
display the Ellispe inside the Rectange bitmap, how I
should do then. Perhaps, are theree other functions can
achieve this goal?
Thank you for your advanced help.
Regards.
|
|
|
|
|
You need to do one of the following:
1/ Not target Windows 95, then you can use TransparentBlt or GDI+
2/ Get my code from the WDJ site for the Sept 2000 issue, it includes a version of TransparentBlt that works with W95
3/ Do it yourself, this involves generating a mask bitmap in order to do the transparent blt. MSDN explains how, or again refer to my code from the WDJ site.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
|
Hi,
I have download your sept 2000 source code ,but
can not find the special souce code about the use of TransparentBlt. Can you give me a more detail
url.
Thanks again.
|
|
|
|
|
How can I put a CStatusBar in a simple CDialog???? I've tried hundreds of times but it doesn't works. Please help!
|
|
|
|
|
see http://msdn.microsoft.com/library/en-us/vcsample98/html/_sample_mfc_dlgcbr32.asp?frame=true
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
I'll like to add in a window like that of VC++'s output window where I can generate lines of text output and double-clicking would highlight the whole line. What type of view is that? I figure it closest to CEditView, but it mustn't let the user type into it!
|
|
|
|
|
It's not one of the MFC view class windows.
It's a custom created window.
Try the BCG class library which has an almost identical control.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
You can try with a CListCtrl.
Stephane
"It is ridiculous to claim that video games influence children.
For instance, if PacMan affected kids born in the eighties, we
should by now have a bunch of teenagers who run around in darkened
rooms eating pills while listening to monotonous electronic music."
|
|
|
|
|
Where can get a copy of source code of MPEG2/MPEG4 codec for windows and free of fee?If they are there,please tell me the URL or links.thank you.
/lizp
Scratch
|
|
|
|
|
Well I have a weird problem. I have declared a stucture called BrowseBoxStruct in the header file BBDefinition.h as follows
#ifndef __BBOXSTRUCT__
#define __BBOXSTRUCT__
struct MyStruct {
CString column_name;
int column_width;
_variant_t table_column_name;
};
typedef MyStruct BrowseBoxStruct;
#endif
Now I want to pass it to the constructor of a class (CBrowse in Browse.h and Browse.cpp) so I changed the standard constructor for the class as follows.
CBrowse(CWnd* pParent = NULL, BrowseBoxStruct* pBbx = NULL);
and in the cpp file I have
CBrowse::CBrowse(CWnd* pParent /*=NULL*/, BrowseBoxStruct* pBbx) : CDialog(CBrowse::IDD, pParent){
//{{AFX_DATA_INIT(CBrowse)
// NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT}
}
But when I build the application I get the follwoing errors
c:\coursemanager\browse.h(18) : error C2629: unexpected 'class CBrowse ('
c:\coursemanager\browse.h(18) : error C2238: unexpected token(s) preceding ';'
C:\CourseManager\Browse.cpp(20) : error C2511: 'CBrowse::CBrowse' : overloaded member function 'void (class CWnd*, struct MyStruct*)' not found in 'CBrowse'C:\CourseManager\Browse.cpp(94) : fatal error C1004: unexpected end of file found
Please tell me what is going wrong? I included the header file for the structure in the cpp file of my class. I did not forget to add ; in the header file BBDefinition which defines the structure. Still what is going wrong?
Mike
|
|
|
|
|
You sure you have #include "stdafx.h" as the first line in your cpp file?
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Hello,
Is it possible to make a CView like a dialog box which pops up ? I need to display different graphs from the data in ListControl in a dialog box.Is there any way to acomplish my need?
Please Reply.
|
|
|
|
|
Hi,
I read in a book that the CDC* in OnDraw function gets removed automatically.My question is-
First ,Is that true?
Second,so, can I use CDC* in my own functions without worrying to release it?
Thanx.
|
|
|
|
|
Salut Danielle
Yes, what happens is that the OnDraw is called from the OnPaint method, like so:
void CView::OnPaint()
{
CPaintDC dc(this);
OnPrepareDC(&dc);
OnDraw(&dc);
}
The creation of the CPaintDC causes GetDC and BeginPaint to be called, and its destruction releases the DC and calls EndPaint for you. So the CDC that is passed to OnDraw is yours to work with without needing to release it.
However, unless you have created the view with a special window class that has the CS_OWNDC style (unlikely) you should not store the CDC* for use outside the context of OnDraw.
HTH
|
|
|
|