Hello, I am trying to create a dll using c++ that I can then use and call functions out of in C#. I have a general idea of what to do, but I don't know the specifics. I am using visual studio 2005. What type of project should I create in c++? Does anyone know of any source code out there that might have some simple exambles? Once I have created my dll, I add it to C# as a reference. But after that what do I do?
SRogers88
Posts
-
Creating a C++ library for use in C# project -
Reference QuestionHere is the code. object padobj = System.Runtime.InteropServices.Marshal.GetActiveObject("PowerPCB.Application"); padsApp = (PowerPCB.Application)padobj; View.Doc.padsDoc = padsApp.ActiveDocument; View.Doc.padsDoc.SelectionChange += new PowerPCB._PowerPCBDocEvents_SelectionChangeEventHandler(eeSelection); padsApp.UnlockServer(); If you notice I am setting padsApp to the the object. But I have to cast the object to PowerPCB.Application. The problem that I am running into is the PowerPCB reference has two versions. I have no problem connecting to the loaded PowerPCB reference, but when I try to connect to the other version I crash when I try to use the padsApp object because I am not using the correct version of the PowerPCB reference. But if I change out the reference and restart the program I am able to connect to the other version just fine. So basically there is no way to point to a reference in a specific location and use that specific reference? It has to be loaded into my project?
-
Reference QuestionWhat exactly is a late-binding method? How would I set it up so that I can use these methods? Are there any examples out there?
-
Reference QuestionI have a Reference Question. I am faily new to C# so this might be a very basic question. I have my references folder in my project. I can add and delete them as needed. But I am trying to add two references that have the same name but different version numbers. But I need both because the both do something different for me. Is there a way to add a reference that is the same name and type but a different version number? What I am trying to do is connect to a COM server. The Reference is to the COM type library so that I can access it and get all of the data out of it. The problem being is I am supposed to support two versions of the same server. When I try to add the reference it states that the type library already exists. When I add the reference I add it from the location on my C drive and it adds it to my project. Is there a way not to add it to my project, but point to it with a path and take whatever reference I need whenever I need it and not have it part of my project?
-
Using C# and COM to connect to a ServerHello, I am trying to find some examples and information on how to add COM to the C# application and connect to a COM server that was created with C++. Any help would be wonderful. Thanks
-
Using C# and COM to connect to a ServerHello, I am trying to find some examples and information on how to add COM to the C# application and connect to a COM server that was created with C++. Any help would be wonderful. Thanks
-
C# How to convert a string from English to Japanese ?So there is no way to convert a single key press to the Japanese representation of that key press?
-
C# How to convert a string from English to Japanese ?Well, what I am trying to do is say, a person types in an 'a', I can then take that letter and translate it to the Japanese representation of 'a' or what the japanese representation of the key pressed on the keyboard for for 'a' which I think is key 65.
-
C# How to convert a string from English to Japanese ?Hello, I no really nothing about unicode. So I am trying to convert a string that starts out in English and convert it to Japanese. This is what I am doing, but I have no idea what to do and nothing is coming out as Japanese. I tried looking on the internet and the best thing I found was this. http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx But I still can't get it to convert the string. This is what I have for code written so far. Please help. I would expect "This is a Test" to convert to Japanese but it does not. string TestString = "This is a Test"; Encoding ascii = Encoding.GetEncoding(932); Encoding japanese = Encoding.GetEncoding(20127); byte[] unicodeBytes = ascii.GetBytes(TestString); byte[] JapaneseBytes = Encoding.Convert(ascii, japanese, unicodeBytes); char[] JapaneseChars = new char[japanese.GetCharCount(JapaneseBytes, 0, JapaneseBytes.Length)]; japanese.GetChars(JapaneseBytes, 0, JapaneseBytes.Length, JapaneseChars, 0); string JapaneseString = new string(JapaneseChars); string test = System.Text.Encoding.GetEncoding(932).GetString(JapaneseBytes); I just tried this and the string is still in English. I am just looking at the string in the debugger to see what it looks like and it is still english.....
modified on Friday, September 12, 2008 1:45 PM
-
Resizable CDialog BarHello, I have a tabbed control with three tabs. Each tab has a tree control. Each one of these is its own dialog. I have the parent tabbed control dialog in a CDialog bar so that it can dock to the main window. I am trying to make this main CDialogBar resizable but it seems to be locked and will not resize. When I pass the parameter of CBRS_SIZE_DYNAMIC to the CDialogBar, and when I click on the barder of the dialog bar, the mouse will change to the mouse icon you get when you go to resize a window, but the CDialogBar boarder does not move so I do no get the WM_ONSIZE message. Any suggestions on how I can get my CDialogBar to resize? I have some code at the bottom, this is how I am making my CDialogBar. Thanks, Shane m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); m_wndDialogBar.Create(this,IDD_DISPLAYDIALOG, WS_VISIBLE|WS_CHILD|CBRS_LEFT|CBRS_SIZE_DYNAMIC, 1); m_wndDialogBar.SetWindowText("Display Control"); m_wndDialogBar.SetBarStyle(m_wndDialogBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); //| CBRS_SIZE_DYNAMIC m_wndDialogBar.EnableDocking(CBRS_ALIGN_RIGHT|CBRS_ALIGN_LEFT); DockControlBar(&m_wndDialogBar); m_wndDialogBar.DelayShow(FALSE);