LEF1's Q&A profile
Visual C++ Problem usage CImage and Clipboard
When I do this, I got ASSERT inside CImage::ReleaseDC(), What's wrong HBITMAP hBitmap = (HBITMAP)GetClipboardData(CF_BITMAP); CImage m_CImage.Attach( hBitmap ); CWnd::OnPaint() { CPaintDc dc(this); CRect rect; GetClientRect( &rect ); m_CImage.Draw( dc.m_hDC, rect ); //ASSERT inside! } michot hi, You should propably provide more code, so we would be more accurate of what is happening. There are many cases of the error's reason: - first if the program executes two times the 'm_CImage.Attach' without execute the 'm_CImage.Detach', assert occurs. So you must be ensure that 'Attach' 'Detach' exeuted in pairs. - Then provide check for 'hBitmap' handle. If it is NULL then assert may occur (pro ...Show All
Visual Studio 2008 (Pre-release) Catching Exception at App Level
Hello, I want to log general exception (fatal exception). I was wondering is there anyway for me to catch exceptions at my application level (the top most level, System.Windows.Application). I have a try catch block in my System.Windows.Application.App() [Constructor]: try { MainWindow mw = new MainWindow(); mw.Show(); } Catch(Exception e) {Log(e); Application.Current.Shutdown()} I can't believe that this is the right appraoch :( I guess I could write a console application and in the Main start up the app, that way I can catch all the exception. Thanks in advance Houman You can hook up to Application.Current.DispatcherUnhandledException event to catch all the un ...Show All
.NET Development performence issue of an XML reader
Codes: // Load an XML file and display the structure and content in a tree view. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Xml; namespace XMLReader { public partial class XMLReader_WindowsBased : Form { public XMLReader_WindowsBased() { InitializeComponent(); } private void btnSelect_Click( object sender, EventArgs e) { ofdXMLFile.ShowDialog(); txtXmlFile.Text = ofdXMLFile.FileName; } private void cmdLoad_Click( object sender, EventArgs e) { // Clear the tree. treeXml.Nodes.Clear( ...Show All
.NET Development How to obtain bandwidth and downloading rate
Hi all: I want to develop a software like a peer_to_peer application in C#.But I don't quite know how to realize some functions such as getting a peer bandwidth,throttling and showing downloading rate. I google it ,and find a article " How to do bandwidth Throttling using C# .Net code ". But the website require you to pay for registration. :=>( can anyone tell me how to realize those functions or offer me some samples or some webs Thanks a lot. Thanks all, I'll write my code for recording download speed and bandwidth as Alan stated. Thanks Alan specially. ...Show All
Visual Basic Load COM add-in in Visual Studio 2005
Hi there, my problem is, that I need to add a COM add-in to Visual Studio 2005. I've found the suggestion, to look under Tools\COM add-ins, but there is no "COM add-ins". I've got WS 2005 Professional, where do I find that Could anyone please help me Thanks so far Christian Ahhhhhh , Com Component...From the Main Menu...Project...Add Reference....Com Reference...and see if it is in the list to select....if not browse for appropriate reference file....Dll, Tbl, Ocx....etc.... ...Show All
SQL Server Add/Remove DataViewers makes VS to crash
Hi all, I'm sick of VS crashing when I add/remove DataViewers any idea why this could happen Sebastien. In my case it happens when a dataviewer is assiocated with a deleted item. When you delete an control flow item on the control flow the dataviewers are not deleted. When you try to delete one VS will crash Workaround: Create a new control flow item with the same name as is used for the dataviewer. Delete the dataviewers in the breakpoint window Delete the control flow item. At least it did the trick for me (after a few dozens of crashes before I discovered this workaround) Sander ...Show All
Windows Forms Changing selected tabpage when focus changes
Hello, I have a Windows form with a tab control containing two tabpages; each tabpage contains a few textboxes. The form also has an 'OK' and 'Cancel' buttons. The 'OK' button validates user input before processing it, and if there is invalid input, it displays a messagebox and sets focus on the invalid textbox. For simplification, let's assume this is the logic executed on btnOk.Click (Note that txtTabpage2 is in TabPage2): Private Sub BtnOk_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOk.Click If String .IsNullOrEmpty( Me .txtTabpage2.text.trim) Then MessageBox.Show( "Invalid content" ) Me .txtTabpage2.Focus() End If End Sub Now, if the user ...Show All
SQL Server No internet search findings
When doing a search I do not get any of the internet findings (Questions, MSDN Online, and CodeZone Community). Does anyone know why this happens There is an error message: The request failed with HTTP status 407: Proxy Access Denied. Is there a way around this I can access the internet in the Document Explorer. Thanks, Fred I checked the Web Settings and they match my browsers settings. I have a proxy server and the setting is correct in the Web Settings. Does Books Online try to go around the proxy server Fred ...Show All
Visual Studio Need help building web projects with MSBuild?
If you're interested in building your web project using MSBuild, we can save you the trouble of posting the question and waiting for an answer :) To build web projects with MSBuild you need the Web Deployment Project add-in. You can get it from http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/ . Another option is to use Web Application Projects , which give you the VS2003 model of working with ASP.NET projects, but the benefits of ASP.NET 2.0 and VS2005. Happy building! Neil Neil, But I have a couple of questions. 1) We are now working with Web Application projects in VS2005 and wish to use msbuild to publish/deploy from the command line just as you can from the VS Build/Publish menu option. Is ...Show All
Visual C# what is Impersonation
can someone expain me what is Impersonation from an ASP.NET side and when it can be used. If you have any simple examples, please share. Thank you, HI, I am sorry I don’t understand exactly what I still have to do. I deleted the code above, since you said I don’t need it, Looking at your links: I have added this code behind: Windows Authentication Provider @ http://msdn2.microsoft.com/en-us/library/eeyk640h.aspx since I am trying to implement the code in asp.net Code behind: it says: IntPtr accountToken = WindowsIdentity.GetCurrent().Token; WindowsIdentity windowsIdentity = new WindowsIdentity(accountToken); Response.Write("<BR>Created a Win ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Making an entire viewport transparent
I have a game where your in a maze And I want to display the map in a second viewport that display on top of the game screen. That works fine. But, I need to make this map overlay like 35% transparent. Does anyone know how to make an entire viewport transparent Thanks, Nick The best way is probably to draw the map to a separate RenderTarget2D, then use a single sprite draw to display the contents of that rendertarget over your main scene. Makes it very easy to do all kinds of effects like scaling, moving around, translucency, and tinting, during that final sprite draw. ...Show All
Software Development for Windows Vista Separating Serviced Components from Data Access Components
In Christian Nagel’s book "Enterprise Services with the .NET Framework", he talks about separating serviced components from components that perform data access. This way the serviced components are really just wrappers that call other components that perform the real work of interacting with the database. The data access components don't contain any Enterprise Services related attributes. He uses the following simple example to illustrate this point: Serviced Component A --> Data Access Component B --> Database. I am wondering if anybody has experience with complex scenarios like this: Serviced Component A --> Data Access Component B --> Data Access Component C --> Data Access Com ...Show All
Windows Forms Retrieve query result value programaticly?
This is a very stupid question, but here it goes: If i do: this .ordersTableAdapter.FillByID( this .dbDataSet.Orders, 12345 ); My controls, which are bound to ordersBindingSource, will populate. But how can i get the values from this result programaticly Let's say i have a field in the table called orderPrice, but i don't need any control on the form bound to that value. But i need that value in a calculation i do in my code. Because of my ignorance, i would just create a bound label to orderPrice, and then use orderPriceLabel.text in my code... That's pretty silly, but working. How would i retrieve the value properly Thanks!!! It needed to be: string myData = ds.Tables[0].Rows ...Show All
Visual Studio Team System Could not load type 'Microsoft.Web.Services.BridgeModule'.
I've included the ATLAS project files into my existing non-ATLAS project but since then I can't run the app as it comes up with the following Error: Could not load type 'Microsoft.Web.Services.BridgeModule'. Line 200: <httpModules> Line 201: <add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/> Line 202: <add name="BridgeModule" type="Microsoft.Web.Services.BridgeModule"/> Line 203: <add name="WebResourceCompression" type="Microsoft.Web.Services.WebResourceCompressionModule"/> Line 204: </httpModules> I've followed another thread on this and tried solution such as copying Atlas dll into the ..Program Files\Mic ...Show All
SQL Server Does Replication Use Compression?
Does SQL Server replication impliment any kind of compression It seems to me that this would be very helpful for congested WAN links and costly merge replication. Hi Joshua, Here is a direct quote from book online http://msdn2.microsoft.com/en-us/library/ms151740.aspx Does replication work over low bandwidth connections Does it use compression Yes, replication does work over low bandwidth connections. For connections over TCP/IP, it uses the compression provided by the protocol but does not provide additional compression . For Web synchronization connections over HTTPS, it uses the compression provided by the protocol and also additional compression of the XML files used to replicate changes. For more information about ...Show All
