|
IF the dll is a Microsoft one, then pinvoke.net[^] might help. Either way, it would give you examples showing how this is done.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks Christian
Unfortunately,it's not a MS one.It's an Intel one. I have already checked the pinvoke documentation and marsalling in msdn but it didn't provide me with examples in my case.
do you have any idea what can i do?
Thanks and Best Regards,
E.A.
|
|
|
|
|
If you know the total size of the structure and if the contents of the structure dont matter, then you can try allocating memory equal to the size of the structure and pass the pointer to the memory as a void parameter instead of marshalling it as a structure.
-Atul, Sky Software http://www.ssware.com
Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls
|
|
|
|
|
What if I have the following case :
struct x (whose structure is unknown)
x* a = function(string m);
int b= function2(a,....);
If I used your idea, will it work in that case?
Thanks for your help,I really appreciate it...
Best Regards,
E.A.
|
|
|
|
|
hi, I posted this somewhere before, but it is rather important that I get an answer. hope this doesn't violate any rules or anything on posting to repost it.
anyways:
yeah, I have a datagrid control on a form. How do I do a simple binarysearch on the table so I can select the row that results were found in. thanks. also, is there a way I can make rows invisible so they still exist, but aren't visible? thanks so much.
Stephen
also, in this datagrid, I'm displaying id3 information about mp3's using a library I found online. it works well, but when I display the information it outputs in the datagrid, I get many of these strange symbols that look like a square. I exporte dthe datagrid as an xml file and found the square to be represented by & # x 0 ; minus the spaces. I can also paste this sequence here without spaces and it will show the odd symbol:
-- modified at 22:24 Thursday 8th September, 2005
|
|
|
|
|
Pyro Joe wrote:
yeah, I have a datagrid control on a form. How do I do a simple binarysearch on the table so I can select the row that results were found in
You will need a custom search procedure that will loop through the items in the bindingmanager of the datagrid. Each index in the item list of the bindingmanager equals one row in the datagrid. You can select rows in the datagrid using the Select(rowIndex) method
Pyro Joe wrote:
also, is there a way I can make rows invisible so they still exist, but aren't visible? thanks so much.
Use the dataview component. It's perfectly suitable in the situation. It can hide rows using a rowfilter.
Pyro Joe wrote:
and found the square to be represented by & # x 0 ; minus the spaces. I can also paste this sequence here without spaces and it will show the odd symbol: �
There is something wrong with library you are using or there's something wrong with the interface communicating with the library. Have you asked the creator of the library if this is some kind of bug? Because I think the library is pumping out id3 data that isn't really part of the id3 data.
WM.
What about weapons of mass-construction?
|
|
|
|
|
hi i am tryin to sent the word hi using serial port to the other computer when i clicked on the hi button.
public void Write(byte[] WriteBytes) <br />
{<br />
<br />
if( hComm != INVALID_HANDLE_VALUE ) <br />
{<br />
OVERLAPPED ovlCommPort = new OVERLAPPED();
<br />
int BytesWritten = 0;
<br />
WriteFile(hComm,WriteBytes,WriteBytes.Length,ref BytesWritten,ref ovlCommPort);
<br />
}<br />
<br />
}
this is my write()
so at the hi button what parameter should i pass over.
Hope to get an example from u guys thanks alot
|
|
|
|
|
hi, I can't be much help, but just checking and sort of asking. isn't it dangerous and won't it short out a port to directly connect a serial port from computer to computer, pretty sure the signal has to be inverted or rerouted to the incoming ports, otherwise data will clash inside the wires right?
|
|
|
|
|
hmm dont really know much abt hardware..
i just connect a serial from com 1 to com 2 of the same computer. and use hyper terminal on com 2 to check the input
|
|
|
|
|
Yes, he needs a null modem cable, which is wired to deal with the problem you're describing.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a WinForm that calls Func1() and Func2 in the Form1_Paint handler.
I also have a "Clear" button that sets a bool flag to false which then in
turn sets false the bool flag in the code that draws the two lines, BUT leaves my Form intact- that is the axes, labels etc...remain. Just the lines
are removed.
The line coordinates are based on TextBox values, converted to double and passed in to the DrawLine(.. funcs.
Q. Is there some way to only change/erase just one line at a time?
thanks......................
|
|
|
|
|
If you're drawing lots of lines, you could add them to an arraylist, and remove them when you delete them, or if you want to redraw them, put a flag on each to say if it should be drawn or not. There's no way to erase them per se, you simply do not draw them if you don't want them.
If you have two lines and you just want to choose which ones to draw, use an enum instead of a bool so you can store multiple states.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
call Invalidate(rect), in place of Refresh(void) or Invalidate(void).
the rect parameter with is the rectangular area your line covers
This will change the only line also reduce the waste repainting efforts taken by processors in redrawing whole window
Cheers
|
|
|
|
|
this may be a long winded a unefficient way to do it, but couldnt u get the co-ords of the line u want to erase and simply re-draw it, but in white (or ur background colour), effectly "erasing" the line visually.
another way is to maybe clear the whole area ur drawing on, then re-draw the line u want to keep.
i know both are basically quick fixes, not the best way to approach it, but they' work
|
|
|
|
|
Hi All,
I have the following problem:
After sending a Write command to a device, directly followed by a Read command it seems that the data on the device is not yet available.
It seems that the write/read part is too fast for the device to 'generate' the data.
<br />
port.Write("some request");<br />
<br />
char[] cData = new char[port.BytesToRead];<br />
port.Read(cData, 0, cData.Length);<br />
strTemp = new String(cData);<br />
The baudrate is 9600 and cannot be set any higher.
Also i would not like to add a pause like:
System.Threading.Thread.Sleep(1000);
It's unknown how large the buffer is, so it could well be beyond 1 second, but could be much less too.
Does anyone have a solution here ?
Thanx,
Jan
-- modified at 19:09 Thursday 8th September, 2005
|
|
|
|
|
You could have the client send something to the server(or machine sending information) telling that it is finished.
Are you using StreamReader/StreamWriter?
|
|
|
|
|
Hi ExpertComing,
I'm using System.IO.Ports.SerialPort from the 2.0 Framework.
Not using streamreader/writer.
thanx for the answer,
Jan
|
|
|
|
|
Just keep reading until you get the data. Stop reading when you have the amount of data you need. Discard all the zero's at the beginning that you don't need.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Thanx Willem,
The problem is that i don't know how much it is upfront.
Logic is like this:
a) send request
b) get requested data
c) use requested data in another routine
there is no real end-of-transfer charcter to look for.
Also, after the request the device will not do anything (data-wise) until a new request is sent to the device.
What would be best here?
Something like:
1) send request
2) read data in loop until it has null or timeout?
Did you or anyone else have the same problem to tackle?
Thanx,
Jan
|
|
|
|
|
I used a little more complex protocol on the device I was communicating with.
It's a little problematic when you don't get an end-of-transfer character or something like that.
You could try reading in a loop until you get null. That should work perfectly well in this situation.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Bedankt Willem,
i'm not requesting any source code but what specific subject should i google on for something similar like my 'problems'?
Tanx,
Jan.
|
|
|
|
|
I had this problem myself, I can demonstrate how you make a loop, however I don't know how the comport component of visual studio 2005 works.
byte? data;
while(data != null) {
}
WM.
What about weapons of mass-construction?
|
|
|
|
|
looping it is
Will need to test and see if there is any logic in termination of a stream or some kind of end-character.
Thanks.
|
|
|
|
|
I am trying to name a label using a string.
string labelname = "lbl" + skill;<br />
(Label)labelname.Text = skill;
That is the code, I get an error saying "'string does not conatian a definition for 'text'" The error makes sense, and I know why I am getting it, but how do I tell the system that string labelname is going to become Label labelname?
|
|
|
|
|
You can't. You can't turn one object into another. You need to *create* a label, then set it's Text property.
Christian Graus - Microsoft MVP - C++
|
|
|
|