|
Hi,
I'm trying to write an application and have a strange problem:
MacroSelector * macroSelector = new MacroSelector();
if (macroSelector->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
programEditorTextBox->Paste();
}
Where programEditorTextBox is a RichTextBox. The paste does not work, but if then manually doing paste (CTRL+V) the text is pasted fine...
It seems that after the ShowDialog the Paste function does not work for some reason...
I copy the data to the clipboard in the following way:
Clipboard::SetDataObject(__gc new String(macro->GetMacroCode()), true);
wchar_t * ProgramMacro::GetMacroCode()
{
return m_szMacroCode;
}
Dina
-- modified at 13:17 Friday 6th October, 2006
|
|
|
|
|
I need an implementation of a couple GUID generation algorithms for a school science fair project. I already have the System.GUID.NewGuid and the OpenSSL using names. Does anyone know where I can find more? Please note that this project is due on Nov. 11th.
__________________________________________
Let's push Satan
|
|
|
|
|
Hi, I'm new to C++/CLI and I'm wondering how this native C function can be re-written in C++/CLI?
static int (* SomeFunc[MAX])(unsigned char length, unsigned char* buffer);
Regards
|
|
|
|
|
Well you could use a delegate as they are pretty much the equivilent of a function pointer. Is that what you want or do you want to pass a method from you managed c++ to an unmanaged class for it to call you back?
|
|
|
|
|
Hello,
In my VC++.NET 2003 multithreaded application I need to use some COM server. I can call it from both threads using RCW, but after some period of time I have this error message: “COM object that has been separated from the underlying RCW can not be used” from the main thread. I don’t use Marshal::Release(…) explicitly, it means garbage collector decided to free some memory and destroyed my object. I already tried to increase reference count using Marshal::AddRef(…) and I tried to create additional global instance of this object. Both approaches didn’t work. How to tell Framework not to destroy this object? Please help!
Regards,
Leonid
|
|
|
|
|
I was wondering why when creating a Windows Forms application, the code generated is organized with the all the code in the header file, and not much at all in the .cpp file. I've always thought that it was best practice to store all the functions, event handlers..etc in the .cpp file, with the header file left with the includes, and declarations ...etc. Currently all my code is located in the header files, and the .cpp files are left almost empty.
Is there a preference in the C++/CLI community to arrange the files as such? Does it really make a difference at all?
-- modified at 20:01 Tuesday 3rd October, 2006
|
|
|
|
|
|
Hello,
When I change the Common language runtime support to /clr in order to add a Windows forms to a MFC project, when I try to compile I get the follwing error:
1>cl : Command line error D8016 : '/RTC1' and '/clr' command-line options are incompatible
The /RTC1 option is in the Basic runtime check option, but I can't avoid this even changing the option to whatever,
There is any way to erase the /RTC1 option???
Thank you
|
|
|
|
|
Have you upgraded a VC6 project to 2005 by any chance?
|
|
|
|
|
Yes I did, and exerything stop to work..........
Thans
Regards
|
|
|
|
|
Epi wrote: Yes I did, and exerything stop to work..........
The VC6 to VC2005 conversion wizard has an odd behavior - instead of applying the /RTC settings to the project, it applies it to each source file. So you have to remove this setting for each file.
|
|
|
|
|
Ok I see,
Thank you I set the option default.
Now I get the errors (until 22 errors of the following type)
libcmt.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj)
And I can't avoid it by using the Ignore specific library
Thank you
Regards
|
|
|
|
|
Looks like you are trying to link with multiple CRT libraries. /clr only supports the dynamic CRT - and I believe the single threaded CRT is not even available. Fix your CRT settings and make sure that you are not inadvertently linking with any of the old VC6 LIBs.
|
|
|
|
|
Ok it is posible to change it, in the *.vcproj you have to change
BasicRuntimeChecks="3", for BasicRuntimeChecks="0"
Thanks again
|
|
|
|
|
Where can I change the properties of the CRT???
I have seen taht it depends on the ATL, but I am not using them
I am still getting this error
libcmt.lib(tidtable.obj) : error LNK2005: __encoded_null already defined in msvcrtd.lib(MSVCR80D.dll)
even if I have add the option to ignore the
libcmt.lib
Best regards
Thanks
|
|
|
|
|
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.
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.
I also have a question regarding the Form class. What's the difference between the Show() and ShowDialog() methods?
Thanks
-- modified at 1:36 Tuesday 3rd October, 2006
|
|
|
|
|
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
|
|
|
|
|