Heng-yi Liu's Q&A profile
Visual C++ Converting System::String to LPCWSTR
I've been looking for a long time as to how to solve this, and eventually just thought I'd ask. I've been told of A2W, which apparently cannot convert from System::String (so says the compiler error), I've tried converting to a wchar_t first, but the method won't accept it, and I'm running out of luck. Here's what my code looks like now. pin_ptr<const wchar_t> wch = PtrToStringChars(fileName); IAVIFile *aviMedia = NULL; IAVIStream *aviStream = NULL; AVISTREAMINFO *aviSInfo = NULL; AVIFILEINFO aviFInfo; LONG bufferSize = NULL; DWORD length = NULL; wchar_t wcFileLoc; Single vidLength; AVIFileInit(); wcFi ...Show All
SQL Server SSIS not detecting Oracle Stored Procedure failure
Hi, I figured out a way to execute an Oracle Stored Procedure from an Execute SQL Task by using Declare Begin SomeStoredProc( , , ); End; with an OLE DB connection using the Oracle Provider for OLE DB. The parameters are getting passed in and the procedure executes but if for some reason it fails SSIS is painting the task green and keeps processing. I'm guessing that's because the outer Declare/End statement completed sucessfully. I couldn't get it to work as a function with a return value. :( Is there another way to execute an Oracle stored procedure that I missed Can you call an Oracle stored procedure from a Script Task and then fail it on parameter value Thanks John Colaizzi ...Show All
Visual C# Static fields, inheritance, and Reflection...
I'm trying to force a class that inherits from a base class that contains a static field to assign a value to this field. I'm not having any luck. For example, say I have a base class "Shape": public class Shape { public static string Description = "A shape"; } and I want to create a class that inherits from shape, but I want the new class to be forced to assign a value to 'Description'. Is this possible I know I can't use abstract or virtual along with static.. The reason for this is that I want to be able, when using reflection, to use the FieldInfo class to return the 'Description' of the inheriting class. I know I can assign a value to 'Description' in the constructor of the inheriting class, but the Typ ...Show All
Visual Studio Team System Unit Tests and Integration Tests - Different Projects?
I'm wondering if there are any general preferences towards seperate projects for unit tests and integration tests. Right now they are mixed in the same project but there is no easy distinction between a unit test and a integration test. One suggestion I have for the future is a ctro overload for TestClass() attribute that allows you to type the test type, which you can then filter/sort on in the Test View window. Currently, both integration tests and unit tests appears as unit tests, and I can't find a easy way to filter/group the different types. Why am I asking this question Unit tests should be run all the time during development and should be lightning quick, integration tests should be run once in a while and before check ...Show All
Visual Studio 2008 (Pre-release) How to save canvas to image(this canvas have not parent control) ?
I can get image if i add this canvas to windows , I cann't save canvas to image when this canvas have not parent control. How to save canvas to image (this canvas have not parent control) In XAML I have... <Window x:Class="RenderTest.Window1" xmlns=" http://schemas.microsoft.com/winfx/2006/xaml/presentation " xmlns:x=" http://schemas.microsoft.com/winfx/2006/xaml " Title="RenderTest" Height="600" Width="600" > <Grid x:Name="gridtest"> <Button Width="74" Height="22" x:Name="button1" Content="Material" Click="MaterialCl ...Show All
Visual Studio Tools for Office Selecting rows from an Excel Sheet throws DISP_E_TYPEMISMATCH Exception
Hello all, I am using the following code to get a range of rows from an Excel Sheet object: Excel. Range range = (Excel. Range )workSheet.Rows.get_Item("16:33", Type .Missing); 'workSheet' is Excel. Worksheet object. But this code throws the following exception: "Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))" Do you know why this is hapenning And also is there any other way to retrieve the rows from a Sheet Thanks. Thanks it seems to work fine, the funny thing is the Rows["13:18"] is working fine for some of the sheets but for one specific sheet is not working. Anyway, get_Range seems to work fine. ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Microsoft's future policy for redistributing Xbox 360 games?
Before I commit serious time and effort to the XNA framework, I'm wondering if anyone knows Microsoft plans for allowing us to redistribute our games for Xbox360. I'm an academic. Let's say I want to make some educational/simulation games that my students can use on the Xbox 360. Will I be able to provide them with a CD or download link in XBox live As far as I can tell so far, the only games I can write are for myself. Yeah, alot of us do this because we love games dev and we are masochists. But you have to admit that showing off and watching your friends enjoying your creation is a huge motivation. I think right now alot of people are relying on MS's promises that they will "do the right thing& ...Show All
Visual C++ COM PORTS
How do I get avaliable Com ports in my computer for example com1 com2 com3 or /dev/ttyS0,/dev/ttyS1 ..... (linux/windows version) Thank you for helping Hello Re: COM PORTS Such questions are outside the scope of this forum - for the scope of the VC Language forum please look at: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=789657&SiteID=1 For such issues please use the newsgroups at http://msdn.microsoft.com/newsgroups . OTP Thanks Damien ...Show All
Community Chat ANN: Schifra C++ Reed-Solomon Error Correcting Code Library
Hi all, I'd like to announce that the open source Schifra C++ Reed-Solomon error correcting code library is now available and awaiting your download. What is it Schifra is a very robust, highly optimized and extremely configurable Reed-Solomon error correcting code library implemented in C++. Schifra supports standard, shortened and punctured Reed-Solomon codes. It also has support for stacked product codes and interleaving. url: http://www.schifra.com Arash Partow ________________________________________________________ Be one who knows what they don't know, Instead of being one who knows not what they don't know, Thinking they know everything about all things. ...Show All
Visual Studio Express Editions Problem in using Listview
I have created a program to detect USB devices and list the name of USB device in a list view, it was working fine in VB.NET 2003 but while running the same code in VB.NET 2005, it is giving exception. I am adding an item name in listview in a Sub-Sub routine on instanceoperation event in VB.NET 2003 but not working in VB.NET 2005. Please give me the solution for th code given below Public Class Form1 Private WithEvents m_MediaConnectWatcher As ManagementEventWatcher Public USBDriveName As String Public USBDriveLetter As String Public Sub StartDetection() ' __InstanceOperationEvent will trap both Creation and Deletion of class instances Dim query2 As New WqlEventQuery("SELECT * FROM __InstanceOperationEvent WITHIN ...Show All
Visual Studio Team System Can the VSTS unit tests run on windows mobile 5.0 device?
We need to run test code on windows mobile 5.0 device. But I don`t know whether the VSTS unit test supports wince. I can not find some information from msdn. Hi Ljan, Visual Studio doesn't support unit testing (using Team System unit test features) with mobile devices in the 2005 release. We are looking at this for future versions. Thanks, David ...Show All
Windows Forms Freeze Panes For A Dynamically Created Datagrid
Does anyone know how to freeze the header row and one or more columns for a dynamically created datagrid. This is created in vb.net / asp.net I am also available through windows / msn messenger - paul.donaghy@hotmail.com - if anybody can help me and we can talk about my problem. All help appreciated. This code freezes the columns: Sub Item_Created(sender As Object, e As DataGridItemEventArgs) e.Item.Cells(0).CssClass = "FreezingCol" End Sub I still can't manage to freeze the first row, anyone know how ...Show All
Visual Basic form size constraint of screen resolution
hi, i recently switched monitors from one with a resolution of 1280x1024 to 1440x900. this change has caused havoc to my vb forms since i was using the max resolution of 1280x1024 and vb keeps on resetting my forms' sizes to a minimum of 900 in height, i can't resize them back to 1024. is there anyyway to get by this thanks dave Hi ReneeC, default value for that property is font, i also tried the other options (None, Font, DPI, Inherit) and still it won't give me a size larger than the current resolution. hmm any ideas Dave ...Show All
.NET Development getvalue , getfield
The following is my code ... object accountEnum = Activator.CreateInstance (t); fieldInfo =t.GetFields(); foreach (FieldInfo f in fieldInfo ) { object val=f.GetValue(accountEnum); Console .WriteLine (val); } ..... Instead of the value returned , i get only the name of the field as the value.... Whats the problem Kindly help me. as I recall if you do something like this Console.WriteLine(x); it will automatically expanded to Console.WriteLine(x.toString()); So if someone provides a meaningful toString method is up to him or her. If you know the type of the field to retrieve and it is a base type then use the Convert class. If it is an enum then try this static method on Enum ...Show All
Visual Studio VS2005 : native VC++, how do I obtain a good stack trace if(when) my program crashes?
I have a large windows app I inheritted. It was originally C code and I've brought it up to C++ specs to all exception handling and other language features. There is a good deal of bugs in the code, and some that cause the program to crash. These are not constant so its very hard to figure out just where a user was when a crash happens. Is there a good way to obtain a stack trace either on screen or to a file when this happens Are you talking about stack trace on debugging you can view it from menu Debug -> Windows->Call Stack For the runtime, most of the people are using TRACE or their own logging mechanism. assert plays a big deal to catch invalid inputs and expressions. ...Show All
