Hi,
I have a dll file which has been generated from VB, now i want to use it in VC++ how can i do that? Can anyone tell me how can i do that? I want to call API's by passing parameters in VB code which returns a string, how can i achieve this?
Thanks & Regards,
Karthik
Loading
VulpesPosted Jan 18, 2012, 11:42 AM
Sam HobbsPosted Jan 20, 2012, 9:47 AM
VulpesPosted Jan 20, 2012, 5:08 AM
I agree totally that all posts should be time-stamped (not just date-stamped) and I think I may have suggested this (or seconded somebody else who suggested it) in a previous thread.
Sam HobbsPosted Jan 19, 2012, 10:06 PM
Also, I will say again; I think it is best to get clarification first. That could save time for everyone.
Excuse me for the following, which is less relevant to this thread. I think it would help to have the time of every post shown for the post. In other words, it would help if the forum software were to show the time as well as the date of each post. Then I would have a better idea of when things happen. I often do not have a lot of time to look at the forums but if I know when is a good time to look then I would be able to schedule my time better. Also, I intended to look at this thread closer but I am not sure how to refer to previous posts if I were to comment on the previous discussions. A timestamp would help with that too. So now I have adequate justification for requesting that threads have the time for each post shown as was done in the past.
Karthik AgarwalPosted Jan 19, 2012, 6:43 AM
And if it comes to what Sam is saying, i am not sure in what way he looks into my posts. Me and Vulpes are in sync we both understood what we are doing and what we have ended up with.
I said him many a number of times i am ready to take up your suggestions provided it comes at the earliest. Sam referring to your previous comment about my reply to some post not sure what was that post. When i have time and felt like looking into the posts, if i feel like i can do something regarding that post i did as much as i can. Which isn't wrong i hope!
VulpesPosted Jan 19, 2012, 6:26 AM
Sam HobbsPosted Jan 19, 2012, 2:26 AM
It seems highly unlikely that a VB .Net class library cannot be called by a managed C++ program. I cannot help though because the two of you again are wandering around in the dark. I think it would be beneficial for both you to learn how to clarify what the problem is; be more methodical about it.
Karthik, in response to your response to Hermant, do you try to answer questions around here? If not then you do not have experience with the problem of people asking questions without adequately searching. It happens multiple times everyday.
Karthik AgarwalPosted Jan 19, 2012, 1:03 AM
Karthik AgarwalPosted Jan 18, 2012, 11:48 AM
Karthik AgarwalPosted Jan 18, 2012, 11:05 AM
VulpesPosted Jan 18, 2012, 9:48 AM
Karthik AgarwalPosted Jan 18, 2012, 9:34 AM
After reading that excel sheet through dll i need to populate menu items in VC++ windows form. If i read the excel sheet in background how is it possible to populate menu while loading windows form where that menu should also get loaded as well. I just need one column of excel sheet to be populated in menu. So i wrote an inspect function in VB which returns the whole list which i need to populate in menu. Even though i populate menu those menu items may cause exception if someone clicks that before i read the other part of the excel sheet. So i tried disabling the menu till i read then i tried enabling the windows which isn't working fine. I also tried disabling the menu and then finally after reading the whole excel file i tried adding menu items which can't be done when menu is in disabled state. What shall i do solve this problem. Do lead so that i will close stuff ASAP. For any further queries please post in return.
Karthik AgarwalPosted Jan 18, 2012, 6:21 AM
VulpesPosted Jan 18, 2012, 6:18 AM
Karthik AgarwalPosted Jan 18, 2012, 6:05 AM
VulpesPosted Jan 18, 2012, 4:59 AM
http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx
This will enable you to read the Excel sheet on a background thread as well as provide an easy way to communicate progress/completion to the UI thread.
Karthik AgarwalPosted Jan 18, 2012, 4:17 AM
Now my problem is when i associate my dll with this application and try to read the excel sheet while loading windows form is taking around 15 secs which is not acceptable. So i am planning to read the excel sheet in the background after loading windows form. I will load the windows form first and then i will start reading the excel file. Is there any function where in i can call a function in the background or background process kind of stuff.
VulpesPosted Jan 17, 2012, 9:51 AM
Karthik AgarwalPosted Jan 17, 2012, 9:12 AM
VulpesPosted Jan 17, 2012, 9:08 AM
Karthik AgarwalPosted Jan 17, 2012, 7:05 AM
Note: If i can't use in multiple places the dll will be of no use right. Probably there should be a way to do that but i am not aware of it
I am working on Visual studio 2008 (.Net Framework 3.5)
VulpesPosted Jan 17, 2012, 5:50 AM
http://support.microsoft.com/kb/302094/en-us
Karthik AgarwalPosted Jan 17, 2012, 4:30 AM
Karthik AgarwalPosted Jan 17, 2012, 4:29 AM
Karthik AgarwalPosted Jan 17, 2012, 4:26 AM
1. Language_Feature the dll (place where i am reading excel sheet and generating dll)
2. Language_Test is the test application
3. Language is the excel sheet
Karthik AgarwalPosted Jan 16, 2012, 10:45 AM
VulpesPosted Jan 16, 2012, 10:37 AM
I've found a good article about automating Excel using C++/CLI:
http://www.codeproject.com/KB/office/automate_excel.aspx
I'd read it through then have a go at translating your VB.NET code directly to C++/CLI.
I'll try and help if you get struck.
Karthik AgarwalPosted Jan 16, 2012, 10:04 AM
VulpesPosted Jan 16, 2012, 9:58 AM
However, unless it's just a few lines of code, I see no point in translating it. I'd stick to using the VB.NET dll if that's working OK now.
Karthik AgarwalPosted Jan 16, 2012, 9:44 AM
If you say it that way how can i proceed implementing it? That i doesn't have much time for doing that? Should that be read as database or ODBC something of that kind, anyways i will look into that option if it's same way as VB is, otherwise i am not even gonna try that which will make things complex for me.
Anyways what's your suggestion?
VulpesPosted Jan 16, 2012, 9:39 AM
I think you probably could rewrite the VB.NET Office Interop code in C++/CLI though your hair might be somewhat diminished by the end of it :)
Karthik AgarwalPosted Jan 16, 2012, 9:21 AM
Do you mean to say that rewriting or converting the same VB code in VC++ will do the job?
VulpesPosted Jan 16, 2012, 9:16 AM
I don't think I've ever tried to access the Office PIAs from C++/CLI.
Karthik AgarwalPosted Jan 16, 2012, 9:03 AM
Also tell me how tough is it to read excel sheet in VC++?
Anyways after a bit of hard work and your support i have learned a very good lesson for the day.
VulpesPosted Jan 16, 2012, 8:50 AM
Karthik AgarwalPosted Jan 16, 2012, 8:47 AM
Vulpes is it that tough to read excel sheet in VC++. I find the same references mirosoft.excel and office in VC++ as well then can i use them in the i do in VB itself ot it's bit different or difficult what's your take on this?
I would love to do it VC++ if it's not too tough which solves many of my problems and the complexity as well.
Karthik AgarwalPosted Jan 16, 2012, 7:20 AM
VulpesPosted Jan 16, 2012, 7:04 AM
You can check this by examining the VB.NET project's properties under the Application tab.
One reason why I dislike developing in VB.NET is because too much is hidden away for my liking :(
Karthik AgarwalPosted Jan 16, 2012, 6:43 AM
// classlibrary1.vb
static Language_Feature::Language::Language_Feature ^ obj;//this is working fine but it isn't the way it should be
//constructor
VulpesPosted Jan 16, 2012, 6:01 AM
Karthik AgarwalPosted Jan 16, 2012, 5:38 AM
VulpesPosted Jan 16, 2012, 5:25 AM
http://www.c-sharpcorner.com/Forums/Thread/140137/way-to-use-an-exe-which-is-generated-using-vb-in-vc.aspx
Sorry, I didn't really follow the second part of the question. If you mean that you want to pass parameters to a VB.NET method which then returns a string, you can do that in just the same way as if the method had been written in C++/CLI.
Karthik AgarwalPosted Jan 16, 2012, 5:12 AM
If google would have solved my problem i would not have asked it here. Anyways thanks for googling. I need in detail explanation so only i came up here. I have already seen these which couldn't solve my problem.
Thanks & Regards,
Karthik
Hemant KumarPosted Jan 16, 2012, 5:08 AM
http://www.developerfusion.com/article/1973/calling-a-c-dll-from-visual-basic/
http://www.codeproject.com/KB/COM/vb_from_vc.aspx