|
Hi All I have a project and I want to add another project to it when the installer
install the project it should list both project
on the programe menu. So, user can select either one to run.
FYI: the first project in VC++ and the second one is C# both windows application.
Base Programe Folder:
1. App one
2. App two
please any idea or hint would help. Or any codeproject articale
thanks
|
|
|
|
|
|
Hi, guys, I have a C# struct array and I need to pass it to C++ code and get it filled with necessary data. Here is my C# code:
public struct DataStruct
{
public string dataName;
public int slot;
public int quad;
public DataStruct(string name, int slot, int quadrant)
{
this.dataName= name;
this.slot = slot;
this.quad = quadrant;
}
}
// C++ function
[DllImport("CppCode.dll")]
public static extern int GetDataList([In, Out] DataStruct[] dataList);
// Create the struct array
DataStruct[] dataList = new DataStruct[512];
// Call C++ function
GetDataList(dataList);
C++ code in CppCode.dll:
struct DataStruct
{
char * dataName;
int slot;
int quad;
};
DLLEXPORT int GetDataList(DataStruct* dataList)
{
for (int i = 0; i < 100; i++)
{
dataList[i].dataName = "qqq";
dataList[i].slot = i;
dataList[i].quad = i+1;
}
return 0;
}
Please help to find out if I did something wrong. The most strange thing is that this code works fine in some computers but in other computers, it crashes when return back from C++ code.
Thanks a lot!!
|
|
|
|
|
you should transfer strings between C# and C++. Use a char[].
Quick rule: use native data types for interfaces. (Use them everywhere erverytime and forever)
Never ever use objects or class types.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
songll wrote: dataList[i].dataName = "qqq";
This will not work, you cannot put a pointer where C# has a string. Also the pointer will no longer be valid on return to the C# code. You need to provide a character array (Unicode) and the C++ code will need to copy the text into the array.
|
|
|
|
|
Thanks, Richard, Can you give me a detail example on how to copy this?
|
|
|
|
|
songll wrote: Can you give me a detail example on how to copy this?
Not exactly. You need to modify your C# structure to contain only basic types that will map directly to C++ types. You can then use the wcscpy_s[^] function to copy text into the structure. See also Interoperating with Unmanaged Code[^], for more details and examples.
|
|
|
|
|
May be an old issue But I am not able to solve.
I have a Microsoft reportviewer report in my application. The report loads tables from a datatable and loads some other values from my object class properties. So far OK
I have a image control in my report. I have to load a image from my application folder at runtime. cannot use embedded as the image is being changed before every time report loads.(Image is actually a graph image from zedGraph)
How to do it. I saw some posts but cant get the idea clearly.
please help
Thanks
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
You can get the path to the folder that your app was launched from using Application.StartupPath and build the fully qualified path to your file using the Path class:
string fullPath = Path.Combine(Application.StartupPath, "myfilename.bmp");
|
|
|
|
|
Possible solutions :
- modifying the registry in HKCU
- modifying the registry in HKCR
- using ClickOnce
So far I haven't been able to find a method that actually works with all 3 OS's.
Does somebody have some example code how to go about this ?
(Everybody always points to the FileAssociation code on this site, but that doesn't work under Win7)
|
|
|
|
|
Why would you need code to do something that only needs to be done once?
Doesn't work on Windows 7?? Worked fine for me...
|
|
|
|
|
hello there...
I need to do a graphic like this one:
http://zedgraph.org/wiki/index.php?title=Stacked_Bar_With_Labels_Demo_v4[^]
but the x axis values need to be date and the first value is the current datetime.
I am using the code you find in the link, but added this line:
myPane.XAxis.Type = AxisType.Date;
myPane.XAxis.Min = (double)new XDate(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")));
and the x1,x2,x3 variables set with
(double)new XDate(.....)
can someone help me??
sorry my English! :P
|
|
|
|
|
You are better off asking the vendor
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Zedgraph is free, so there is no vender...
anyway, i will try theirs website.
|
|
|
|
|
It didn't just materialize out of thin air. SOMEONE had to write it! There is a discussion forum on the project site.
|
|
|
|
|
looool
really ?
I think i got it.. wrong BarType
thanks!
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:58am.
|
|
|
|
|
hey,
I' am going to update to the latest version and try your code.
It will probably solve my problem.
thanks a lot.
|
|
|
|
|
Hi,
I'm working on a WebDAV Application.. I can now connect to an ip, say, http://localhost:9005/MyWeb/ by creating a web folder. I could create and delete the web folder using C# code... I could traverse my web folder thoroughly... Is it possible for me to map this web folder to a new drive (using C#) so that I can access the contents from a drive in My Computer..? A software by name NetDrive is able to do it... Pls suggest on how I can achieve this...
Thanks,
ramzg
|
|
|
|
|
If I create a new Windows Forms Application and double click on Form1.cs in Visual Studio, the code editor appears. Normally, I'd expect the designer to open up so I can drop controls and the like on my new form.
There's a setting somewhere I think - but don't know where.
Any ideas?
Regards,
Rob Philpott.
|
|
|
|
|
Cancel that, I've found it. Right-click then open with and set as default. I am stupid.
Regards,
Rob Philpott.
|
|
|
|
|
additional you have above the form1.cs in your solution view several buttons..
one is to show the code and an onther one is to show the designer..
|
|
|
|
|
Hello Friends,
i am working on a desktop application that i have build in VS2005 using C#.
In this application user needs to login to get in. first i have placed my database created in MS Access in same installed directory and i have connect with it to verify the users credentials. now my requirement is bit change. i want to place MS data base on a center point from where every one can access the DB for login. can u please let me know how i can establish the connection between them.
my previous connection string was this.
string strDBPath = AppDomain.CurrentDomain.BaseDirectory + dbChartImager.mdb";
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDBPath + ";Jet OLEDB:Database Password=supna786;Mode=ReadWrite|Share Deny None");
this was working fine.
now i have upload my db on a server and trying to access with following connection string but is not working.
string strDBPath ="http://domainname.com//dbChartImager.mdb";
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDBPath + ";Jet OLEDB:Database Password=supna786;Mode=ReadWrite|Share Deny None");
please let me know how i can access it. and if possible please provide some sample code that can help me.
Thanks
|
|
|
|
|
And what is the error you're receiving..?
|
|
|
|
|
i am getting the exception when i try to connect that "Not a valid File Name"
|
|
|
|