|
Hi,
Use This ......
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand,StringBuilder strReturn,int iReturnLength, IntPtr hwndCallback);
public int Duration()
{
int ReturnSeconds;
sCommand = "status MediaFile length";
private StringBuilder sBuffer = new StringBuilder(128);
mciSendString(sCommand, sBuffer, 128, IntPtr.Zero);
ReturnSeconds = Convert.ToInt32((sBuffer.ToString()));
ReturnSeconds = ReturnSeconds/1000;
return ReturnSeconds;
}
It will return you the duration .....
Enjoy!!!!
<marquee>nishu
|
|
|
|
|
I am write code that print some lines and text.
In dialog box of printing , I am printing to file - "print to file".
how can I print this file now to the printer???
If i drag him to the menneger of printing it did not working
he write to me : "Can No Print this file,try to open with an apliction..."
when I save this file , what kind of extension I need to write ? ? ?
I mast an answer
Galigal156
|
|
|
|
|
I need your help guys. Thanks in advance.
Can you please teach me on how to create a string array property or give a snippet/sample code. I need this property to have a string editor for my custom web control.
|
|
|
|
|
Hello
Mark Anthony Sabado wrote: how to create a string array property
private string[] _myarray;
public string[] MyStringArray
{
get { return _myarray; }
set { _myarray = value; }
}
Was that what you were looking for?
Regards
|
|
|
|
|
|
Hello,
Maybe 'System.Collections.Specialized.StringCollection' can help you somehow, to make your code more dynamic.
private System.Collections.Specialized.StringCollection _mystringcollection = new System.Collections.Specialized.StringCollection;
public System.Collections.Specialized.StringCollection MyStringCollection
{
get
{
return _mystringcollection;
}
set
{
_mystringcollection = value;
}
}
All the best,
Martin
|
|
|
|
|
Well, i can succesfully get to the database, but get the error 'doesn't exist or access denied'
The problem is that the DB requires a username and password.
With ftp that I was checking out earlier this was in credentials, but i don't see that here, i'll keep looking but any help or articles that you can direct me to would be really great.
|
|
|
|
|
Take a look at connectionstrings.com[^], they have lots of examples for various connection strings for almost every database.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks, thats really usefull
|
|
|
|
|
I am trying to install (with MSI) a Document to "My Documents" for the current user. So I need to do something like c:\Documents and Settings\[UserName]\My Documents as the DefaultDirectory. How do I get the User name in an Install?
|
|
|
|
|
I asked this a while ago, its quite simple really
string mydocs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
the key part is obviously the environment.getfolderpath part, theres quite a few 'special folders' that are in there quite usefull
|
|
|
|
|
Sure in code. But I was talking about an install project. There is a property for a folder called DefaultDirectory. I havn't done very many installs and the ones I have done are pretty straight forward so I could be missing something.
|
|
|
|
|
Hello
You can make an exe file that will copy the files you want to "My Documents" using C# code, and excute it during/after your installation as a custom action.
Regards
|
|
|
|
|
Yes, but there must be a way to do it from the installer. That's probably too big of a hammer for this particular nail. MS must have allowed for a way to do this within the Install Project.
|
|
|
|
|
Tad McClellan wrote: MS must have allowed for a way to do this within the Install Project.
Sorry! Looks like you don't know MS that well!! They are not the "Good guys" anymore.. It would be rational to think that "My Documents" folder is private to the user and why would you put anything in it?!! Stupid, I know, but it's the case. The closest you can get is the "Application data" folder which is in the Documents folder. Otherwise there is one silly workaround. Get a special folder's path -eg. User's Start menu-, which is close to "My Documents" folder, then use a relative path from there to "My Documents".
Regards
|
|
|
|
|
|
I have application which need the windows based authentication so I need help to get the username and user password who has logged in the system currently for the authentication.
Please tell me it's urgent.
regards,
Mr. Dhiraj karmalkar
|
|
|
|
|
You probably can get this info our of MSDN but ...
You won't get the users password (You don't really need it if all you are looking for is to identify the current windows user). Other wise use ...
Environment.UserName
Lots of good stuff in the Environment class so you should check it out.
|
|
|
|
|
Damn right there is, its full of so much useful stuff its not even funny. (Oh, the time i could have saved if only i'd known sooner)
|
|
|
|
|
Hi
how can i kil thread gracefully in c#1.1
|
|
|
|
|
The most graceful way is to tell the thread to stop on it's own.
If the thread is running an instance method of a class, you could change a proeprty in the class to flag that it's time to stop.
Otherwise there is a special exception (don't recall what it's called right now) that you can raise in the thead, that you can initiate from outside the thread and catch inside the thread. That gives the thread a chance to clean up whatever it needs before turning in.
-- modified at 9:11 Sunday 8th October, 2006
I was just reading about Monitors, and stumbled upon the Exception that is used to interrupt a thread. The exception is ThreadInterruptedException , and is created with the Interrupt method of the Thread class.
---
b { font-weight: normal; }
|
|
|
|
|
Use something like a volatile bool quit , set it to true and periodically check if it's true in your thread.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
Using VS2005
I have three comboboxes with the purpose of selecting a member from a lookup table and inserting their meberID into another table. Each combobox has the same links ie:
The datasource -> nameLookuptable
The displaymember -> memberName
The valuemember -> memberID
The databindings - selected value will link to another table that is to record the memberID although I have tried leaving this blank to test the workings but this doesn't make any difference to the problem.
The problem I have is that selecting a member from the drop down list in any one of the comboboxs results in all three changing.
I've tried everything to isolate the problem but can't.
On another form in the same project, I have no problems with the configuration of the comboboxes as above.
Any suggestions welcomed.
Glen Harvy
|
|
|
|
|
If three combos have the same data source, they will do this. The solution is to set the data source in code, and to use the Clone method to make copies of the data source, so they point to different objects, but with the same data.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
There will be at least 15 combos required on the page - do I need 15 clones!
I'm confused because the combos works fine on a different tabbed page on the same form !
Glen Harvy
|
|
|
|