|
Yes GetDC() is returning non-NULL.
|
|
|
|
|
Newbie00 wrote: Yes GetDC() is returning non-NULL
And the HWND you pass to GetDC() is non-NULL too?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Then I would assume the problem is not related to getting the panel's HWND.
What does GetLastError() return after the failed wglCreateContext call?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yeees :] hmmmmmmmm I've tried to use GetLastError() with FormatMessage() like this:
LPVOID lpMsgBuf;<br />
<br />
FormatMessage( <br />
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,<br />
NULL,<br />
GetLastError(),<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,<br />
0,<br />
NULL <br />
);<br />
<br />
But an exception occures:
An unhandled exception of type 'System.Runtime.InteropServices.MarshalDirectiveException' occurred in Figury.exe
Additional information: Cannot marshal 'parameter #7': Pointers cannot reference marshaled structures. Use ByRef instead.
GetLastError() returns 2000, i don't know what to do :[
|
|
|
|
|
Newbie00 wrote: GetLastError() returns 2000
...which is ERROR_INVALID_PIXEL_FORMAT. Is that a clue?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
how do you know what 2000 means?
That could be a clue, but it's worse than i thought
I have no idea why such strange error occures. I've tried this code with
C++ Builder 6.0 and everything was ok There was no ERROR_INVALID_PIXEL_FORMAT
|
|
|
|
|
There's lots of error codes[^] listed in the documentation for
GetLastError()[^]
I'm not sure what's going on with this, or why it would work with builder.
I guess this leaves SetupPixelFormat() ... what goes on in there?
Is it supposed to have a DC passed to it? If so, is that DC supposed to be a memory DC
or can it be a window DC? Since you can't change the format of a window DC, I would expect
it requires a memory DC - or does it create one internally?
I'm just guessing from what little code I've seen, but I suspect you're passing the wrong DC to
wglCreateContext().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The old VS had a utility now in 2005 this page[^] says it's in the TOOLS menu.... I don't have it
|
|
|
|
|
Interesting. I don't have that utility either. In fact, I'm pretty sure
I've never found any utilities I wanted to find in VS. Yes, there's ones there
I never use...
*shrug*
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I think i'm passing correct DC.
<br />
void TFigure::SetupPixelFormat()<br />
{<br />
int nPixelFormat = 0;<br />
PIXELFORMATDESCRIPTOR pfd = {<br />
sizeof(PIXELFORMATDESCRIPTOR),<br />
1,<br />
PFD_DRAW_TO_WINDOW |<br />
PFD_SUPPORT_OPENGL |<br />
PFD_DOUBLEBUFFER,<br />
PFD_TYPE_RGBA,<br />
32,<br />
0, 0, 0, 0, 0, 0,<br />
0,<br />
0,<br />
0,<br />
0,0,0,0,<br />
16,<br />
0,<br />
0,<br />
PFD_MAIN_PLANE,<br />
0,<br />
0, 0, 0 };<br />
<br />
nPixelFormat = ChoosePixelFormat( m_gHDC, &pfd );<br />
SetPixelFormat( m_gHDC, nPixelFormat, &pfd );<br />
}<br />
ChoosePixelFormat( m_gHDC, &pfd ); returns 7.
-- modified at 13:35 Monday 15th October, 2007
|
|
|
|
|
STL map = Hashtable, what about STL multimap? Equivalent?
STL Reference[^]
Thanks a bunch.
|
|
|
|
|
There isn't one
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Chris, thanks. Any reason why there isn't an equivalent in .NET ICollection[^]?
I use Hashtable quite often... but I suppose there're application for multimap too...?
|
|
|
|
|
My guess is that the C# team wanted to keep it simple, that appears to be their overall ratonale. I love associative containers, I use them all the time.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
MFC's CMap = HashTable.
STL map = Red-Black Tree.
|
|
|
|
|
hi all masters,
i had been seeing this forum's link since many days.
but i thought that, i dont know about it, so lets not enter it.
but today i got an idea, why cant i get educated about managed c++.
i love codeproject and i love the members here, who help the people.
so i thought, if i post this here, somebody can give a brief paragraph exlanation about managed c++, and refer me some books on the web, such that, i will do some home work, and get back here with many interesting questions and lets see if i would be able to solve any?
by the way,
my skill set is,
c,c++,vb,vc++6.0 since 4+ years and nothing else.
and also suggest me, weather my skill set is sufficient to know about managed c++.
|
|
|
|
|
Managed C++ is simply the first iteration of C++ extensions to allow for using .NET classes in C++ and write .NET assemblies in C++. It was used in VS 2002 and 2003. In VS2005, this was overhauled, and we now have C++/CLI. IMO, it's still a disaster, and you're still better off learning C#. However, Nish has written a great book on C++/CLI ( published by Manning ), if you want to learn it, start there.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
oh thanks for such a nice and brief explanation sir,
since it is something related to dotnet, i feel that, it is not in my scope, as of now.
now iam well of with vc++6.0.
in future, i do have a plan to get awareness towards dotnet.
once again many more thanks for your concern.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Why is the C++/CLI stuff a disaster? I'm not arguing, I just want to know because I may have to make use of it...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I personally find it works well. It's the most useful (to me) thing
that's been added to Visual C++, well, ever.
The Managed Extensions were kind of a "disaster" with
confusing syntax and lack of some useful keywords, but
the new C++ syntax is pretty nice to use.
I guess for C# programmers, all of C++ is a disaster
(;P Christian)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
I'm using Microsoft Visual C++ 6.0.
I have the following codes in my program:
int x;<br />
cout<<"Enter a number: ";<br />
cin>>x;<br />
double Num[x];
The following errors are occured:
1. error C2057: expected constant expression
2. error C2466: cannot allocate an array of constant size 0
3. error C2133: 'Num' : unknown size
How to solve my problem?
Please do not tell me to enter something like "int x=100" or "int Num[100]". I want to the user of my program set the size of the array.
Any reply will be appreciated.
|
|
|
|
|
cshong wrote: I'm using Microsoft Visual C++ 6.0.
Then you must be in the wrong forum ( VC7 was the first to support managed C++ ). Try the visual c++ forum.
The answer is that you need to dynamically allocate via a pointer if you don't know the array size at compile time. But, next time, this is the wrong forum.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|