tranders's Q&A profile
Visual C++ .NET Applications + Single Instances
Is there a way in C++ to stop multiple instances of a programs from running Can you check somehow to see if an instance is already running and then not start anotherone Thanks, Michael Usually this is done with named mutex: using namespace System; using namespace System::Threading; int main( array <System::String ^> ^args) { bool createdNew; Mutex^ mutex = gcnew Mutex(true, "AMutexNameThatTriesToBeUnique", createdNew); if (!createdNew) { Console::WriteLine(L"I'm already running !"); return 0; } Console::WriteLine(L"Hello World"); Console::ReadLine(); return 0; } ...Show All
.NET Development tool for winapi
Is there any tool that can map the .Net functions with the winapi functions ie when i select the method File.Open(path) to see the api functions that are called. The source code for the base classes (like System.IO.File), the CLR and the compilers is available as a download from MSFT. For extension classes like those in the Windows Forms namespace, you can use the excellent free Reflector disassembler . ...Show All
Visual C++ bug in short if statement with nullptr?
Hello! I found a strange thing using the shortend if statement when using a nullptr: This works: OleDbDataReader ^reader = cmd->ExecuteReader(); if (reader->IsDBNull(1)) pObj->DateProperty = nullptr; else pObj->DateProperty = reader->GetDateTime(1); And (just for testing) this works too: OleDbDataReader ^reader = cmd->ExecuteReader(); pObj->DateProperty = reader->IsDBNull(1) reader->GetDateTime(1) : reader->GetDateTime(1); But this is not: OleDbDataReader ^reader = cmd->ExecuteReader(); pObj->DateProperty = reader->IsDBNull(1) nullptr : reader->GetDateTime(2); The last code gives compiler error C2446: ':': Can't convert 'System::DateTime' to 'nullptr' which doesn't make any sense ...Show All
Visual Basic Unsigned Arithmetic and overflows
I've had this discussion before with unint64s. Setting what would normally be the sign bit causes an overflow. Now I'm seeing this in unint32s. Dim a As UInt32 = System.Drawing.Color.Black.ToArgb will cause and overflow. Dim a as Uint32 = now.ticks and &hFFFFFFFF will cause an overflow depending in the time. This should not be. What it means effectively is the UInt32 is actually UInt31. MOVL does not care about signed/unsigned. Exactly !!!!!!!!!!!!!!!!!!!! but the entire purpose of declaring a Uint32 is to have that exact same behavior. ...Show All
SQL Server cannot connect to redirector
Hi, although I read thru several threads I still did not really find a solution for my problem. I have installed a SQL server 2005. i built a cube in SQL server BI studio but unable to deploy the project. giving a msg Error 1 The project could not be deployed to the 'localhost' server because of the following connectivity problems : A connection cannot be made to redirector. Ensure that 'SQL Browser' service is running. To verify or update the name of the target server, right-click on the project in Solution Explorer, select Project Properties, click on the Deployment tab, and then enter the name of the server. please help me in getting the project deployed. thanx in advance. Thanx ...Show All
Visual C# Read a String and identify number of Different characters ??
I have a String which user enters, I need to determine how many types of different characters are there For Example : If User Enters : Test T or t - 2 E or e - 1 S or s - 1 This string can be really long what is the best way to get this done... using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication6 { class Program { static void Main( string [] args) { Dictionary < char , int > charCount = new D ...Show All
SQL Server How can i change security mode of SQL Server Express 2005
Hello, I have created one application in visual studio 2005 and also created setup project of that application. now i want to install SQL Server Express edition with my application. so i have checked SQL Server Express 2005 in Setup Project Properities(Prerequisites...). now i want to change SQL Secirty Mode during setup. and i don't know how can we do this Any idia hi, SQLExpress setup boostrapper accept "parameters" to define the "final" settings of the installed instance at install time.. the parameter you are looking for is SECURITYMODE=SQL to enable standard SQL Server authenticated connections.. please have a look at http://msdn2.microsoft.com/en-us/library/ms144259.aspx for all supported ...Show All
.NET Development XmlDocument.Save() - Automatic indenting?
Hi I've added a new Xml-node to my XmlDocument: XmlDocument xml = new XmlDocument (); xml.Load( "books.xml" ); XmlNode fragment = xml.CreateDocumentFragment(); fragment.InnerXml = "<Book><Title>MyBook</Title></Book>"; xml.DocumentElement.AppendChild(fragment); xml.Save( "books.xml" ); The problem is that the added node is not correctly indented. I want the output to be: <Book> <Title> MyBook </Title> </Book> How do I do this Kind Regards Hi, try it with the XmlWriterSetting class: XmlDocument xml = new XmlDocument (); xml.Load( "books.xml" ); XmlNode fragment = xml.CreateDocumentFr ...Show All
Visual C++ error C2039: 'messageMap' : is not a member of 'TCreate<CBaseClass>'
Hi All, I inherit an existing project that contains old MFC/ATL C++ code. when I compile the code with VS2003, it compile fine. With VS2005, I got 409 errors. I try to concentrate on the C2039 error above. Do you know why I got the error above What are the differences between VS2005 and VS2003 what makes they are so incompatible Thanks. I wouldn't think that Microsoft changes the message mapping implementation without letting its developer community know about it. The MFC code of VS-2005 should be backward compatible with the VS-2003 MFC code. Man... I wish I can re-write this whole darn thing using C# and .NET framework... ...Show All
Software Development for Windows Vista ic:TimeExpires -- what's it for?
An InfoCard contains an ic:TimeExpires element, which the documentation says is the expiry date of the card. But CardSpace seems to ignore this element -- for example, even if I set it to Jan 1 1999, CardSpace lets me use the card, with no errors and no warnings. The element is never sent to the Relying Party or the Identity provider. So, what's it for ic:TimeExpires is really just a hint to the user about the expiration date, and is displayed on the card details page. Enforcement of an expired card is really up to the STS which knows the current state of the associated account. If the expiration time was enforced on the client, it could be circumvented by malicious code. ...Show All
SQL Server Cannot login using Integrated Authentication
I can't seem to login using Integrated Authentication. I enter the user name / password and receive "You are not authorized". I messed with everything I can find and no solution. * I can browse a simple web page. * I cannot browse LocalStart.asp (get asked for User/Password) * I can set security on the reports folder to Anon and browse to Home.aspx * I have disabled the loopbackcheck. This is my dev box running Media Center 2005 w/SP2, IIS 5.1, SQL Server 2005 Any help would be appreciated. try going into internet explorer, go to tools / options thne security tab then custom level, right at the bottom of the list check the radio button for login automatically using current ...Show All
Visual Studio Team System Creating a Project
Just starting with TS ...created a Project ...added a scenario and even managed to add some work items directly from MS Project, after much editing. At each stage of adding things I looked on the Project Portal - but this didn't seem to refresh in line with new things added. I've now got 98 Work Items in the project - and even after save & exit of Team Explorer - and refresh / reload of the portal - they aren't appearing. Is there an option in Studio / Team Explorer somewhere to 'publish' or send these to the portal Also - is there a SAVE that needs doing after each ADD of Work Item or Task - I am just exiting then selecting Yes to Save. Sorry for the basic Qs..but I'm following the book 'Studio 2005 Team System' which ...Show All
SQL Server How can I use the Variables in SQL Execute SQL task?
I define a package variables "varOutTable" and "varFromTable". and I insert a SQL Execute SQL Task into Control Flow my sql command is "Select * into @[User::varOutTable] from @[User::varFromTable]" but the task failed, it seems that sql task can't get the varOutTable and varFromTable How can I use the Variables in SQL Execute SQL task thanks!! When changed to int32 I get the following error message. Error: 0xC001F009 at D3OLNAC3: The type of the value being assigned to variable "User::spmessage" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type ...Show All
Visual Studio Retrieving embedded elements
Hi All! I've run into some trouble when trying to present data from an embedded element in a datagridview. The code that should do the work looks something like this. public partial class CompartmentHostShape { public override void OnDoubleClick(Microsoft.VisualStudio.Modeling.Diagrams.DiagramPointEventArgs e) { Form f = new System.Windows.Forms.Form(); DataGridView dgv = new DataGridView(); CompartmentHost ch = this.ModelElement as CompartmentHost; foreach (CompartmentItem cit in ch.TestRole) { //This actually prints out the expected values Debug.WriteLine("ComItemName for cl is: " + cit.ComItemName); Debug.WriteLine("CompartmentHost for cl is: &quo ...Show All
Visual Studio Team System Error when I upload my Porcess Template
I got this error when I tried to upload my new Process Template, any idea ---begin Exception entry--- Time: 2007-02-07 12:28:42Z Module: Engine Event Description: TF30162: Task "SharePointPortal" from Group "Portal" failed Exception Type: Microsoft.TeamFoundation.Client.PcwException Exception Message: The Project Creation Wizard encountered an error while uploading documents to the Windows SharePoint Services server on "ServerName". Exception Details: The Project Creation Wizard encountered a problem while uploading documents to the Windows SharePoint Services server on "ServerName". The reason for the failure cannot be determined at this time. Because the operation failed, the wizard was not able ...Show All
