|
bankai123 wrote: Hi I've created the CLR Console template application. I'm wondering how I can keep the console displayed after it runs. Currently a line is written to the console and then the console is closed.
Im not sure if this is possible. How about running it from a command prompt? then the output will still be visible
bankai123 wrote:
I also want to know how to display the console in a Windows Form app, for viewing some debug prints. Currently I'm using a separate form with a testbox to display the debug prints, which is rather inconvenient.
Look at the doco for the System.Console namespace. Im sure its possible but personally I would prefer a text box as its easier to copy and paste the text (you users may be doing a bit of this!)
bankai123 wrote: What's the difference between the Show() and ShowDialog() methods?
ShowDialog() gives you a model form
-- modified at 2:55 Tuesday 3rd October, 2006
|
|
|
|
|
Thanks for the help, though I'm not sure what you meant by model form.
Can anyone explain?
Thanks
|
|
|
|
|
bankai123 wrote: Thanks for the help, though I'm not sure what you meant by model form.
You're welcome. I meant modal form. A modal form or dialog must be closed before the user can interact with another window. A 'print' dialog from most apps is an example of a modal window.
|
|
|
|
|
Thanks, it explains alot now.
|
|
|
|
|
hi , i got problem with opengl why i cannot display cube and triangle in my comp... is there any code wrong below if u know plz inform me thanks;)
--------------------------------------------
#include<gl glut.h="">
float rtri; // Angle For The Triangle
float rquad; // Angle For The Quad
int InitGL(GLvoid)
{
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
void display (GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glPushMatrix();
glTranslatef(-1.5f,0.0f,-6.0f);
glRotatef(rtri,0.0f,1.0f,0.0f);
glBegin(GL_TRIANGLES);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f( 1.0f,-1.0f, -1.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f( 1.0f,-1.0f, -1.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(-1.0f,-1.0f, -1.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glEnd();
glLoadIdentity();
glTranslatef(1.5f,0.0f,-7.0f);
glRotatef(rquad,1.0f,1.0f,1.0f);
glBegin(GL_QUADS);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f( 1.0f, 1.0f,-1.0f);
glVertex3f(-1.0f, 1.0f,-1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glColor3f(1.0f,0.5f,0.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);
glVertex3f( 1.0f,-1.0f,-1.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glColor3f(1.0f,1.0f,0.0f);
glVertex3f( 1.0f,-1.0f,-1.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);
glVertex3f(-1.0f, 1.0f,-1.0f);
glVertex3f( 1.0f, 1.0f,-1.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f,-1.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glColor3f(1.0f,0.0f,1.0f);
glVertex3f( 1.0f, 1.0f,-1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glVertex3f( 1.0f,-1.0f,-1.0f);
glEnd();
glPopMatrix();
rtri+=0.2f;
rquad-=0.15f;
glutSwapBuffers ( );
}
void keyboard ( unsigned char key, int x, int y )
{
switch ( key ) {
case 27: // When Escape Is Pressed...
exit ( 0 ); // Exit The Program
break;
default:
break;
}
}
int main(int argc, char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
glutCreateWindow("simple");
glutFullScreen ( );
glutKeyboardFunc ( keyboard );
InitGL ();
glutDisplayFunc(display);
glutMainLoop();
}
|
|
|
|
|
This is the managed c++ forum, I recommend trying the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Im having trouble understanding how to implement the MouseEnter and MouseLeave functions using Winforms. Im trying to design a simple digital clock that displays the date and time, but each field can be altered if the mouse is placed inside the window and resumes operation when the mouse leaves the window. Can anyone help explain how to use them?
|
|
|
|
|
I want a screenshot from a game that's running. I dove into trying it all out just today, but I've read a whole lot of c++ and MC++ (not CLI) before.
I retrieve the process using System::Diagnostics::Process, and then use the method MainWindowHandle and that just works fine. I've googled for 3 hours, but I can't find a true .NET way of accomplishing taking the screenshot of a given hWnd. What I think I need to do:
- create a new device context
- get the device context from the hWnd I've already got
- use a bitblt function to copy the screen to the newly created DC
- save the DC to a file.
I've been looking around in System::Drawing::CopyFromScreen, but to no avail. Any help on getting started with this would be enourmously appreciated, as I have no clue which functions to use and in which namespaces they reside. Thanks in advance.
Frank
|
|
|
|
|
I'm pretty sure that all the code I've ever used in C# to grab screens used p/invoke to call native APIs. Why do you need to do it using .NET ? I mean, if you're in MC++, you've got the C++ APIs right there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks for the reply, you may be very right about that. Mind telling me which API calls that were? I'd really appreciate this because I'm pretty tired of searching.
|
|
|
|
|
From my C# code:
[DllImport("gdi32.dll", EntryPoint = "DeleteDC")]
public static extern IntPtr DeleteDC(IntPtr hDc);
[DllImport("gdi32.dll", EntryPoint = "DeleteObject")]
public static extern IntPtr DeleteObject(IntPtr hDc);
[DllImport("gdi32.dll", EntryPoint = "BitBlt")]
public static extern bool BitBlt(IntPtr hdcDest, int xDest,
int yDest, int wDest,
int hDest, IntPtr hdcSource,
int xSrc, int ySrc, int RasterOp);
[DllImport("gdi32.dll", EntryPoint = "CreateCompatibleBitmap")]
public static extern IntPtr CreateCompatibleBitmap
(IntPtr hdc, int nWidth, int nHeight);
[DllImport("gdi32.dll", EntryPoint = "CreateCompatibleDC")]
public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
[DllImport("gdi32.dll", EntryPoint = "SelectObject")]
public static extern IntPtr SelectObject(IntPtr hdc, IntPtr bmp);
I believe Nish has an article on screen capture on the site, I recommend searching for it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Nevermind, I found out that it was pretty easy actually. Just got the HDC by using the HWND and a bit of a copy-paste. Thanks for the help!
|
|
|
|
|
Hi
Quick question, just started playing aroung with windows form applications yesterday instead of console applications (which I have strated on to practice c++) and wondered if anyone could help me out here.
I have developed 2 windows forms in my project so far. One is the 'Main Screen' and the other one is an 'Instructions' screen and am trying to use 'button' controls to link the 2 forms together, I have got my 'exit program' button working ok using the code below.
private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) {
Application::Exit();
But what I need to know is what kind of code do I need to use to have the button on my 'main screen' to link me to the 'instructions screen'. Is this possible????.
Web searches are way too vague to get the info I need.
Any help would be greatly appreciated and thanks in advance to anyone who answers this.
I really hate this darn machine;
I wish that they would sell it.
It won't do what I want it to,
but only what I tell it.
~Author Unknown
|
|
|
|
|
Mark_Murphy wrote: Web searches are way too vague to get the info I need.
I guess you need some help with how to google...
Mark_Murphy wrote: button1
First of all, I recommend giving your variables meaningful names.
Create a button, create a click event for it. In the click event, create an instance of the form that shows the instructions, then call ShowDialog on that instance to show the other form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am writing a program that should do the following
-Get input from the microphone attached to the pc
-Store that input in a variable
-Use that variable to control the up and down movement of a machine
The variable needs to increase as the volume from the mic increases and decrease in like manner.
Can someone give me some tip on how to do this? I do not know where to start from.. I intend to use C++
Thanks in advance... commickey
|
|
|
|
|
Do you intend to use .NET, or are you asking in the wrong forum ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
We really need to find comprehensive information on implementing .Net 2 libraries, including patterns for design time handling of visual controls, designers, editor implementations, and so forth. Does anybody have a favorite, up-to-date .Net 2.0 reference they can suggest that will satisfy just about any need for design patterns?
|
|
|
|
|
I'm looking for a good plugin system for C++/CLI that would be able to load interface elements (forms) from the plugin DLL.
I'm currently using the MFC extension DLLs that export Doc/View classes, but I unfortunately cannot use .NET controls there, due to architectural constraints.
Any suggestion, especially linking me to good reference materials, is welcome.
|
|
|
|
|
You can do that using the Reflection library.
led mike
|
|
|
|
|
Thank you very much for your answer.
Do you think I could cross-use C++ and C# modules in such solution, and still get the Reflection working well?
|
|
|
|
|
Bartosz Bien wrote: cross-use C++ and C# modules
If the C++ Dll's are managed .NET assemblies then yes? Cross language compatibility is one of the features of the CLR concept.
led mike
|
|
|
|
|
hi friends
i have try making the the installer for the pocket to install the cab file from the desktop pc but it did not work
can any body help me
thanks
dzfvdsfg
|
|
|
|
|
We're moving our code bases from Delphi/CPPB to managed C++... just getting our feet wet in VS.
Delphi has what are called "Class References," which are types which represent classes. You can declare a class reference type for instance, MyClassReferenceVariableType = Class of MyClass;.
As variables of type MyClassReferenceVariableType can then be assigned the class identifier of MyClass or of any descendant of MyClass, we can pass class reference arguments to a factory method, capable of creating on the fly, any descendant or member of MyClass. Thus a singular factory method can serve purposes similar to templates, but *at run time*. C++ Builder emulates this concept with MetaClasses and __ClassIDs.
That said, is there an equivalent to such class reference types in managed C++ for .Net?
|
|
|
|
|
mmontagne wrote: That said, is there an equivalent to such class reference types in managed C++ for .Net?
I would imagine you could implement similar functionality using reflection
|
|
|
|
|
Just a while ago, an ongoing search turned up the System::Activator class, but it will be some time before I can put together a test situation, working with the other difficulties we are confronted with. If anyone else is interested, here's a link to the Activator class topic:
http://msdn2.microsoft.com/en-us/library/system.activator.aspx
I think this will work, but any further ideas appreciated, especially proven techniques.
Much thanks,
mike
|
|
|
|
|