|
I have a dll file. The dll file has functions like that
"typedef short apiStatus;
apiStatus __declspec(dllexport) __stdcall DrfCommOpen (HANDLE * hCom, char *com_port);"
how i can call and use this function in my c#.net application?
thanks in advance..
regards..
|
|
|
|
|
I got a bug in the application which is as follows
When i am doing login to my application, welcome window will come with the login name and at the same time the update page will also be shown minimized... at this time i can do the modification in name and i press the update button it will make the changes to the welcome window.. but when i close this update page and reopen the same.. and i perform the same task again. it is not getting updated in the welcome window..
Any idea for this bug to be cleared..
|
|
|
|
|
Fix your code. Hard to say more, based on your description. Post some code perhaps, explain how you've used the debugger to diagnose the issue, etc.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Im doing some operations in BackgroundWorker's DoWork event. So when I call the following line, it works good but when I call second one it shows "Cross-thread operation not valid" error.
backgroundWorker1.ReportProgress(((b + 1) * 100) / listView1.Groups[a].Items.Count, new object[] { 1, listView1.Groups[a].Items[b].SubItems[0].Text });
backgroundWorker1.ReportProgress(((b + 1) * 100) / listView1.Groups[a].Items.Count, new object[] { 1, listView1.Groups[a].Items[b].Index });
I know how to fix this error. But my question is why its not raising with first line ??
I tried with DGV and it works good.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I am working on window application.
On a list view i am storing names of file.
when we double click a file in widows folder, the file gots open into its default application. (as suppose there is text file, and we click it, then it got opened in notepad).
Is there way to achieve the same with in application. So that user click on file name, and file got opened in its application.
any help/link much appreciated.
regards,
|
|
|
|
|
Hum Dum wrote: Is there way to achieve the same with in application. So that user click on file name, and file got opened in its application.
You mean associate a file with your app ? That's done in the registry, and your app needs to take a file path on the command line and open it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: You mean associate a file with your app ?
Not really......!!
when we double click a file say of any extension, it got opened in its application(which is associated with it).
i just want that. I am storing filename only (file remain in a folder), and wants when user click on the filename. It got opened.
Or say just making a list of file present in specific folder(wheteher its .txt, .rtf, .doc, .pdf etc).
Now just wants whenever user click on particular filename, it got opened(not go to that folder and fron there open that file).
regards
|
|
|
|
|
There is an article here at CP which shows how to do file association. Search for it.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Not really......!!
when we double click a file say of any extension, it got opened in its application(which is associated with it).
i just want that. I am storing filename only (file remain in a folder), and wants when user click on the filename. It got opened.
Or say just making a list of file present in specific folder(wheteher its .txt, .rtf, .doc, .pdf etc).
Now just wants whenever user click on particular filename, it got opened(not go to that folder and fron there open that file).
|
|
|
|
|
That is called "associating a file extension with your app"
really.
you got the right answer twice.
And if you are going to contradict the truth one more time, you're a moron.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I don't think he wants to associate a file extension with his program, I think he wants to be able to open an external file in the appropriate program.
Hum Dum, if I'm correct you just need System.Diagnostics.Process.Start(). So if you have a file at C:\testfile.txt and you want to open it in Notepad you could just do something like this:
System.Diagnostics.Process p = new Process();
p.StartInfo = new System.Diagnostics.ProcessStartInfo("C:\testfile.txt");
p.Start();
|
|
|
|
|
Thanks for reply.
hollismarek wrote: I think he wants to be able to open an external file in the appropriate program.
Absolutly correct.
But one question related to this process,
Is it going to slow or create any overhead on my application ?
as user will click many times to open a file.
for that i have to run each time this.
|
|
|
|
|
If you dispose of the process object after calling Start I think you should be ok.
|
|
|
|
|
Luc Pattyn wrote: you're a moron
I suppose this forum is for help, not for shouting
I am just clearing my doubts,
If its related with file association, then i will do it.
But for just opening a file doing all this association ??
I am just looking for simple solution.
But with reply like that...
"I am understanding how mature you are...!!"
|
|
|
|
|
I am working on this application(asp.net 1.1,sql server 2000) that has a huge database , in the frontend there is a provision
to generate a csv file by running a stored procedure which can fetch 50000 records(approx), to acieve this I've used the
following:-
1) running forloop iterating through the dataset and creating a comma separated string, then creating the csv file, but this
process slows down the server immensely when data fetched is huge.
2) DTS packages is failing, because when I am creating a new package and click the defeine column button, the SQL Enterprise
manager just closes itself after a few seconds.
3) BCP command, sometimes works sometimes does not. The code used for running bcp in C# is :-
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "bcp";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.Arguments = @"""exec ETH11.dbo.usp_DownloadInvoiceforDalkia "" queryout ""D:\NewLookLogs\Invoice.csv"" -c -t ,
-T -S";
proc.StartInfo.Arguments = proc.StartInfo.Arguments.Replace("usp_DownloadInvoiceforDalkia ","usp_DownloadInvoiceforDalkia
"+"'"+xSupplierID+"',"+"'"+xBuyerID+"',"+"'"+xFromDate+"',"+"'"+xToDate+"',"+"'"+xType+"',"+""+xCurrentOnly+","+""+xDateType+
","+""+xStatus+","+""+xAllStatus+","+""+xContentType+","+"'invoice.csv',"+"'"+Session.SessionID+"'");
proc.Start();
proc.WaitForExit();
|
|
|
|
|
please don't cross post.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
A few months ago some of you helped this hardware engineer with a c background understand that list elements are passed by reference. I solved my immediate problem but have run into another wall.
I have two global lists defined in my form:
List <CUserMem> MemoryBank = new List<CUserMem>(100);
List <CUserMem> CombinedMemories = new List<CUserMem>(100);
After a while, the first list becomes has out of date info and I must "garbage collect" by copying the still-needed elements of the first list to the second list. I simply do :
CombinedMemories[Index].whateverelement = MemoryBank[AnotherIndex].whateverelement;
It works the first time through but of course the next time I update MemoryBank, CombinedMemories is also updated. I tried to avoid this by:
local (temporary) variable = MemoryBank[AnotherIndex].whateverelement;
CombinedMemories[Index].whateverelement = local (temporary) variable;
That doesn't work. After the local variable is destroyed, the two list elements still have the same reference.
So what is the correct way to work with 2 global lists like this?? Can I create a copy of the first list that is not "linked" (have the same reference)???
Thanks -
Chuck
Chuck
|
|
|
|
|
1. Please tell us more about CUserMem and whateverelement so we can help you better.
2. Is it the intention to have each item in one of the lists, but never in both of them?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
CombinedMemories[Index].whateverelement = (cast as appropriate) MemoryBank[AnotherIndex].whateverelement.MemberwiseClone();
This will give you two separate objects with the same contents instead of multiple references to the same object.
|
|
|
|
|
Gerry:
Thanks fot taking the time to reply.
I had seen a couple of references to the fact that cloning a List just copies the references, so you end up with the same problem I started with. See: http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/de75a3c3-2920-48ae-bf85-0399e5ee7a10 and also http://weblogs.asp.net/jeff/archive/2005/11/21/431125.aspx .
But wanting to give it a try anyhow, I took your advice and used MemberwiseClone with your syntax:
CombinedMemories[NumberOfCombinedMemories].bUsed = (Boolean) MemoryBank[i].bUsed.MemberwiseClone();
but get the following error:
Error 3 Cannot access protected member 'object.MemberwiseClone()' via a qualifier of type 'uint'; the qualifier must be of type 'WindowsFormsApplication1.Form1' (or derived from it)
This I do not understand.
Chuck
|
|
|
|
|
Chuck,
I had to make a few assumptions from your original post, assuming you wanted to "clone" a "member" in the list, and not the list itself.
Anyway, cloning a "list" would clone "references" for a "shallow" clone; but would create new objects for a "deep" clone. Same with cloning a single object; shallow cloning would create references for "fields" in the oject that referenced other objects, but would create new objects referenced for by those fields for a deep clone.
Anyway, here is an example of how I understood your problem in the first place; cloning an "element" (ie. object) from one list to another where that element / object does not reference other objects:
(Note that strings, while being reference types, are "deep" cloned in this case ... )
<pre>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static List<Widget> List1 = new List<Widget>();
static List<Widget> List2 = new List<Widget>();
static void Main( string[] args ) {
List1.Add( new Widget() {
Description = "I am a Widget",
OtherData = "12345"
} );
List2.Add( List1[ 0 ] );
Display( "@1" );
List1[ 0 ].Description = "I was changed";
List2[ 0 ].OtherData = "abcde";
Display( "@2" );
List2[ 0 ] = List1[ 0 ].MemberwiseClone();
List1[ 0 ].Description = "I was cloned";
List2[ 0 ].Description = "I am the clone";
Display( "@3" );
}
public static void Display( string location ) {
Console.WriteLine( location + " List1 = {0}; List2 = {1}",
List1[ 0 ].ToString(), List2[ 0 ].ToString() );
}
}
class Widget {
public string Description;
public string OtherData;
public new Widget MemberwiseClone() {
return ( Widget ) base.MemberwiseClone();
}
public override string ToString() {
return Description + "(" + OtherData + ")";
}
}
}
</pre>
modified on Wednesday, November 11, 2009 5:46 PM
|
|
|
|
|
Gerry:
This was a wonderful piece of help with a concrete example to giuide me. I've got the code fixed and I learned something in the process. Can;t beat that combination.
Chuck
|
|
|
|
|
Thanks for the feedback, Chuck. I appreciate it.
|
|
|
|
|
I'm using a stored procedure (proc) for the SqlDataSource1 of my local report (rdlc). I've changed my proc to include an additional field. When I try to edit my local report to add the new field, it does not show up in the dataset or fields under the expression buider. How do I get the dataset to recognize my new field.
|
|
|
|
|
Yes.. this is really a problem with rdlc console.
I think you need to clear the existing dataset from the report to continue.
Right click on rdlc report -> Open With Xml Editor
After you open find <Dataset> and remove its content. Now open the report, add any field to the report, your dataset will be added again with all the fields. (You can also update the report xml with your new field)
Note: Before you do, backup your existing dataset to avoid corrupt of the report.
|
|
|
|