Search Results

Search found 369 results on 15 pages for 'codeproject'.

Page 12/15 | < Previous Page | 8 9 10 11 12 13 14 15  | Next Page >

  • Windows Installer custom action BEFORE any validation

    - by Marc
    I wrote a Windows Installer custom action based on the tutorial found here: http://www.codeproject.com/kb/install/msicustomaction.aspx My custom action is killing a background process of a given name which could still be opened by the user. The reason is that I don't want users to see the warning that a given EXE is running and must be closed so that setup can continue. This works fine when the MSI passes through the UI sequence as the action is created in "InstallUISequence" table like in the tutorial. However, when the MSI is used silently (right-click and select repair or uninstall), then my custom action isn't executed of course. Where do I have to put my custom action so that it is executed immediately also when run silently? I tried adding it to "InstallExecuteSequence", but the 'app running' warning is still shown. I then tried lowering the sequence number of my custom action to 5, but this also didn't help. Note: I'm using Orca to modify an MSI generated from a Visual Studio setup project. I'm then using the transform file to apply it.

    Read the article

  • Programmatically open an email from a POP3 and extract an attachment

    - by Josh
    We have a vendor that sends CSV files as email attachments. These CSV files contain statuses that are imported into our application. I'm trying to automate the process end-to-end, but it currently depends on someone opening an email, saving the attachment to a server share, so the application can use the file. Since I cannot convince the vendor to change their process, such as offering an FTP location or a Web Service, I'm stuck with trying to automate the existing process. Does anyone know of a way to programmatically open an email from a POP3 account and extract an attachment? The preferred solution would reside on a Windows 2003 server, be written VB.NET and secure. The application can reside on the same server as the POP3 server, for example, we could setup the free POP3 server that comes with Windows Server and pull against the mail file stored on the file system. BTW, we are willing to pay for an off-the-shelf solution, if one exists. Note: I did look at this question but the answer points to a CodeProject solution that doesn't deal with attachments.

    Read the article

  • Why can't I Bind a viewmodel property to a dependency property of a custom control

    - by Robert
    I want to use a color picker in my wpf application and I saw a nice looking one on this codeproject page. The control works fine until I want to connect the control to a viewmodel. I created a small test program with this viewmodel: public class ColorViewModel : ViewModelBase { public ColorViewModel() { LineColor = Brushes.Yellow; } SolidColorBrush _brushColor; public SolidColorBrush LineColor { get { return _brushColor; } set { _brushColor = value; RaisePropertyChanged(() => LineColor); } } } The test program has a textbox and the colorpicker controls: <StackPanel Orientation="Horizontal"> <TextBlock Text="Please Select a Color" FontWeight="Bold" Margin="10" Foreground="{Binding Path=LineColor, UpdateSourceTrigger=PropertyChanged}"/> <vw:ColorPickerControlView x:Name="ForeColorPicker" Margin="10" CurrentColor="{Binding Path=LineColor, UpdateSourceTrigger=PropertyChanged }"/> </StackPanel> In the loaded event of the window I set the viewmodel to the datacontext like this: DataContext = new ColorViewModel(); The problem is that I can't seem to bind the LineColor property of the viewmodel to the CurrentColor property of the ColorPickerControlView. The CurrentControl property of the ColorPickerControlView seems to be fine. The constructor looks like this: public ColorPickerControlView() { this.DataContext = this; InitializeComponent(); CommandBindings.Add(new CommandBinding(SelectColorCommand, SelectColorCommandExecute)); } In the constructor of the UserControl there is the line this.DataContext = this; I read that is is necessary to bind the dependency properties. Do I override this line when I set my viewmodel to the datacontext and is that why I can't bind to the CurrentColor property? Is there any workaround? Or did I make another mistake?

    Read the article

  • Json HTTP Module stream issue

    - by Justin
    Hey, I have an HTTP Module that I use to clean up the JSON returned by my web service (see http://www.codeproject.com/KB/webservices/ASPNET_JSONP.aspx?msg=3400287#xx3400287xx for an example of this.) Basically it relates to calling cross-domain JSON web services from javascript. There is this JsonHttpModule which uses a JsonResponseFilter Stream class to write out the JSON and the overloaded Write method is supposed to wrap the name of the callback function around the JSON, otherwise the JSON errors out as needing a label. However, if the JSON is really long, the Write method in the Stream class is called multiple times, causing the callback function to incorrectly get inserted midway through the JSON. Is there a way in the Stream class to wrap the callback function around the stream at the end or to specify that it write all of the JSON in 1 Write method instead of in chunks?? Here's where it calls the JsonResponseFilter in the JsonHttpModule: public void OnReleaseRequestState(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; if (!_Apply(app.Context.Request)) return; // apply response filter to conform to JSONP app.Context.Response.Filter = new JsonResponseFilter(app.Context.Response.Filter, app.Context); } Here's the Write method in the JsonResponseFilter Stream class that gets called multiple times: public override void Write(byte[] buffer, int offset, int count) { var b1 = Encoding.UTF8.GetBytes(_context.Request.Params["callback"] + "("); _responseStream.Write(b1, 0, b1.Length); _responseStream.Write(buffer, offset, count); var b2 = Encoding.UTF8.GetBytes(");"); _responseStream.Write(b2, 0, b2.Length); } Thanks for any help! Justin

    Read the article

  • WCF done broke.

    - by SteveCav
    WCF is completely fouled up on my machine. I start a new sln in VS2008. Add a project (WCF Service Lib).Build the project (builds ok). debug the project -- it gets halfway through the progress bar and bombs out with the error below (real path changed to "my mex path" so codeproject doesn't think its spam). I'm assuming it's file permissions but don't know where to start. Any ideas?: Error: Cannot obtain Metadata from my mex path If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at somewhere unhelpful Exchange Error URI: my mex path Metadata contains a reference that cannot be resolved: 'my mex path'. Could not connect to my mex path. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8731. Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:8731HTTP GET Error URI: my mex path There was an error downloading 'my mex path'. Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:8731

    Read the article

  • How to get a fully transparent backbuffer in directx 9 without vista Desktop Window Manager

    - by flawlesslyfaulted
    I currently have an activex control that initiates a media (video/audio) framework another development group in my company developed and I am providing a window handle to that code. That handle is being used by their rendering plugin in the pipeline that uses Direct3d for rendering the video using that handle. I have seperate LPDIRECT3D9EX and LPDIRECT3DDEVICE9EX pointers that I initialize in my activex control. I am trying to clear a backbuffer to transparent and then use directx drawing primatives to draw on that backbuffer producing a transparent window with my drawing primatives over the streaming video on the directx surface below. It appears that clearing a device backbuffer with full alpha transparency is ignored by directx. d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 1, 0 /*full alpha*/), 1.0f, 0); I can see the object I draw but they are drawn on top of a backbuffer that has the RGB color specified without the alpha value. The project linked (http://www.codeproject.com/KB/directx/umvistad3d.aspx) to in the stackoverflow question below does what I want but requires vista's Desktop Window Manager and won't work for XP. http://stackoverflow.com/questions/148275/how-do-i-draw-transparent-directx-content-in-a-transparent-window I have tried with D3DRS_ALPHABLENDENABLE true with configured blend with no avail. I have also tried to have pixels with full alpha values not rendered using D3DRS_ALPHATESTENABLE, D3DRS_ALPHAREF, and D3DRS_ALPHAFUNC setup but this doesn't work either. I have tried using ColorFill with alpha after retrieving the backbuffer with GetBackBuffer but this doesn't work either. (again only RGB is used) Finally I have tried creating a texture, selecting a surface, colorfilling that surface with a fully transparent alpha value, then loading that surface onto the backbuffer but only the RGB values appear to be used. I have checked the capabilities using the DXCapsViewer.exe and the D3DFMT_A8R8G8B8 backbuffer format that I am using for the backbuffer is valid so it can't be that. Has anyone gotten a transparent backbuffer in directx to work in XP?

    Read the article

  • Unable to use stored procs in a generic repository for the entity framework. (ASP.NET MVC 2)

    - by Matt
    Hi, I have a generic repository that uses the entity framework to manipulate the database. The original code is credited to Morshed Anwar's post on CodeProject. I've taken his code and modified is slightly to fit my needs. Unfortunately I'm unable to call an Imported Function because the function is only recognized for my specific instance of the entity framework public class Repository<E, C> : IRepository<E, C>, IDisposable where E : EntityObject where C : ObjectContext { private readonly C _ctx; public ObjectResult<MyObject> CallFunction() { // This does not work because "CallSomeImportedFunction" only works on // My object. I also cannot cast it (TrackItDBEntities)_ctx.CallSomeImportedFunction(); // Not really sure why though... but either way that kind of ruins the genericness off it. return _ctx.CallSomeImportedFunction(); } } Anyone know how I can make this work with the repository I already have? Or does anyone know a generic way of calling stored procedures with entity framework? Thanks, Matt

    Read the article

  • what are the possibilities of displaying items in a listbox.

    - by Selase
    Ive been trying to figure out for a long time now how to create an interface that can allows users to input several rows of data and passed those entries into an sql server database all at one shot. i could not get any better ideas so i came up with this.(see picture below.) so what i envisioned is that the user enters values in the textboxes and hits "add to list" button. the values are then populated in the list box below with the heading "exhibits lists" and when add exhibit button is pressed, all values from the list box are passed into the database. Well am left wondering again if it would be possible to tie this values from the texboxes to the list box and if id be able to pass them into the database. if it were possible then id please love to know how to go about it otherwise id be glad if you can recommend a better way for me to handle the situation otherwise id have to resolve to data entry one at a time.:(... Counting on you sublime advise. thanks. I believe there is some useful information from this website that can help solve my problem but i just cant make head and tail out of the article...it seems like am almost there and it skids off...can everyone please read and help me adapt it to my situation..thanks..post below http://www.codeproject.com/KB/aspnet/ExtendedGridView.aspx

    Read the article

  • EasyHook Windows Hooking problem/.dll injection

    - by Tom
    Ok can someone try and find the error with this code, it should produce all the registry keys every time something accesses them but i keep getting: System.MissingMethodException: The given method does not exist at EasyHook.LocalHook.GetProcAdress(String InModule, String InChannelName) An example code can be found here: http://www.codeproject.com/KB/DLL/EasyHook64.aspx I can get the CcreateFileW example to work! My code is here: public class Main : EasyHook.IEntryPoint { FileMon.FileMonInterface Interface; LocalHook LocalHook; Stack<String> Queue = new Stack<String>(); public Main(RemoteHooking.IContext InContext,String InChannelName) { // connect to host... Interface = RemoteHooking.IpcConnectClient<FileMon.FileMonInterface>(InChannelName); Interface.Ping(); } public void Run(RemoteHooking.IContext InContext,String InChannelName) { // install hook... try { LocalHook localHook = LocalHook.Create(LocalHook.GetProcAddress("Advapi32.dll", "RegOpenKeyExW"),new DMyRegOpenKeyExW(MyRegOpenKeyExW),this); localHook.ThreadACL.SetExclusiveACL(new int[] { }); } catch (Exception ExtInfo) { Interface.ReportException(ExtInfo); return; } Interface.IsInstalled(RemoteHooking.GetCurrentProcessId()); RemoteHooking.WakeUpProcess(); // wait for host process termination... try { while (true) { Thread.Sleep(500); // transmit newly monitored file accesses... if (Queue.Count > 0) { String[] Package = null; lock (Queue) { Package = Queue.ToArray(); Queue.Clear(); } Interface.OnCreateFile(RemoteHooking.GetCurrentProcessId(), Package); } else Interface.Ping(); } } catch { // Ping() will raise an exception if host is unreachable } } [DllImport("Advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.StdCall)] static extern int RegOpenKeyExW(UIntPtr hKey,string subKey,int ulOptions,int samDesired,out UIntPtr hkResult); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)] delegate int DMyRegOpenKeyExW(UIntPtr hKey,string subKey,int ulOptions,int samDesired,out UIntPtr hkResult); int MyRegOpenKeyExW(UIntPtr hKey,string subKey,int ulOptions,int samDesired,out UIntPtr hkResult) { Console.WriteLine(string.Format("Accessing: {0}", subKey)); return RegOpenKeyExW(hKey, subKey, ulOptions, samDesired, out hkResult); } }

    Read the article

  • QuadTrees - how to update when internal items are moving

    - by egarcia
    I've implemented a working QuadTree. It subdivides 2-d space in order to accomodate items, identified by their bounding box (x,y,width,height) on the smallest possible quad (up to a minimum area). My code is based on this implementation (mine is in Lua instead of C#) : http://www.codeproject.com/KB/recipes/QuadTree.aspx I've been able to successfully implement insertions and deletions successfully. I've turn now my attention to the update() function, since my items' position and dimensions change over time. My first implementation works, but it is quite naïve: function QuadTree:update(item) self:remove(item) return self.root:insert(item) end Yup, I basically remove and reinsert every item every time they move. This works, but I'd like to optimize it a bit more; after all, most of the time, moving items still remain on the same quadTree node most of the iterations. Is there any standard way to deal with this kind of update? In case it helps, my code is here: http://github.com/kikito/passion/blob/master/ai/QuadTree.lua I'm not looking for someone to implement it for me; pointers to an existing working implementation (even in other languages) would suffice.

    Read the article

  • When is someone else's code I use from the internet "mine"?

    - by robault
    I'm building a library from methods that I've found on the internet. Some are free to use or modify with no requirements, others say that if I leave a comment in the code it's okay to use, others say when I use the code I have to attribute the use of someone's code in my application (in the credits for my app I guess). What I've been doing is reorganizing classes, renaming methods, adding descriptions (code comments), renaming the parameters and names inside the methods to something meaningful, optimizing loops if applicable, changing return types, adding try/catch/throw blocks, adding parameter checks and cleaning up resources in the methods. For example; I didn't come up with the algorithm for blurring a Bitmap but I've taken the basic example of iterating through the pixels and turned it into a decent library method (applying the aforementioned modifications). I understand how to go about building it now myself but I didn't actually hit the keystrokes to make it and I couldn't have come up with it before learning from their example. What about code people get in answers on Stackoverflow or examples from Codeproject? At what point can I drop their requirements because at n% their code became mine? FWIW I intend on using the libraries to create products that I will sell.

    Read the article

  • How to create a fully lazy singleton for generics

    - by Brendan Vogt
    I have the following code implementation of my generic singleton provider: public sealed class Singleton<T> where T : class, new() { Singleton() { } public static T Instance { get { return SingletonCreator.instance; } } class SingletonCreator { static SingletonCreator() { } internal static readonly T instance = new T(); } } This sample was taken from 2 articles and I merged the code to get me what I wanted: http://www.yoda.arachsys.com/csharp/singleton.html and http://www.codeproject.com/Articles/11111/Generic-Singleton-Provider. This is how I tried to use the code above: public class MyClass { public static IMyInterface Initialize() { if (Singleton<IMyInterface>.Instance == null // Error 1 { Singleton<IMyInterface>.Instance = CreateEngineInstance(); // Error 2 Singleton<IMyInterface>.Instance.Initialize(); } return Singleton<IMyInterface>.Instance; } } And the interface: public interface IMyInterface { } The error at Error 1 is: 'MyProject.IMyInterace' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'MyProject.Singleton<T>' The error at Error 2 is: Property or indexer 'MyProject.Singleton<MyProject.IMyInterface>.Instance' cannot be assigned to -- it is read only How can I fix this so that it is in line with the 2 articles mentioned above? Any other ideas or suggestions are appreciated.

    Read the article

  • Is it important to dispose SolidBrush and Pen?

    - by Joe
    I recently came across this VerticalLabel control on CodeProject. I notice that the OnPaint method creates but doesn't dispose Pen and SolidBrush objects. Does this matter, and if so how can I demonstrate whatever problems it can cause? EDIT This isn't a question about the IDisposable pattern in general. I understand that callers should normally call Dispose on any class that implements IDisposable. What I want to know is what problems (if any) can be expected when GDI+ object are not disposed as in the above example. It's clear that, in the linked example, OnPaint may be called many times before the garbage collector kicks in, so there's the potential to run out of handles. However I suspect that GDI+ internally reuses handles in some circumstances (for example if you use a pen of a specific color from the Pens class, it is cached and reused). What I'm trying to understand is whether code like that in the linked example will be able to get away with neglecting to call Dispose. And if not, to see a sample that demonstrated what problems it can cause. I should add that I have very often (including the OnPaint documentation on MSDN) seen WinForms code samples that fail to dispose GDI+ objects.

    Read the article

  • Module not found

    - by TMP
    Hi There! I've been working on this one quite a bit and haven't gotten any closer to a solution. I juut dug up my old copy of the WindowsHookLib again - It's available with source at http://www.codeproject.com/KB/DLL/WindowsHookLib.aspx. This library allows Global Windows Mouse/Keyboard/Clipboard Hooks, which is very useful. I'm trying to use the Mouse Hook in here to Capture Mouse-Motion (I could use a Timer that always polls Cursor.Position, but I plan on using more features of WindowsHookLib later). Code as follows: MouseHook mh = new MouseHook(); mh.InstallHook(); mh.MouseMove += new EventHandler<WindowsHookLib.MouseEventArgs>(mh_MouseMove); But on the call to InstallHook(), I get an Exception: "The specified Module could not be found". Strange. Searching, I found that someone thought this occurs because a DLL is not in a place included in the Windows PATH variable, and because placing it in system32 didn't help I went the whole hog and translated the thing to C# for inclusion directly in my project (I was curious how it works). However the error was obstinately persistent, so I dug a bit on this, and found the Code in the Library that is responsible: In InstallHook(), we have IntPtr hinstDLL = Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]); this._hMouseHook = UnsafeNativeMethods.SetWindowsHookEx(14, this._mouseProc, hinstDLL, 0); if (this._hMouseHook == IntPtr.Zero) { throw new MouseHookException(new Win32Exception(Marshal.GetLastWin32Error()).Message); } And this (after modification and recompile) tells me that what I'm really getting is a Windows error "ERROR_MOD_NOT_FOUND"! Now, Here I'm stumped. Didn't I just compile the Hook Library directly into my project? (UnsafeMethods.SetWindowsHookEx is just a DllImported Method from user32) Any Answers, or Prods in the right direction, or any hints, pointers or similar are very much appreciated!

    Read the article

  • Free solution for automatic updates with .NET/C#?

    - by a2h
    Yes, from searching I can see this has been asked time and time again. Here's a backstory. I'm an individual hobbyist developer with zero budget. A program I've been developing has been in need of constant bugfixes, and me and users are getting tired of having to manually update. Me, because my current solution of Manually FTP to my website Update a file "newest.txt" with the newest version Update index.html with a link to the newest version Hope for people to see the "there's an update" message Have them manually download the update sucks, and whenever I screw up an update, I get pitchforks. Users, because, well, "Are you ever going to implement auto-update?" "Will there ever be an auto-update feature?" Over the past few hours I have looked into: http://windowsclient.net/articles/appupdater.aspx - I can't comprehend the documentation http://www.codeproject.com/KB/vb/Auto_Update_Revisited.aspx - Doesn't appear to support anything other than working with files that aren't in use http://wyday.com/wyupdate/ - wyBuild isn't free, and the file specification is simply too complex. Maybe if I was under a company paying me I could spend the time, but then I may as well pay for wyBuild. http://www.kineticjump.com/update/default.aspx - Ditto. ClickOnce - Workarounds for implementing launching on startup are massive, horrendous and not worth it for such a simple feature. Publishing is a pain; manual FTP and replace of all files is required for servers without FrontPage Extensions. I'm pretty much ready to throw in the towel right now and strangle myself. And then I think about Sparkle...

    Read the article

  • How can I make this LinqToSQL query work? (SqlExecption)

    - by kversch
    The following code gives me an SqlException: OO theCourse = subject.Course; var students = dc.studentsCourses.Where(x = x.course == theCourse).Select(x = x.student); "Invalid object name 'dbo.studentsCourses'." I tried the following code instead but I also get an Exception. My original question was asked on Aardvark and can be read bellow: var allStudents = from s in dc.students select s; List thestudents = new List(); foreach (student s in allStudents) { if (s.courses.Contains(theCourse)) { thestudents.Add(s); } } I did a right click, "run custom tool" on my dbml and checked my names of my tables and entities. The project compiles but I get an Exception at runtime on this line: "if (s.courses.Contains(theCourse))" Any ideas? Original question on Aardvark: How do I do a LinqToSQL query that gives me this: I want to select all students that attended a certain lesson. The lesson is from a certain course. So select the course the lesson is from. Now select all the students that are following that course. There is a many-to-many relationship between the students and the courses table in my DB. I already extended my LINQ entities to be able to select student.Courses and course.Students using this method: http://www.codeproject.com/KB/linq/linq-to-sql-many-to-many.aspx

    Read the article

  • Handle multiple db updates from c# in SQL Server 2008

    - by joeriks
    I like to find a way to handle multiple updates to a sql db (with one singe db roundtrip). I read about table-valued parameters in SQL Server 2008 http://www.codeproject.com/KB/database/TableValueParameters.aspx which seems really useful. But it seems I need to create both a stored procedure and a table type to use it. Is that true? Perhaps due to security? I would like to run a text query simply like this: var sql = "INSERT INTO Note (UserId, note) SELECT * FROM @myDataTable"; var myDataTable = ... some System.Data.DataTable ... var cmd = new System.Data.SqlClient.SqlCommand(sql, conn); var param = cmd.Parameters.Add("@myDataTable", System.Data.SqlDbType.Structured); param.Value=myDataTable; cmd.ExecuteNonQuery(); So A) do I have to create both a stored procedure and a table type to use TVP's? and B) what alternative method is recommended to send multiple updates (and inserts) to SQL Server?

    Read the article

  • how to release object from thid party dll?

    - by Mohamed
    hi all, i'm developing a program to convert RTF to html i'm using the DLLs found here http://www.codeproject.com/KB/recipes/RtfConverter.aspx?fid=1458864&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=3427424&fr=1#xx0xx this dll saves a jpg file from html to a specific folder, when i run the program, it cinverts the rtf for the first time and saves the images to the folder perfectly but when i try to convert it again i hace this error "error a generic error occured in GDI+" i think this dll use SaveImage method and to avoid this you must release the Image object you created but i can't modify the DLL, is there is any way to release the object i've created from this dll? this is my code RtfVisualImageAdapter imageAdapter = new RtfVisualImageAdapter( @Application.StartupPath + "\\Program Data\\temp\\{0}{1}", System.Drawing.Imaging.ImageFormat.Jpeg); RtfImageConvertSettings imageConvertSettings = new RtfImageConvertSettings(imageAdapter); RtfImageConverter imageConverter = new RtfImageConverter(imageConvertSettings); try { IRtfDocument rtfDocument = RtfInterpreterTool.BuildDoc( ConversionText, imageConverter); RtfHtmlConverter htmlConverter = new RtfHtmlConverter(rtfDocument); htmlConverter.Settings.ConvertVisualHyperlinks = true; htmlConverter.Settings.UseNonBreakingSpaces = true; this.richTextBoxPrintCtrl2.Text = htmlConverter.Convert(); } catch (Exception exception) { MessageBox.Show(this, "Error " + exception.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); }

    Read the article

  • FindWindowEx from user32.dll is returning a handle of Zero and error code of 127 using dllimport

    - by puretechy
    I need to handle another windows application programatically, searching google I found a sample which handles windows calculator using DLLImport Attribute and importing the user32.dll functions into managed ones in C#. The application is running, I am getting the handle for the main window i.e. Calculator itself, but the afterwards code is not working. The FindWindowEx method is not returning the handles of the children of the Calculator like buttons and textbox. I have tried using the SetLastError=True on DLLImport and found that I am getting an error code of 127 which is "Procedure not found". This is the link from where I got sample application: http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=14519&av=34503 Please help if anyone knows how to solve it. UPDATE: The DLLImport is: [DllImport("user32.dll", SetLastError = true)] public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle); The Code that is not working is: hwnd=FindWindow(null,"Calculator"); // This is working, I am getting handle of Calculator // The following is not working, I am getting hwndChild=0 and err = 127 hwndChild = FindWindowEx((IntPtr)hwnd,IntPtr.Zero,"Button","1"); Int32 err = Marshal.GetLastWin32Error();

    Read the article

  • Usage of VIsual Memory Leak Detector

    - by Yan Cheng CHEOK
    I found a very interesting memory leak detector by using Visual C++. http://www.codeproject.com/KB/applications/visualleakdetector.aspx I try it out, but cannot make it works to detect a memory leak code. I am using MS Visual Studio 2008. Any step I had missed out? #include "stdafx.h" #include "vld.h" #include <iostream> void fun() { new int[1000]; } int _tmain(int argc, _TCHAR* argv[]) { fun(); std::cout << "lead?" << std::endl; getchar(); return 0; } The output when I run in debug mode is : ... ... 'Test.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\msvcr80.dll', Symbols loaded. 'Test.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Symbols loaded (source information stripped). 'Test.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcp90d.dll', Symbols loaded. 'Test.exe': Loaded 'C:\Program Files\Visual Leak Detector\bin\dbghelp.dll', Symbols loaded (source information stripped). Visual Leak Detector Version 1.9d installed. No memory leaks detected. Visual Leak Detector is now exiting. The program '[5468] Test.exe: Native' has exited with code 0 (0x0).

    Read the article

  • changing the serialization procedure for a graph of objects (.net framework)

    - by pierusch
    Hello I'm developing a scientific application using .net framework. The application depends heavily upon a large data structure (a tree like structure) that has been serialized using a standard binaryformatter object. The graph structure looks like this: <serializable()>Public class BigObjet inherits list(of smallObject) end class <serializable()>public class smallObject inherits list(of otherSmallerObjects) end class ... The binaryFormatter object does a nice job but it's not optimized at all and the entire data structure reaches around 100Mb on my filesystem. Deserialization works too but it's pretty slow (around 30seconds on my quad core). I've found a nice .dll on codeproject (see "optimizing serialization...") so I wrote a modified version of the classes above overriding the default serialization/deserialization procedure reaching very good results. The problem is this: I can't lose the data previosly serialized with the old version and I'd like to be able to use the new serialization/deserialization method. I have some ideas but I'm pretty sure someone will be able to give me a proper and better advice ! use an "helper" graph of objects who takes care of the entire serialization/deserialization procedure reading data from the old format and converting them into the classes I nedd. This could work but the binaryformatter "needs" to know the types being serialized so........ :( modify the "old" graph to include a modified version of serialization procedure...so I'll be able to deserialize old file and save them with the new format......this doesn't sound too good imho. well any help will be higly highly appreciated :)

    Read the article

  • Trapping messages in .NET

    - by user350632
    How can i trap a Windows system message (like WM_SETTEXT) that was sent by some window (VLC player window in my case)? I've tried to inherit NativeWindow class and override WndProc like this: class VLCFilter : NativeWindow { System.IntPtr iHandle; const int WM_SETTEXT = 0x000C; public VLCFilter() { Process p = Process.GetProcessesByName("vlc")[0]; iHandle = p.MainWindowHandle; } protected override void WndProc(ref Message aMessage) { base.WndProc(ref aMessage); if (aMessage.HWnd != iHandle) return false; if (aMessage.Msg == WM_SETTEXT) { MessageBox.Show("VLC window text changed!"); } } } I have checked with Microsoft Spy++ that WM_SETTEXT message is sent by VLC player but my code doesn't seem to get the work done. I've refered mainly to: http://www.codeproject.com/kb/dotnet/devicevolumemonitor.aspx I'm trying to make this work for some time with no success. What am I doing wrong? What I am not doing? Maybe there is easier way to do this? My initial goal is to catch when VLC player (that could be playing somewhere in the background and is not emmbed in my application) repeats its playback (have noticed that WM_SETTEXT message is sent then and I'm trying to find it out like this).

    Read the article

  • How do I consume a self hosted WCF service with Compact Framework client?

    - by pitprog
    Hello - I've been trying to figure out how to consume a self hosted WCF service from a Windows CE device. I've not found any good resources that walk through this process online. I've found some good samples for self hosting, and that part seems to be working fine, but not sure how to go about consuming on the compact framework. In the past I was able to use NetCFSvcUtil.exe, but this doesn't seem to work with a self hosted service. NetCFSvcutil says: The underlying connection was closed: An unexpected error occurred on a receive. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. I've used Jason Henderson's sample http://www.codeproject.com/KB/WCF/WCFexample.aspx to get started with self hosting and that part works as expected. Can any one point me to a sample where a compact framework client is used to consume a self hosted WCF service? or give a brief explanation of how I create the plumbing on the compact framework side? For the host application I'm using a WinForm .Net 3.5 project and for the client a WinForm Compact Framework 3.5 project. Thanks!

    Read the article

  • Saving a single entity instead of the entire context - revisited

    - by nite
    I’m looking for a way to have fine grained control over what is saved using Entity Framework, rather than the whole ObjectContext.SaveChanges(). My scenario is pretty straight forward, and I’m quite amazed not catered for in EF – pretty basic in NHibernate and all other data access paradigms I’ve seen. I’m generating a bunch of data (in a WPF UI) and allowing the user to fine tune what is proposed and choose what is actually committed to the database. For the proposed entities I’m: getting a bunch of reference entities (eg languages) via my objectcontext, creating the proposed entities and assigning these reference entities to them (as navigation properties), so by virtue of their relationship to the reference entities they’re implicitly added to the objectconext Trying to create & save individual entites based on the proposed entities. I figure this should be really simple & trivial but everything I’ve tried I’ve hit a brick wall, either I set up another objectcontext & add just the entity I need (it then tries to add the whole graph and fails as it’s on another objectcontext). I’ve tried MergeOptions = NoTracking on my reference entities to try to get the Attach/AddObject not to navigate through these to create a graph, no avail. I've removed the navigation properties from the reference entities. I've tried AcceptAllChanges, that works but pretty useless in practice as I do still want to track & save other entities. In a simple test, I can create 2 of my proposed entities, AddObject the one I want to save and then Detach the one I dont then call SaveChanges, this works but again not great in practice. Following are a few links to some of the nifty ideas which in the end don’t help in the end but illustrate the complexity of EF for something so simple. I’m really looking for a SaveSingle/SaveAtomic method, and think it’s a pretty reasonable & basic ask for any DAL, letalone a cutting edge ORM. http://stackoverflow.com/questions/1301460/saving-a-single-entity-instead-of-the-entire-context www.codeproject.com/KB/architecture/attachobjectgraph.aspx?fid=1534536&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=3071122&fr=1 bernhardelbl.spaces.live.com/blog/cns!DB54AE2C5D84DB78!238.entry

    Read the article

  • How can I write to a single xml file from two programs at the same time?

    - by Tom Bushell
    We recently started working with XML files, after many years of experience with the old INI files. My coworker found some CodeProject sample code that uses System.Xml.XmlDocument.Save. We are getting exceptions when two programs try to write to the same file at the same time. System.IO.IOException: The process cannot access the file 'C:\Test.xml' because it is being used by another process. This seems obvious in hindsight, but we had not anticipated it because accessing INI files via the Win32 API does not have this limitation. I assume there's some arbitration done by the Win32 calls that work at a higher level than the the XmlDocument.Save method. I'm hoping there are higher level XML routines somewhere in the .Net library that work similarily to the Win32 functions, but don't know where to start looking. Or maybe we can set up our file access permissions to allow multiple programs to write to the same file? Time is short (like almost all SW projects), and if we can't find a solution quickly, we'll have to hold our noses and go back to INI files.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15  | Next Page >