Yeshia's Q&A profile
Game Technologies: DirectX, XNA, XACT, etc. Cannot delegate to VertexBuffer.SetData<T>
I wanted to write a method that basically delegates a call to VertexBuffer.SetData. What I do is simply this: class MyDelegate { private VertexBuffer vertexBuffer; // Some init code public void MySetData<T>( T[] data ) { vertexBuffer.SetData<T>( data ); } } This does not compile and tells me: error CS0309: The type 'T' must be convertible to 'System.ValueType' in order to use it as parameter 'T' in the generic type or method 'Microsoft.Xna.Framework.Graphics.VertexBuffer.SetData<T>(T[])' This is fine I thought and added a where constraint to MySetData: public void MySetData<T>( T[] data ) where T : System.ValueType { However, this ends up with another error: error CS0702: Constraint cannot b ...Show All
Visual C++ How to capture a termination signal?
I apologize if this is not the right forum. It seems the most appropriate. I have a win32 app that runs in the background. I want to detect when it is requested to close. On *nix platforms I can do this by capturing the termination signal. But I have noticed in the documentation that windows only supports a few signals and termination is not one of them. So how do I detect if the program is closing because the user has logged out of the session Thanks Brian After rereading your question I realized that you probably already know about console signals so perhaps you just need to try some or all of the following: CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT and CTRL_SHUTDOWN_EVENT. If that is all you needed then I w ...Show All
Software Development for Windows Vista Text Wrapping in Custom Activity
I've built a custom activity but the Name value won't wrap like the default activities do. Here's my code: private Rectangle CalcImageRectangle() { Rectangle bounds = Bounds; Size sz = new Size(32, 32); Rectangle rcImg = new Rectangle(); rcImg.X = bounds.Left + 4; // ((bounds.Width - sz.Width) / 2); rcImg.Y = bounds.Top + ((bounds.Height - sz.Height) / 2); rcImg.Size = sz; return rcImg; } private Rectangle CalcTextRectangle() { Rectangle bounds = Bounds; Rectangle imgRect = ImageRectangle; Size sz = Image.Size; int room4Image = bounds.Left + 20 + sz.Width; return new Rectangle(room4Image, bounds.Top, bounds.Width - 4 - room4Image, bounds.Height); } My base size is 175 x 60, so the height is ...Show All
Windows Forms TreeView question
Whenever i select a node .. then a select another control (lost focus) for example a button ... the selected node is not highlighted anymore. How can i force the selected node to always be highlighted ... ...Show All
Visual Studio ReportViewer
I am having problem with setting the parameters of the report viewer. I do not know how to create an array of ReportParameter to send to the method reportViewer->LocalReport->SetParameters. can anyone help me with this. I have seen examples for VB and C# but none for C++. Thank you very much, the problem was that I was using cli::array instead of List. Thanx again, you saved my day. ...Show All
.NET Development Exporting to excell and access
Hi, I would like to export some information I am storing in some lists to an excell and access database. I have included Microsoft.Oddice.Interop.Excell and .Access in my references and put the proper using statements, but to tell you the truth I have no idea how to use them. Can anyone point me to where there is documentation on how to do this and an example would be very very helpful for me to learn a lot faster. Also is it necessary to do this in COM I was hoping not but if so then is there a place I could go to learn more about COM in c# Any help here would be great thanks. Matt Thank you for your help so far, but I have run into another wall so to speak. I have a csv file t ...Show All
Windows Forms Setting Focus on row/column
First of all, I am using VS 2003. I am validating column values in a datagrid in the following fashion. If I find an error, I want to set the focus on the row/column of that value. I am having trouble with this. Any suggestions foreach (DataRow currentRow in insertedTable.Rows) { foreach (DataColumn currentColumns in insertedTable.Columns) { string columnName = currentColumns.ColumnName; object columnValue = currentRow[currentColumns]; switch (columnName) { case "CLIENT_CD": if (currentRow[currentColumns] == DBNull.Value)   ...Show All
Visual Basic DeviceIOControl Does Not Work on Windows 98
i wrote a program that get hard disk's firmware serial and it works fine in winXP/Win2000 but when i run it in win98 it doesn't give me the serial number i used Smartvsd.vxd and vWin32.vxd to Solve this problem but it doesn't work yet. any idea plz forgive me for my bad english . smartvsd may not be installed in all versions of Windows. http://vbnet.mvps.org/index.html code/disk/smartide.htm seems to outline a workaround for these circumstances. ...Show All
Visual Studio sending variables over a network
Hi All! I mostly develop real-time dsp software with platform-specific IDE's, but most coding, offline debugging and simulations are done in VisualStudio because I'm so used to it. There's one major drawback atm though: I can't do anything without having a visual representation of audio/video data, it's impossible to see what's going on by staring at an array of samples. Right now I send everything to a Labview program (over a tcp connection) by inserting lines of code whenever I have to watch something. This is getting unmanagable though as I have to recompile the program anytime I add a new watch. So I'd like to get rid of the code for sending the data, and plug it into a plugin that does the same. Just like you would right-click a varia ...Show All
Internet Explorer Development IE7 protected mode hWnd problem
hello, i'm trying to get the hWnd of a IWebBrowser2 control. if i'm working on xp, everything is ok. but with Vista - things different. hWnd returned is not valid. (IsWindow - fails) any ideas why It seems to me that because if you run iexplorer.exe in Protected mode, it runs ieuser.exe and it runs in its turn iexplorer.exe (with another Process ID). It seems that the hWnd is not of the second process... How can i solve this Todd, Lances code does seem to work. That is, using it launches a single instance if IE and gives back a valid IWebBrowser pointer that can be used to sync events. The important nugget of information found in the comments of Lance's code that MeniB left out is specifying CLSC ...Show All
.NET Development Problem in Generics with Reflection
Hi All, I'm creating an instance of a GenericType dynamically using Reflection. like, public class A<T> { private T typeval; public T TypeVal { get { return typeval; } set { typeval = value;} } } I'm creating an instance of A using the following code, Type t = Type.GetType("System.Int32"); Type genericType = typeof(A<>); Type[] typeArgs = {t}; Type constructed = genericType.MakeGenericType(typeArgs); object obja = Activator.CreateInstance(constructed); When i try to set the value of typeval for obja using the following code, PropertyInfo finfo = genericType.GetProperty("TypeVal"); finfo.SetValue(obja, 1,null); It gives me the followi ...Show All
Visual C++ What is Visual C++ equivalence to C#'s "is" operator?
I'm trying to convert some C# code over to C++ but cannot figure out what's the C++ "is" operator. C# code: Control m_control; if (m_control is Control) { ... } I've searched and found this article but it's outdated and does not work with Visual C++ 2005: http://msdn.microsoft.com/msdnmag/issues/02/02/managedc/ In which the author defines the following template: template <typename T1, typename T2> inline bool istypeof ( T2* t ) { return (dynamic_cast<T1*>(t) != 0); } bool isanInt = istypeof<int __box>(someBoxedInt); I've tried all following with no luck: if ((Ojbect^)m_control == (Object^)Control) if(m_control.Equals(Control)) Any help would be appreciated. Thanks ...Show All
Visual C# Whats the equivalent of __LINE__ and __FILE__ in C#
Whats the equivalent of __LINE__ and __FILE__ in C# I thought this hot-button issue would have been answered by now. But no one seems to have a good answer for this. I would love to see a solution which presents no runtime overhead. What about C# 3.0 does it address this issue Thanks for your response. When you say they are useful for debugging but don't have much use in C# do you mean ... 1) C# doesn't need (much) debugging OR 2) There are alternatives to using __LINE__ and __FILE__. If yes then how do I generate logs from my C# code which provide source line no and source file information PS: My initial conditions still stand - no runtime overhead please. For example please don't suggest stack walking (in any case the required in ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Unable to share a windows game - Followed the instructions on the manual
Okay, so I finished my first game using XNA Game Studio Express, it has been only a few days since I installed it, and it has been quite easy, having experience at making games. Now, I want to show this game to my friends, so I send it to a couple of them (both of them have XNA Game Studio Express installed), and it works great. Now I want to show it to some other friends, these who do not know what making games is about, these who do not have XNA Game Studio Express. I ensure they follow these instructions, from the manual: Sharing a Windows game On Windows you need to distribute your game executable and any content required by your game. In addition you need to ensure that the user has the following redistributables installed ...Show All
Visual Studio 2008 (Pre-release) Creating ADO.NET DataSet definition files, C#
Hello, I do reporting solutions, VS2005,C#, SQL Server 2005. I am looking for a way to set up a typed ADO.NET DataSet definition reference before actually generating a DataSet. I heard it can be done thru a C# Class, XML Schema .xsd file, etc. What options do I have Thanks, Serge Serge, You can create the Typed DataSet class using either the visual designer in Visual Studio, or using the xsd.exe tool from the command line. Both of these options use an XSD schema file to define the structure of the DataSet. Erick ...Show All
