One way is to create a new .NET project called Class Library and copy over your VC++ code. Sometimes the "It Just Works" effect will be able to translate the code. Then when you compile it, you will have your dll which you can make other projects reference. The easier way would be to open the .lib project in VC++ 6.0 and go into Project->Settings and change the output from a static library (.lib) to a dynamic library (.dll). Compile it in VC++ 6.0 to get your .dll file, which your .NET project will be able to reference.
if_mel_yes_else_no
Posts
-
How can I compile *.lib in VC++ to dll? -
Need help! - accessing disposed objectIf I'm reading this right. You have a form with a control, and then in your code you dispose of the control? So when you try to activate the window it throws the exception about the disposed object? That's because your form thinks it still exists when you go to re-activate the window. Before you dispose the object, you should remove it from the form with form.controls.remove(yourControl). Then you can dispose of the object all you want.
-
Reflection EmitIt doesn't really make sense to me to create 100 picture boxes and then set an array to reference these 100 picture boxes. Why don't you use an array object to create the 100 picture boxes in the first place? Since you have a 10x10 matrix of them, there will be a mathematical formula for creating the pictureboxes. Just use a for loop and create all 100 picture boxes, so that they will be easily accessible. If the problem is that each box contains a specific image file, you should label all the images with the same scheme..ie: img00.bmp, img01.bmp...etc. I've used this approach when designing little quick games.
-
Time change eventsThere's a timer control. You give it a number of milliseconds, and when that time interval has passed it throws an event that you can receive. To receive a message every hour just set the interval to 3600000 milliseconds.
-
Custom MenuItemYou must be using studio 2003. In studio 2005 the MenuItems have all the mouse events. There's a chance that you could look into having the application catch any system mouseDowns, and using the mouseEventArgs's X and Y coordinates, try to figure out if it came from your menuItem... but that sounds like a lot of hassle. How about a seperate menu item called "Add Bla". After you click it the cursor changes as I said before, and you can click on the receiver. It's not exactly a drag so much as a 'click to place', but it's better than nothing.
-
rich textboxRtf is just the same text but with the formatting codes included. You would never want to set the font on your Rtf. The codes will never be seen. If you're asking how to do underline, it's part of the FontStyle just like Regular and Bold.
-
rich textboxrichTextBox1.SelectionStart = 0; richTextBox1.SelectionLength = richTextBox1.Text.Length; richTextBox1.SelectionFont = new Font("Arial", 8, FontStyle.Bold); richTextBox1.SelectionStart = richTextBox1.Text.Length; richTextBox1.SelectionLength = 0; This works fine when I do it.
-
Custom MenuItemYou can fake it pretty easily. When the MenuItem catches a mouseDown, change the cursor of the MenuItem and the main application to something that looks like a cursor with a drag item. Then set your desired receiver's state to 'RECEIVING'. When the receiving control catches a mouseUp and it's in the 'RECEIVING' state, it will perform the operation just as if the MenuItem was really dragged. Now just set the cursor for the MenuItem and main application back to default.
-
rich textboxSelectionLength = 0; That's the first thing that came to my mind. There are also arguments in the 'e' parameter that you can use. Cancel pretends the keydown never happend, sometimes called Suppress.
-
Remoting( Database as a Model , in a MVC pattern)If you've never set up a TcpClient, studio 2005 makes it pretty easy. Same for the TcpListener on the remote computer. //DataBase Computer TcpClient m_connection = new TcpClient("15.3.6.33", 17534); StreamWriter m_writer = m_connection.GetStream(); m_writer.WriteLine("(app)(username)mel(/username)(password)mel(/password)" + "(command)REFRESH(/command)(/app)"); //Remote Computer TcpListener m_listener = new TcpListener(17534); TcpClient m_connection; StreamReader m_reader; String strCommandText; m_listener.Start(); while(true) { if (m_listener.Pending()) { m_connection = m_listener.AcceptTcpClient(); m_reader = m_connection.GetStream(); strCommandText = m_reader.ReadLine(); // Now parse your message to find out what you should do. } } -- modified at 18:16 Tuesday 30th August, 2005
-
Text cuts-off on some computersWelcome to the world of compatability. Trying to get an application to look the same on all computers is near impossible unless everyone in the company has the same type of operating system. If you're using studio 2005 and C# then the tab control's headers should auto-size to the length of the text. In 2003 I think you have to set auto-size yourself, either that or there will be a property called WordWrap that you can set to false.
-
rich textboxThe text box is doing exactly what all text boxes do when all the text is selected and you insert a letter. It takes the selected text and replaces it whith the new letter. You really shouldn't be surprised by your results. If you want to change the font and attach the new letter, then you need to clear your selected text before you leave the method.
-
Remoting( Database as a Model , in a MVC pattern)There are plenty of ways I'm sure, but I've always had the best success with custom TCP protocols. Meaning, you would connect to the remote computer through a TCP Client on a dedicated port, and send your own message format to the remote computer. The remote computer should have a thread that is constantly listening on that port for new connections. When it receives your connection, it verifies that it came from you (your custom message format should have a username/password in it), and performs the necessary operation based on the message. This approach has yet to fail me.
-
totally disconnect TcpClientI have still not seen any events that you can listen for when it comes to the socket class. What I do is to have a thread that is dedicated to doing nothing other than checking my array of socket connections. If it ever finds a connection that was closed from the remote end, it calls the necessary method. That's with C#.. I've done development in C++ with QTSockets, which do (God bless them) have events for socket disconnection.
-
Text EncodingConverting is easier than you think. Just use basic byte-char conversion: char one = '\r'; byte val = (byte)one; //result is a 13 char two = (char)val; //result is '\r'
-
Transparency not just in formsWhy in the world would Microsoft's new Studio 2005 give you something as fun as a transparency property for Forms, and not put that property in for all controls? I would really like to create an application that has transparent buttons, and when the user mouseOvers on the button, the buttons become clearer. I thought it would be a simple tasks, but I just could not get it done. I ended up faking it by having mini forms floating on top of my application, each with a transparency, but it looks buggy when you drag the application around. I want it docked like all other controls, but if you try to make your own custom control that extends from Form, it fails to dock because it considers Forms that the ultimate container so you can't but a Form into anything. I do have some OpenGL experience, and could have a constantly running thread in my application that checks for mouse positions and draws GDI bitmaps to a drawing area with different levels of Alpha. However, I'm really hopping that I can do it more simply than that. Anyone have any ideas, or tried getting other controls to have transparency?