Adam Machanic's Q&A profile
Visual C# Problem while accessing directory.
I am trying to create a treeView of all directorys,subdirs and files, like an file explorer.(is there allready made ones ) I getting error: "Acces denied" while listing directory of C:\System Volume Information\ (edit:) How i can make this one work so it skips the unreadable directoryes/files Here is the code: private void Form1_Load(object sender, EventArgs e) { foreach (string dirs in Directory.GetDirectories(@"C:\")) { TreeNode node = new TreeNode(); & ...Show All
Software Development for Windows Vista Entry point not defined
Hi people. Im using source code from a microsoft self paced book(70320) to create and consume a component (com+) when I try to build the project I get the following message: Program 'C:\EC70320\BankAccounts\obj\Debug\BankAccounts.exe' does not have an entry point defined I've created the snk file using the Sn.exe tool and here is the source code, im not sure where im going wrong using System; using System.Reflection; using System.Data; using System.Data.SqlClient; using System.EnterpriseServices; using System.Collections; using System.Windows.Forms; [assembly: AssemblyKeyFile("..\\..\\MyKey.snk")] // Delete the AssemblyKeyFile from the AssembleInfo.cs file // which VS cre ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Initialize(), LoadAllGraphicsContent(), Unload()???
Hi Guys, Just wondering if anyone could explain to me what is meant to happen in the Initialize and LoadAllGraphicsContent() methods in the skeleton source code. In particular I am unsure about what goes into the normal constructor and what goes into these two methods and what is the difference between each of those methods. Are these methods called only once at the start of the program or are there many calls to these methods Thanks for any help offered ProfEclipse wrote: When the device is created/recreated, LoadAllGraphicsContent is called with an argument of true. When the device is reset, LoadAllGraphicsContent is called with an argument of false. Alt-tab typically only causes a reset if ...Show All
Visual Studio 2008 (Pre-release) floating window
How can I create a floating window (or some control), that will be placed always at top right corner of the window (for example), will be independent of scroll movement and will be over all controls on the page The problem with popup is when a size of window is decreased, the popup stays the same place it was at screen, but I need it hidden if the window is too small. Is there another alternative except for popup ...Show All
Windows Forms Where are DialogKeys processed in Designer?
I want to be able to move the controls around in the desgner by pressing the arrow keys but I can't find where the ProcessDialogKey is being fired. Is it in a service somewhere I don't know about Ken I thought about this some and I think that I might not have had enought information in my original post and got you off track, or you are still thinking about that vacation. You said that "someone has to fire the event" and in your original post that "VS" routes the command to the window. I'm assuming here that VS is Visual Studio I'm not using visual studio, I'm using my own custom designer. Considering the comment about the event, who actually does fire it I'm thinking ...Show All
Visual Studio 2008 (Pre-release) Async CallBackContract
Is it possible to use the async pattern with callback contracts IContractCallback void CallbackOperation(); to IAsyncContractCallback void BeginCallbackOperation .... void EndCallbackOperation when you grab the contract from the operation context it is IContractCallback. How do i turn it into the IAsync version while preserving the back channel You need to ensure that the contract interface type used on the server side is one that has async methods in its CallbackContract interface. Then this will be the right type that OperationContext gives back. Below is a short sample (reading the code for the contracts is informative). (sorry about the formatting; lost the indents) ...Show All
Internet Explorer Development How to get image or picture data?
I wanted to know if there's any way to retrieve the actual "image" as such in a BHO. I want to add functionality such as "Save to folder" or "send by email" for images through my BHO. However, after quite a bit of searching, I don't seem to get the actual image "data" as such. I either need the image's file saved in IE's cache or some sort of binary blob which I should be able to save. I tried the RetrieveUrlCacheEntryFile from wininet.dll but either I'm not getting it right in managed code through the pinvoke thingy, or I'm using it wrong, but it's returning the file-not-found error code for each call. Any suggesstions Thanks a lot. Sometimes, it ...Show All
Windows Forms Can't disable a button
I am programming in c#. I have a button on my form that when clicked, it plays a wav file using the PlaySound method from winmm.dll. The wav is about 3 seconds long. The problem is that if I keep clicking the button during the 3 seconds the sound is playing, it queues all of the clicks, and plays the wav over and over. My Button is named btn. So I tried: this.btn.Enabled = false; PlaySound(...); this.btn.Enabled = true; Doing this successfully greyed out the button while the sound is playing, but it still accepts clicks, so it didn't fix my original problem. Is there some way to clear the event queue Or is there something else I'm doing wrong. I just want the button to not work while the sound is playing. I have also tried ...Show All
.NET Development c# performance
I am working on performance tuning for an app. The old code is the following: for(int i=0; i<10000; i++) { MyClass a = MyClassCollection[ i ]; } If I declare the reference type a outside of the loop like the following, will I get better performance MyClass a=null; for(int i=0; i<1000; i++) { a = MyClassCollection[ i ]; } It seems to me that there is a performance gain since I am not allocating new memory for reference type a during each loop iteration, but I want to confirm this. Um, actually the generated IL will be semantically identical. All locals are declared in the method header irrespective of where you declare them in the method body. So ther ...Show All
.NET Development Problem with C#/OleDb : FileNotFoundException
Hi! I'm using visual C# 2005 express, and I just added a new data connection through the "DataBase Explorer" and I can see the tables there, in DB explorer. But I tried to use the component "DataGridView". I configured it and I could see the table Categories from Nortwind there, but when I execute the application, there's an error: private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'nwindDataSet.Categories' table. You can move, //or remove it, as needed. this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); //this line } The message: Could not load file or assembly 'System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f ...Show All
Visual Studio Team System MSF Template - Risk WIT has a validation error
Hi, I am getting an error when trying to save a Risk WIT in a MSF CMMI and AGILE team project. There is no other information I have about this error other than what is recorded in the trace log: [WI] [Error, 3328, 1, 13:19:31.622] SvrEx: Microsoft.TeamFoundation.WorkItemTracking.Server.ValidationException: Forcing rollback ---> System.Data.SqlClient.SqlException: Forcing rollback at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior ...Show All
Visual Studio Express Editions Another Question
Currently I'm making a media player which is using Windows Media player DLL. And I would like to get the length of the sound which is currently playing in Progress bar, How would I do that Please Help . One way to do this is to use a timer control to sample the Ctlcontrols.currentPosition property of the player. Send this to the Value property of the progressbar. Here is an example: namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click( object sender, EventArgs e) { if (openFileDialog1.ShowDialog()== DialogResult .OK) { ...Show All
Software Development for Windows Vista Higgins
Hi, What is the relationship between CardSpace and Higgins If they are not compeateing with one another, then why the two systems Is CardSpace a purely Windows thing and Higgins a misc system If I make a site geared up for CardSpace, will I excluded all of my Higgins customers Luke <reposting on the duplicate thread as well, just in case a search lands on this one> Hello Luke, Kim give an excellent explanation in the following blog post: http://www.identityblog.com/ p=386 HTH, Vittorio ...Show All
Visual Studio Express Editions AppActivate Function
My code activates a Windows application using the AppActivate function. The code then goes on to send keystrokes via the SendKeys function. I am using "SendKeys.SendWait". The problem is that sometimes my Windows application is slow to show and my SendKeys code does not work. On other occassions the window pops up quickly and the SendKeys commands execute. Can someone tell me exactly what is going on Should I have some sort of "Wait" command associated with the AppActivate function Before I spend time exploring another avenue I would like to understand what is happening with my current code. I've since discovered that the speed with which the application window appears does not seem to ...Show All
.NET Development Trouble Iterating through htmldocument links in VB 2005.
I'm learning Visual Basic 2005 and have come to a problem I'm not sure how to solve. I have a web browser that pulls up a web site and I'm trying to iterate through the htmldocument.links collection. Here is a little bit of code to show how I was trying to do this. Public Class Form1 Public IE7 As New Person Private Sub Form1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase .Load Me .IE7.CollectWebPage( "http://en.wiktionary.org/wiki/Special:Allpages" ) End Sub End Class Public Class Person Public Function CollectWebPage( ByVal Address As String ) Form1.WB.Navigate(Address) While Form1.WB.IsBusy End While ...Show All
