|
Hi,
I use P/Invoke to call native code. When I am in charge of the native code's API, I keep it as simple as possible, so not to rely on automatic marshaling which tends to cause data copying if one isn't careful.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I don't have the API's code available as well. Not being a C# developer can you please make me understand what is automatic marshalling and how can it be implemented.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
either do some research, or ask a specific question, or both.
calling Win32 API functions is handled rather well at this PInvoke site[^]
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks for your reply. Will prefer investigation
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
_AnsHUMAN_ wrote: Create a Bridge DLL in Managed C++. If we don’t have the source code for the dll’s this approach would be better.
You are using C++/CLI right? C++/CLI supports C++ Interop and it is more preferable than P/Invoke. So I think Solution B is going to be good.
_AnsHUMAN_ wrote: Also do we need to write a wrapper for each and every function a WIN32 dll exposes?
I think, you only need to wrap functions that you use. Take a look at Nish's C++/CLI in Action, it covers these topics.
|
|
|
|
|
Hi Guys,
Can anyone give me the download link for Microsoft Expression Blend (MEB) and by the way, whats the size of the Setup?
Your help will be appreciated,
Rajdeep.NET
|
|
|
|
|
You can dowload a 30-day trial here[^] (it's 200Mb big).
For the full version you have to pay 500$[^]
|
|
|
|
|
Friends,
I want to compare an image file which contains text with a text file.
Is it possible? If so, could you please help me in achieving the same.
Thank,
Snu
|
|
|
|
|
You mean a text in an image need to copmared with a string????
IF this is the case then you need to go for image recognition systems.....
(Not such an easy task as easy to say).....
Have a Happy Coding.....
|
|
|
|
|
Hi
I dont mean text in an image. I have a TableLayoutPanel and i have added label controls to the each cell of its 1st column.Also i have used a listview control to display the list of all files from a directory.For a design purpose, i want the name of the file to be displayed in the 1st label in the 1st cell of the table when i select any file name from the listview control.Similarly when the 2nd item from listview is selected it should appear in the 2nd label.
Currently i have a design which has a mapping like when i select on the 1st filename it appears in the 1st label,2nd file name in the 2nd label...the drawback that i face here is that suppose if by random i select 5th filename from listview it appears on the 5th label.
I hope im making myself clear.Please help me with this
|
|
|
|
|
Hi
Can you please tel me how to retrieve multiple items from Listview?
If i use
ListView.SelectedListViewItemCollection sl = this.listView1.SelectedItems;
lb4.Text = sl[0].Text; The item that is selected first from the listview should be displayed in the 1st label added to the TableLayoutPanel.The next selected item from listview should be displayed in the 2nd label added to the Table.Can you please help me with this?
|
|
|
|
|
mrithula8 wrote: ListView.SelectedListViewItemCollection sl = this.listView1.SelectedItems;
lb4.Text = sl[0].Text;
the above code itself will get you the list of selected items.
If you want to assign each selected item to each label, then create a control array of label and iterate through a for loop
like
for(int i= 0; i < sl.Count; i++)
{
Labelarray[i].Text = sl[i].text;
}
Have a Happy Coding.....
|
|
|
|
|
Hi
I used the following code
foreach (ListViewItem ltv in listView1.SelectedItems)
{
lb4.Text = ltv.Text; listView1.SelectedItems gets all the selected items from the listview.The first item that i select from the listview gets displayed in the lb4.I want the next selected item from the listview to get displayed in lb5.I believe that ltv contains the list of all selected items but i do not know how to add it to label.Can you tell me how to do this?
|
|
|
|
|
I think you have posted wrongly to some other thread i believe....
Have a Happy Coding.....
|
|
|
|
|
|
Hi
I have a TableLayoutPanel and i have added label controls to the each cell of its 1st column.Also i have used a listview control to display the list of all files from a directory.For a design purpose, i want the name of the file to be displayed in the 1st label in the 1st cell of the table when i select any file name from the listview control.Similarly when the 2nd item from listview is selected it should appear in the 2nd label.
Currently i have a design which has a mapping like when i select on the 1st filename it appears in the 1st label,2nd file name in the 2nd label...the drawback that i face here is that suppose if by random i select 5th filename from listview it appears on the 5th label.
I hope im making myself clear.Please help me with this
|
|
|
|
|
Hi
I used the following code.Whichever item i select from the listview appears on the 1st label.The item that is selected 2nd does not appear in the 2nd label.Im not clear what sl[1] will contain?Can you tell me the mistake?
Label[] lb = new Label[4];
lb[0] = lb4;
lb[1] = lb5;
lb[2] = lb6;
lb[3] = lb7;
for (int h = 0; h < sl.Count; h++)
{
lb[h].Text = sl[h].Text;
}
|
|
|
|
|
ofcourse.... the code is working according to what it was written.
I assume that you are calling this code after you select the item from the listview.
In that case, have a close look at the for loop. every time the for loop counter initializes to 0
mrithula8 wrote: for (int h = 0; h < sl.Count; h++)
it means that whatever you select, that will be assigned in order from the first label. Thats wat is happening....
If you want to display the listview item 1 in label 1, then you try getting the item number of the list view and use the same number as the index for the label control array and i think your problem could be solved.
for (int h = 0; h < sl.Count; h++)
{
lb[sl[i].Index].Text = sl[i].Text;
}
Make sure that you have n number of labels if there are n number of items... otherwise it may throw you an exception....
Have a Happy Coding.....
|
|
|
|
|
Hi
Thanks for reply.I do not want to display the 1st item in the 1st label.Suppose for the 1st time i select the 10th item that should appear in the 1st label.The 2nd time if i select the 5th item it should be displayed in the 2nd the label......Actually i uesd the code in the selected indexchanged event
<pre> private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
ListView.SelectedListViewItemCollection sl = this.listView1.SelectedItems;
Label[] lb = new Label[4];
lb[0] = lb4;
lb[1] = lb5;
lb[2] = lb6;
lb[3] = lb7;
for (int h = 0; h <= sl.Count; h++)
{
lb[h].Text = sl[h].Text;
}
}
modified on Wednesday, April 8, 2009 2:18 AM
|
|
|
|
|
Oh!!!
then use a wild way...
declare a static int and use that as label index
static int counter = 0;
for (int h=0; h<sl.count;>{
if (counter < lb.Length)
{
lb[counter].Text = sl[h].Text;
counter++;
}
}
Have a Happy Coding.....
|
|
|
|
|
Hi
When i used this, it says invalid static modifier for this item.So i used <pre>static int counter=0</pre> outside the method but im not able to select any item from listview.
|
|
|
|
|
Not sure how you have implemented it.
i suggest declare the counter(static int counter = 0) not inside any methods. Just declare inside it inside the class. That would do...
But how does this matter when selecting an item from the List View????
can you place the entire code block or atleast how you call this method after selecting the items.....???
Have a Happy Coding.....
|
|
|
|
|
Hi,
I used this code in the selectedIndexchanged().Is this right?I declared the conuter variable inside the class.When i execute the code the form does not respond.
<pre>private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
ListView.SelectedListViewItemCollection sl = this.listView1.SelectedItems;
Label[] lb = new Label[4];
lb[0] = lb4;
lb[1] = lb5;
lb[2] = lb6;
lb[3] = lb7;
for (int h = 0; h < sl.Count;){
if(counter<lb.Length)
{
lb[counter].Text=sl[h].Text;
counter++;
}
}
}
modified on Wednesday, April 8, 2009 5:18 AM
|
|
|
|
|
Declare a label control array in the Form class like this
public Label[] lblArray = null;
static int counter = 0;
Inside the form load method add your labels like this.....
this.lblArray = new Label[] { label4, label5, label6 };
Then the event should look like this...
private void ListView1_SelectedIndexChanged_1(object sender, EventArgs e)
{
ListView.SelectedListViewItemCollection sl = ListView1.SelectedItems;
for (int h = 0; h < sl.Count; h++)
{
if (counter < lblArray.Length)
{
lblArray[counter].Text = sl[h].Text;
counter++;
}
}
}
I have even checked this myself... Its working for me... without any problem...
Have a Happy Coding.....
|
|
|
|
|
Hi
Thanks its working now
|
|
|
|