|
Dear All Everyone !
If you have book abt VISUAL STUDIO 2005 or 2008, pls send to me with email address: lqlong0302@gmail.com
Thank you very much !
|
|
|
|
|
Greetings All,
I would like to make a GUI, for sensor configuration purpose, with the style of MFC Application Wizard. Basically, I'd like
1. Multiple property sheets, each of which can interact with user inputs.
2. There is a browsing tree to list all the property sheets.
3. One can navigate through the property sheet by "Previous" and "Next" buttons; or, one may select a property sheet by clicking it in the browsing tree.
I program mainly in C++, and know well of VB. I wonder what tool and option would do the trick.
Thanks a lot!
Z.
|
|
|
|
|
|
|
Hi everyone,
I have a string array in C# includes 4 strings:
{"string1", "string2", "string3", "string4"}
In C#, I can use List<string> or string[] to process. But now I want to send this array to a function in C++ (may be is vector<string>).
How can I do that ? and what is the suitable type of string array in C++
Thanks and regards,
Tai
modified 17-Jun-13 0:11am.
|
|
|
|
|
C# string[] becomes array<String^>^ in C++.
List<string> becomes List<String^>^.
Remember you need to allocate managed types with gcnew in C++. (The regular new is for unmanaged types.) The conversion is done automatically on function call. In fact it isn't even a real conversion, as the meaning/memory layout is the same, just the expression looks different. So you declare a function taking a array<String^>^ and pass in a string[] or the other way araound.
Keep in mind, you can't have C# and C++ in the same module (exe/dll) so you need to separate the code into different ones.
|
|
|
|
|
Freak30's answer is good and thinking about it I realize you may want to get the string value to native C++ code instead of just to C++/CLI. If that's the case, you'll want to look into the marshal_as templates.
ex.
#include <msclr\marshal.h>
. . .
const char * message = "test";
String^ managed = marshal_as<String^>( message );
|
|
|
|
|
Thanks Freak30,
I am using Visual Studio 2010. I tried to send string[] in C# to string[] in C++, but not successful
In C#, I used below codes:
[DllImport("DgnShpConverter.dll")]
public static extern Boolean ConvertDgnToShp(string source, string destinationPath, string shpFileName, string [] strArray);
And in C++ (file DgnShpConverter.dll), I used below codes:
__declspec(dllexport) bool ConvertDgnToShp(const char* sourceFile, const char *destinationPath, const char *shpFileName, string myArray[])
{
}
Do you know how to fix this ?
Thanks and kind regards,
Tai
|
|
|
|
|
|
Hi Karthik,
Thank you very much. Your link is very useful. I will try it.
Kind regards,
Tai
|
|
|
|
|
I have migrated a bunch of C++/CLI code out of my main mixed-mode executable into a DLL but Windows explorer is not showing the details for the DLL. I set them like this in my AssemblyInfo.cpp:
[assembly:AssemblyTitleAttribute("MyDLL")];
[assembly:AssemblyDescriptionAttribute("A cool component")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("My Company")];
[assembly:AssemblyProductAttribute("My Product")];
[assembly:AssemblyCopyrightAttribute("Copyright © My Corp 2013")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
[assembly:AssemblyVersionAttribute("2.0.0.0")];
I also have a C# DLL with settings just like this in its AssemblyInfo.cs and they ARE shown in the Details pane of the Explorer Properties dialog.
I suspect I'll need to add a .rc file with VERSIONINFO but was hoping to avoid duplicating info like that (and it's a small hassle to hook into the build).
Has anyone here faced and solved this issue?
John
|
|
|
|
|
I'll answer my own question for future visitors. Yes, adding the VERSIONINFO resource was necessary. And, it was easier than I thought - just right-click on Resource Files folder in Solution Explorer, Add > Resource... and select VERSIONINFO.
John
|
|
|
|
|
Odd that Microsoft puts their debug annotations into their code now (winnt.h)-does that mean they'll finish testing at the customer premises?
Daniel Kilsdonk
|
|
|
|
|
|
Hello everyone,
so I'm using VC++ 2008 and I've got a large solution made up of several different interconnected projects, some of which are DLL's (no CLR). In one of these DLL's I'm trying to import an EXTERNAL Visual Basic dll using the command #import "C:\path\to\my\DLL\file.dll" . If I use this command in one of my .cpp files, it works. If on the other hand, I use it in one of my .h files, I then get the following compile errors in the files ocidl.h and comdefsp.h. I noticed that the .tlh and .tli files generated by the #import command include the file comdef.h. There are other files in my project that include the file comdef.h. Could this be the reason for the conflict?
Error 1236 "solution_name" error C2872:
Error 1237 "solution_name" error C2872:
Error 1238 "solution_name" error C2872:
Error 1239 "solution_name" error C2872:
Error 1240 "solution_name" error C2872:
Error 1242 "solution_name" error C2872:
Error 1243 "solution_name" error C2872:
Error 1244 "solution_name" error C2872:
Error 1245 "solution_name" error C2872:
|
|
|
|
|
since IDropTarget is a type, and it is referenced in ocidl.h, 'ambiguous' implies two definitions for the same, one must not disclude that the two definitions ARE the same and this would point to the common error of an include file, including itself.
An include file should never include itself! But include files are notorious for including themselves vis-à-vis other include files. While it is of poor craftsmanship, it IS promoted in K&R C manual itself when they proscribe something akin to:
#IFNDEF THISFILENOTALREADYREAD
#define THISFILENOTALREADYREAD
....
your h file: 'thisfile'
...
#ENDIF
If this is not the case, kindly submit the result of this search complete solution
'IDropTarget'
Also, there is a switch you can throw that will indicate the include files as they are included. That would be helpful.
Daniel Kilsdonk
|
|
|
|
|
I have project which I am compiling with /clr. I have a class like below..
ref class A
{
public:
void CheckValue(void * test);
typedef ref struct val
{
std::string *x;
}val_t;
};
in my implementation I ahve to use something like below..
void A::CheckValue(void *test)
{
a::val_t^ allVal = (a::val_t^)test;
}
in my main I have used like..
int main()
{
A^ obj = gcnew A();
a::val_t valObj = new std::string("Test");
obj->CheckValue((void*)valObj);
}
I am getting type cast error and two places - obj->CheckValue((void*)valObj); and at obj->CheckValue((void*)valObj); error C2440: 'type cast' : cannot convert from 'void*' to 'A::val_t ^'
This snippet is just to show behavior at my end and I ahve to use it this way only. Earlier I was running it using non /clr so it compiled fine.
Now question I have how can I make this type casting work in C++/CLI type project?
|
|
|
|
|
|
As we know C++ disdains poor typing. Some day it will achieve Pascal or Ada greatness!
Try:
desired_ptrtype newone=static_cast<desired_ptrtype>(voidstarptr)
Daniel Kilsdonk
|
|
|
|
|
Getting Access Violation Exception when trying to convert unmanaged array of structures into managed in Vb.Net(VS2010,4.0 framework) in Windows 7 -64 bit mode.
Sample Source Code
<structlayout(layoutkind.sequential, charset:="CharSet.Ansi)"> _
Public Class vb_menu_dotnet
Public level As Short
Public menu_id As String
Public short_desc As String
Public parent_id As String
Public access As Short
Public flag As Short
Public menu_desc As String
End Class
Dim current As IntPtr
Dim outArray As IntPtr
Dim manArray(100) As vb_menu_dotnet
vb_dotnet_get_menu_hierarchy(p_menu_handle, p_apl_id, outArray) //C API call
current = outArray
Dim j As Integer
For j = 1 To 100
manArray(j) = New vb_menu_dotnet()
Marshal.PtrToStructure(current, manArray(j)) //Access Violation Exception
Vijay
|
|
|
|
|
You may need to try a VB.NET forum. This is for C++/CLI code.
|
|
|
|
|
Dim current As IntPtr
Dim outArray As IntPtr
Dim manArray(100) As vb_menu_dotnet
vb_dotnet_get_menu_hierarchy(p_menu_handle, p_apl_id, outArray) //C API call
You have not initialised any of the pointers that you are sending to the C-language library. Take a look at this P/Invoke tutorial[^] for more information.
Use the best guess
|
|
|
|
|
Hi ,
whatever database u r acessing or data retrieval policy u might be using for e.g INI file,must be in Read Mode,Try to make it Write protected
|
|
|
|
|
Did you actually read the OP's question?
Use the best guess
|
|
|
|
|
Hi ,
whatever database u r acessing or data retrieval policy u might be using for e.g INI file,must be in Read Mode,Try to make it Write protected
|
|
|
|