bennett1016's Q&A profile
Visual C++ cannot convert parameter 1 from 'char *' to 'System::String ^'
Hello! I'm trying to read a variable from a ini file and put this data into a input box. Here's my code: char * lpstrINIFile = "inca.ini" ; char * lpstrBuffer = new char [255+1]; GetPrivateProfileString( LPCWSTR( "ADR" ), LPCWSTR( "ADRxPos" ), NULL, LPWSTR(lpstrBuffer), 255, LPCWSTR(lpstrINIFile)); ADRxPos->Text = lpstrBuffer; ADRxPos is the name of the input box, but somehow i get this error on compiling: error C2664: 'void System::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'char *' to 'System::String ^' I've been googling for a solution for the last couple of hours, but can't find anything on how to fix this. #edit: Sorry for the doublepost, my browser ...Show All
.NET Development Using regex to right pad / justify numbers
Hi all I have a set of numbers as string input and I want to pad them out with leading zeros. Basically I need them to sort correctly with text sort as well as numerical sort. so I want to convert: 1 10 11 2 to: 01 10 11 02 I am trying to use a regex object to do it but I can't work out how to get the padding. Can anyone help Cheers Jero RegEx is used for searching, you want to use a formatting method. I suggest using String.Format, specifying that integers have 2 significant digits: String s = String.Format("{0:D2}", 1); // "01" String s = String.Format("{0:D2}", 10); // "10" ...Show All
Visual Basic Running .net application as both windows and console mode.
Hi All I am writing a .net windows app that should also run from command line. I am not sure what is the best way to set such a project. I intend to create a windows project and on the Sub Main rotine check if any arguments are passed. If not run a form. Public Shared Sub Main(ByVal Params() As String) If Params.Length = 0 Then 'run windows mode Application.Run(frmMain) else 'run console application some code End If End Sub Would this be the best way or is there any standard way of doing this Many Thanks Mustafa www.hostukdomain.com I cannot get the console screen The project needs to be setup as windows. (cannot setup as console type ) when I write following public static void Main(string[] arg ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Deploying to 360
Hi, In the XNA Faq, when it talks about giving a project to other people to deploy on their 360's, it says you must give them all the assets and source code, so that they can build the program and squirt it onto their 360. My question is: will it work if you give them a project with the C# source files removed ie they have the assets (either as source graphics and sounds, or the built files) and the .obj's, just not the C# source. What happens if the project is dependant on an external DLL Will I need to ship a project that builds this, too Again, can I get away with excluding the C# source Many thanks, Mark "That being said, yes, it will certainly work for assemblies compiled for the Xbox 360." ...Show All
Visual C# Accesing key shortcuts from another program
I'm trying to write a small code library program that I want to hide in the system tray, and pop up whenever some one hits a key shortcut, such as CTRL+F1. I have the program in the tray, but don't know how to check for key presses happening outside of my program. Any help would be greatly appreciated. Thanks a lot for the help. I'll give it a shot, and can hopefully get every thing converted from VB. The only part I'm not sure about is exactly how to convert the dll import: <DllImport("user32", EntryPoint:="RegisterHotKey", _ SetLastError:=True, _ ExactSpelling:=True, _ CallingConvention:=CallingConvention.StdCall)> _ If any one knows what this would look lik ...Show All
.NET Development Simple UTF8 encoding issue
Greetins everyone, I'm having problems with de UTF8 encoding which later is used by some Crypto/WebServices classes i built. The thing is: by executing this code: string s1 = "a"; // which is code 225 in Unicode or á in HTML byte[] ba1; ba1 = Encoding.UTF8.GetBytes(s1); It acctually returns me ba1 = { 195, 161 } when it should actually return ba1 = { 225 }. Which is E0 in HEX and the right value for that char according to the Unicode table. Am I missing something here or am I experiencing a bug Ah, and just a side note: if Enconding.UnicodeEnconding is used, ba1 = { 225, 0 }, which is expected. I thank you all in advance for the help. Hi, It is correct, th ...Show All
SQL Server SQL Recovery Mode
Hi, How to make all MSSQL DBs run in Simple log form by default other than FULL so when we srhink DBs the logs will go bybye. :-) Thanks Database settings come from the model database. If you want simple recovery model for all your databases in the future, set this to the model database. If you already have your databases, you have to convert them to Simple recovery model, each one of them. Let me know if you need a sample script to do this for you. ...Show All
Visual Studio Team System How can I check if a node is an hashtable or Directory
Hi, I have a new problem now. I can get array type by local.Type.NodeType == NodeType.ArrayType and ,how can i get Hashtable /Directory's type then,ArrayList/List thank you! To check for these types (or any type for that matter) you are going to need to check the name of the type. So to check if a type is a Dictionary you would do the following: if (type.GetFullUnmangledNameWithoutTypeParameters().Equals( "System.Collections.Generic.Dictionary" , StringComparison .Ordinal)) { ... } For Hashtable you do the same thing specifying the fully qualified path to the Hashtable type. if (type.GetFullUnmangledNameWithoutTypeParameters().Equals( "System.Collections.Hashtable&q ...Show All
Windows Networking Development How to cancel socket operations
I have an application that acts as an IPC mechanism between two systems running at different sites. There are multiple sockets being used with two threads per socket to handle sending and receiving. When a glitch occurs, the socket in error is closed and a new connection is opened. Now, I have a problem in that the next socket opened may get the same handle as the previous. That creates all sorts of confusion between the old threads, which should be exiting, and the new threads that think they have exclusive use of the socket. To get around this issue, I'm now performing a shutdown on the old socket and placing it on a stack for later clean-up. That ensures that the new socket(s) get unique handles. One issue though, is that the old thr ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Audio content
Hi everybody, Can anyone tell me or suggest where can I get free music, music loops, and sounds for use in games I'm currently writing my own XNA game, but, like a lot of programmers out there, my strength is in coding, I'm no good at producing or creating music or sounds. Any suggestions would be greatly appreciated. If it's an interesting concept I might be interested in contributing some assets for your game, in return for a credit and being able to use it as part of my portfolio. Music and sounds from libraries tend to be generic and hollow, but can be useful in certain situations. ...Show All
SQL Server strange problem while rendering a report
I have 2 reports called fundfacts_Full and FundFacts_half and both of them run using the same stored procedure called rpt_FundFacts. When i run the dataset for both the reports i get 19 records and but when it renders the Fundfact_Full report it shows 18 records. Where as in the fundfact_Half it shows 19 records too. Can some pls tell me whats going on and why its acting strange, i havent encountered these problems at all. regards, Karen hammer, thanks a lot for your answer, I fixed it. the List group was pointing to a different paramater and after changing that it works fine. Regards Karen ...Show All
SQL Server BI Development Studio: Crashes when viewing a Cube in the Browser
Hello, I created an Analysis Services project, defined the views and the cube itself. After I deployed the cube, I wanted to compare the results with the browser. Everytime I try to open the browser, BIDS starts loading, but after a while it crashes. Is this a known error Thanks in advance! I hope by the word "crash" you do not mean that you get a hour glass. 1. Do you run any Firewall I have seen some issues with Integrity where one would not be able to browse the cube. 2. Did you try browsing the cube from any other application instead of VS like Excel 3. Also are you trying to go to the Browse tab after the cube is completely deployed. I have some instances where if you try to shift ...Show All
Game Technologies: DirectX, XNA, XACT, etc. DrawTransform problem - ploted lines to suddenly "jump" to infinity
Hi there, I use Line.DrawTransform to plot some 3D lines. They all plot fine, however when I start moving the camera forward all lines that are in the direction of the camera move "jump" to infinity when I clip the near plane (it is my guess that it is the near plane). Could you please help with some advice. My hunch tells me that it is a rather obvious problem for more advanced game programmers - too spectacular to miss :) There is not much in the code, really 1. I define the lines in a Vector3 [][] v3Lines = new Vector3 [1][]; 2. Draw the lines with float FieldOfView = ( float )( Math .PI / 4); float aspectRatio = this .Width / this .Height; //1.0f; float zNearPlane = 10.0f; //pure guess for this ...Show All
Visual C# How to send an SMS through C#
Hi PPL, Can anybody help me in sending an SMS through ASP.NET. Probably, sample of codes and links are appreciatable. Regards, Vinoraja. Personally, I'd recommend using the Web service from www.SMS-TXT.co.uk at www.sms-txt.co.uk/sendSMS.asmx . It covers most of europe, and australia. However it doesn't work in the U.S. ...Show All
Visual Basic Deployment without .NET
Hi there, I'm new to the forum and new to Visual Basic so please forgive my ignorance! I just downloaded Visual Basic Express for free, and made my hello world program. I burned a CD with the results of the publish command, and installed the program on my other machine. My installation package was less than 1 Megabyte, but it forced me to download .NET 2.0 which took about half an hour to download and install! Now I understand how .NET is great and all that, but I think it will seriously annoy my website users if they download a tiny little program from my website but then find they have to spend 30 minutes updating their system for the honour of messing around with my trivial program! Firefox is a complex browser and that installs in less ...Show All
