Tag: c ++

我可以从C ++或C#程序中提取MSI包的内容吗?

比方说,如果我有一个MSI安装文件,我可以从C#或C ++程序中提取其内容而不安装它吗?

如何显示打开/保存对话框asp net mvc 4

我可以请求一个文件并将其返回。 我不知道如何显示打开/保存对话框。 视图: function saveDocument() { $.ajax({ url: ‘/Operacao/saveDocument’, type: ‘POST’, DataType: “html”, success: function (data) { //I get the file content here } }); } 控制器: public void saveDocument() { Response.ContentType = “image/jpeg”; Response.AppendHeader(“Content-Disposition”, “attachment; filename=SailBig.jpg”); Response.TransmitFile(Server.MapPath(“~/MyPDFs/Pdf1.pdf”)); Response.End(); }

获取.NET对象的内存地址(C#)

我试图追踪单声道运行时中的一个错误,其中变量似乎被分配给一个有效对象,然后被重新分配给一个虚假对象,特别是 //early in code I allocate, fine var o = new object(); // valid allocation // later in code this is called, not fine lock(o) // <- is triggering bug due to "o" now referencing a nonsense memory location. 我想知道何时对“o”的引用变得无意义,并且这样做是为了找到一种方法来确定C#代码中不同时间点的“o”的地址。 我知道类似于其他问题的答案“不要那样做有GC”,但GC不起作用所以我需要一个解决方法。 有谁知道如何确定C#中单声道对象的地址? 很好地链接在非托管代码或其他任何东西。 (关于诊断主要问题的方法的任何其他线索)。

通过管道在c ++和c#之间进行通信

我想通过管道将数据从ac#应用程序发送到c ++应用程序。 这就是我所做的: 这是c ++客户端: #include “stdafx.h” #include #include int _tmain(int argc, _TCHAR* argv[]) { HANDLE hFile; BOOL flg; DWORD dwWrite; char szPipeUpdate[200]; hFile = CreateFile(L”\\\\.\\pipe\\BvrPipe”, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); strcpy(szPipeUpdate,”Data from Named Pipe client for createnamedpipe”); if(hFile == INVALID_HANDLE_VALUE) { DWORD dw = GetLastError(); printf(“CreateFile failed for Named Pipe client\n:” ); } […]

从IBM浮点转换为IEEE浮点标准和反向Versa In C#?

正在为我们正在使用的旧系统寻找IEEE浮点数到IBM浮点格式的方法。 我们可以在C#中使用通用公式吗?

如何在拖放过程中自动滚动DataGridView

我的C#.NET应用程序中的一个表单有多个DataGridViews,它们实现拖放以移动行。 拖放大多数工作正常,但我一直很难将DataGridViews转换为AutoScroll – 当在行的顶部或底部附近拖动一行时,向该方向滚动它。 到目前为止,我已经尝试实现此解决方案的一个版本。 我有一个inheritance自DataGridView的ScrollingGridView类,它实现了所描述的计时器,并且根据调试器,计时器正在适当地触发,但是计时器代码: const int WM_VSCROLL = 277; private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam); private void ScrollingGridViewTimerTick(object sender, EventArgs e) { SendMessage(Handle, WM_VSCROLL, (IntPtr)scrollDirectionInt, IntPtr.Zero); } 据我所知,我没有做任何事情,可能是因为我在表单中有多个DataGridViews。 我也尝试修改AutoScrollOffset属性,但这也没有做任何事情。 对DataGridView和ScrollBar类的研究似乎没有提出实际使DataGridView滚动的任何其他命令或函数。 任何人都可以帮助我实际滚动DataGridView的function,或其他一些方法来解决问题?

我应该使用return / continue语句而不是if-else吗?

在C,C ++和C#中,当在函数或循环语句中使用条件时,可以尽早使用continue或return语句,并删除if-else语句的else分支。 例如: while( loopCondition ) { if( innerCondition ) { //do some stuff } else { //do other stuff } } 变 while( loopCondition ) { if( innerCondition ) { //do some stuff continue; } //do other stuff } 和 void function() { if( condition ) { //do some stuff } else { //do […]

将映像存储在SQL Server CE数据库中

有没有人知道如何在SQL Server CE数据库中存储图像? 该列应该是什么数据类型? (我猜二进制。) 我使用Linq-To-Datasets。 有可能使用它将图像放入数据库并稍后再将其拉出来吗? 谢谢你的建议。 我是这样做的: MemoryStream stream = new MemoryStream(); myBitmapImage.Save(stream, ImageFormat.Png); myInsertLinqToDataSetRow.IMAGE_COLUMN = stream.ToArray(); 要重新加载它我做了这个: MemoryStream stream = new MemoryStream(myLinqToDataSetRow.IMAGE_COLUMN); myBitmapImage.SignatureImage = new Bitmap(stream); 我在MSDN上找到一个页面,表示Image列类型正在消失,你应该使用varbinary(MAX)。 SQL Server CE不支持Max,所以我做了varbinary(8000)。 稍后注意:虽然SQL Server CE不支持varbinary(max)。 Varbinary(8000)对于许多图像来说都不够大。 我确实最终使用了Image类型,即使它计划被弃用。 一旦ms在移动平台上提供合理的交替,我将考虑切换。

将FileSystemWatcher与Windows服务一起使用

我有一个Windows服务,需要监视目录中的文件,然后将其移动到另一个目录。 我正在使用FileSystemWatcher来实现这一点。 这是我的主要服务类。 public partial class SqlProcessService : ServiceBase { public SqlProcessService() { InitializeComponent(); } protected override void OnStart(string[] args) { FileProcesser fp = new FileProcesser(ConfigurationManager.AppSettings[“FromPath”]); fp.Watch(); } protected override void OnStop() { } } 这是我的FileProcessor类 public class FileProcesser { FileSystemWatcher watcher; string directoryToWatch; public FileProcesser(string path) { this.watcher = new FileSystemWatcher(); this.directoryToWatch = path; […]

Kinect框架到达异步

我正在寻找Kinect v2 SDK中的MultiSourceFrameArrived事件的一些帮助。 以下是有问题的方法: private async void _reader_MultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e) { MultiSourceFrame multiSourceFrame = e.FrameReference.AcquireFrame(); using (var colorFrame = multiSourceFrame.ColorFrameReference.AcquireFrame()) { if (colorFrame != null) { _writeableBitmap.Lock(); colorFrame.CopyConvertedFrameDataToIntPtr( _writeableBitmap.BackBuffer, (uint)(_colorFrameDescription.Width * _colorFrameDescription.Height * _colorFrameDescription.BytesPerPixel), ColorImageFormat.Bgra); _writeableBitmap.AddDirtyRect(new Int32Rect(0, 0, _writeableBitmap.PixelWidth, _writeableBitmap.PixelHeight)); _writeableBitmap.Unlock(); reflectionOverlayControl.ReflectionImageSource = _writeableBitmap; } } using (var bodyFrame = multiSourceFrame.BodyFrameReference.AcquireFrame()) { if (bodyFrame […]