Thomas Schrantz's Q&A profile
Smart Device Development Buggy API of WindowsMediaPlayer in duration property
if you use WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer(); player.URL ="song.mp3"; // a song filename player.settings.volume = 100; // player.currentMedia.duration player.controls.play(); and then request player.currentMedia.duration; the duration always return the length of the song not the current elapsed time of the song Why is this so The PC version of the player work correctly showing elapsed time, but the PPC version of the player show only the length of the whole song. Can someone tell me how to I get the elapsed time of the playing audio Thank ... I think you want the "CurrentPosition" property. http://msdn2.microsoft.com/en-us/library/ms932741.aspx ...Show All
Visual Studio Express Editions Alternately Change Colours
How can I make control colours change alternately I’ve used the property window to set the colour for a button, but then thought it would be fun to have the colour keep changing every second (or whatever time period I choose), but I can’t figure it out. How can I do this Thanks for your advice. Regards, Steve Very nice, Tall Dude. I tweaked your code, added an on-off switch, and displayed the color name and number on the button. (Make the button a little larger.) Public Class Form1 Dim kc() As KnownColor = GetNonSysColors() Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Static onoff As Boolean onoff = Not onoff ...Show All
Visual Basic Bizzare problem! IDE won't accept any changes.
Something very bizzare is happening and I have no clue as to why. Whatever changes I make to a form in the IDE whether it be adding a button, removing a button, or changing the text (title of the form), it will show in the IDE designer. But when I run it, it's as if none of the changes were made. A button I removed is still there and the code behind it still executes although I commented that code out. Saving the files doesn't fix it. Closing the solution and reopening it doesn't fix it. Exiting Visual Studio altogether and restarting it doesn't fix it. And restarting Windows XP doesn't either. It's as if my application is stuck where I left it last night. When I reboot everything, launch Visual Studio, and open the sol ...Show All
Windows Forms Detecting word wrapping in a rich text box?
Is there a programmatic way to detect where a RichTextBox control is wrapping the text contained within it I'm currently attempting to use TextRendered to measure the text and then determine that wraps occur the accummulated length would be at the box's width. This works for 98% of the words, but occassionally, my rpedicted model will wrap a word or two early. A fudge factor on the width seems to fix it, but for the final release, I would like the list of wrap points to be perfect. katesune You can use the .NET 2.0 GetFirstCharIndexFromLine() method to find out where each line starts. Which will tell you too where the text got wrapped. ...Show All
Visual Studio Submenu in context menu
Hi everybody For my DSL project, I want to create a custom submenu in the standard context menu, where I put my commands. How do I achieve this Thanks in advance for your suggestions Best regards Christian Hi Christian, We don’t generate any custom code for cascade menu items for the target designer. Hence, you will have to create your command handler (derived from OleMenuCommand), and add the command object into the collection. In the gen'ed commandset.cs, we created doubled derived LanguageCommandSetBase and LanguageCommandSet. You can create a partial class LanguageCommandSet, override GetMenuCommands and supply your command handler. To implement the cascade menu, you can search the net. The following would be a good sta ...Show All
Windows Forms Detect if IE is running
How do I detect if IE (or any program) is running on the target machine from a Visual Studio Setup Project I want to check this as a launch condition prior to starting the setup. Thanks. well you would have to create a custom action, something like beforeInstall then check the processes running using the System.Diagnostics.Process class, getting the list of processes which are internet explorer (iexplore), then keep prompting to close it if it is open, then continue on with the installation ...Show All
Windows Forms scrolling big image - poor performance
hello, I'm writing small graphics tool in which I need to scroll big image (approx. 5MB JPEG). I wrote control that derives from UserControl, gave it AutoScroll property and this is the point I'm stuck. after performing a scroll I must wait half a second for the control to refresh totally - what causes so bad performance image size is about 5000x5000 pixels. when I scroll the same image in Photoshop or Microsoft Paint, this problem doesn't occur. how to solve this problem no, I haven;t tried this. it's sure that memory usage is key issue here, but - as I mentioned - there are many apps that don't show this leak of performance. I have written a small app in Flash and it scrol ...Show All
Windows Forms VB2005 Table Compute error
Hello, I have a form that is a master detail form. I have a table compute in the form load event. The first time I open the form everything is ok. Then I close the form and reopen it and then I get an error message on the following line of code: visual basic code: The value SHOULD be an integer that functions as the ID. The first time I open the form everything works perfectly. But when I close the form and reopen it I get the error. ...Show All
.NET Development Lightweight Activation method like Windows XP
Windows XP activation checks following things in computer and is activated The following 10 hardware characteristics are used to determine the hardware hash: Display adapter SCSI adapter IDE adapter Network adapter media access control address RAM amount range (for example, 0-64MB or 64-128MB) Processor type Processor serial number Hard disk device Hard disk volume serial number CD-ROM/CD-RW/DVD-ROM drive i want to use similar technique like this but a lightweight version. Idea is that once a user logs in my program(custom authentication), it will detect all or some of these and associate login with that computer. That way, that user will only be allowed to login from t ...Show All
Visual Studio How to pass arguments to Action programatically?
Hi, I have a problem how to pass arguments by executing action from another action programatically. Values passed by Execute() method of IActionExecutionService are ignored, I can't override argument from XML file and pass it to action Inputs. What I'm doing wrong I set name and type of item in dictionary correctly: public override void Execute() { Dictionary < string , object > arguments = new Dictionary < string , object >(); arguments.Add( "HelloMessage" , ( object ) "someobject" ); IActionExecutionService executor = GetService< IActionExecutionService >( true ); executor.Execute( "HelloWorldAction" , arguments); &nbs ...Show All
Game Technologies: DirectX, XNA, XACT, etc. d3dx10d.dll
I was using the Direct3d9 samples from DirectX and while running i hadn't got any problems, but when i was copying the code from the sample into my own empty project a message occured that i haven't got the d3dx10d.dll. If your code linked with the DX10 libs, you might be required to run with DX10 dlls. They are in the redistribute package. You can extract them from cab files manaully by using WinRar or similar tools. May this helps. ...Show All
SQL Server SQL2005 SP2 Dec CTP Sharepoint AddIn install problem
Hi, I've installed the Dec CTP of SP2 on a Windows Server 2003 SP1 virtual machine. Sharepoint and SQL2005 are running on the same machine. It currently has 1GbRAM allocated. I configured the Report Server to use a Sharepoint integrated report server database. (Missed this first time round). Then I installed the SharepointRS.msi. I see no sign of the Reporting Services section in Central Administration, Application Management, and in Central Administration>Site Settings>SiteFeatures, I see no sign of Reporting Services either. Below is the log file from SharepointRS.msi /l* Any help much appreciated. Thanks Martin === Logging started: 22/01/2007 14:54:20 === Action 14:54:20: INSTALL. Action start 14:54: ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Blue Screen of Death or System Restart
I have XNA installed on my home computer, and on my laptop, and it happens rather often (a few times a day) that when I try run the project, or click the Save All button, I get a system reboot or a BSOD. It happened once too when I tried to move a file to another folder, in the Solution Explorer. Since it happens on two different computers, I was wondering if someone else has had the same problem. Any known bug/solution Thank you! Maybe it's not the BSOD but the XNA default Cornflower blue (I think David Weller calls this the "Blue Screen of Happiness") running at full screen ;) Yeah, this does seem a bit odd that he's getting the same behavior on both the laptop a ...Show All
Visual Studio 2008 (Pre-release) XPS document sequence and Application.GetContent/Resource/RemoteStream
How to load XPS document sequence from application resources I use this: Stream stream = ApplicationStreamHelper .GetStream(source); if (stream != null ) { Package package = Package .Open(stream); XpsDocument xps = new XpsDocument (package ); document = xps.GetFixedDocumentSequence(); } public static class ApplicationStreamHelper { public static Stream GetStream( Uri uri) { if (uri == null ) throw new ArgumentNullException ( "uri" ); StreamResourceInfo streamInfo = null ; if (uri.Authority.StartsWith( "siteoforigin:" )) { streamInfo = Application .GetRemoteStream(uri); } else { streamInfo = Application .GetCont ...Show All
Visual Studio Express Editions cannot get specific line into textbox from TXT
is there any way to search a TXT file for a specific string or take a specific line from it I have had my application generate a file based on what the user entered in all the text fields. now i want it to load the information back in for editing. Example: i've got a file called server.cfg (cfg is same as TXT); the following is the first few lines from the file. //============================================== //This file was generated by S.O.B's Server Tool //============================================== deathmatch 1 set hostname S.O.B's House of Frags rcon_password doodle11 fraglimit 30 timelimit 30 ----end of snippet----- i need it to take the line "set hostname S.O.B's House of Frags", and chop off every ...Show All
