.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Properties from unmanged code

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :.NET Framework
 

Hi All,

I've stumbled upon the following, i am building an 3d editor, where most of the code/engine is written in unmanaged c++. Now we are building the frontend( GUI ) in the .net( managed ) language. Everything works fine, except for emitting properties. Basically what we want is that variables created in unmanaged code can be edited inside a propertygrid.

So my guess is to write a wrapper that handles dynamically sized properties, but i have no idea where to start any pointers( pun intended ) are welcome

 

Paul

 

 

 

 




View Complete Post


More Related Resource Links

using unmanged code in .net, can you help??

  
unmanged: //testDll.h #define MODEL_PROXY __declspec(dllexport) class MODEL_PROXY Student { public: Student(char * name,int score); char* name; int score; void PrintInfo(); }; // dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" #include "stdio.h" #include "testDll.h" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } // This is the constructor of a class that has been exported. // see geob.h for the class definition Student::Student(char * name,int score) { this->name=name; this->score=score; } void Student::PrintInfo() { printf("%s%d",this->name,this->score); }  I first used dumpbin.exe to get the decorated function names, then here is how I call it within manged code (c#): using System.IO; using System.Data; using System.Runtime.InteropServices; using System.Text; namespace studentUM { public struct StudentUM { [DllImport("testDll.dll", EntryPoint = "??0Student@@QAE@PADH@Z", CallingConvention = CallingConvention.ThisCall)] public extern s

Changing Properties/Attributes of a Webpart in inline code block - Error 'System.Web.UI.WebControl

  
I'm trying this code below, but gettting error: System.Web.UI.WebControls.WebParts.WebPart' does not contain a definition for 'FilterValue1' I need to change the value of the FilterValue1 properties of a content Query WebPart with title = Applicant Files. Thanks in Advance!
protected override void OnLoad(EventArgs e) {  base.OnLoad(e); SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite SiteCollection = new SPSite("https://somesite/")) { SPWeb myWeb = SiteCollection.OpenWeb(); myWeb.AllowUnsafeUpdates = true; Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = null; mgr = myWeb.GetLimitedWebPartManager("default.aspx",System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); foreach (System.Web.UI.WebControls.WebParts.WebPart myWebPart in mgr.WebParts) { if (myWebPart.Title == "Applicant Files") { myWebPart.FilterValue1 = "/13"; mgr.SaveChanges(myWebPart); break; } } } }); }

RDL rename breaks all references to expressions and report properties code in BIDS

  
I have done a 'save as' in BIDS and changed the name of the file from ordreqn-lab.rdl to ordreqn-ptheader-per-order.rdl.  The report has custom code in the report properties and expressions that are based on that code.  After renaming this report I get 100 errors all rsFieldReference errors basically saying the expressions and fields are not referring to the current dataset. Version info: SQL 2008 R2. Any assistance would be greatly appreciated. I did notice there is another rename bug.  Is this a bug also and if so what is the status of a fix. Please let me know if I can provide further information. I don't see a place to attach the rdl. http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/564f5031-e832-4666-ab52-29391b74b955/

How does web part stores its properties when a piece of code is executed in it?

  

Greetings

I am trying to program my first webpart based on this:

http://www.codeproject.com/KB/sharepoint/SharepointContactForm.aspx

This webpart must show people who have birthdays on particular day of the month. There should be a button for each month (and one for "whole year) and button for each day (and one for "whole month") and so user can choose to show only those with birthdays in say, april 23, or whole june...

I did it this way:

Following the tutorial, i create all my controls inside the CreateChildControls() and i store references to them as properties of the webpart class. Also the class (public class BirthdayFullScreenWebPart) has properties (int chosen_month) and (int chosen_day).

Then i have have onclick for buttons that changes the chosen month and/or day web part property, based on which button was clicked.

Then i have a function "UpdateUserList" that ouptuts list of users into the webpart's table control, based on the chosen month and day. this function is called inside createchidlcontrols after all of them are created, and inside onclicks when the month/day is changed.

 

What i got is that the values of the variables were behaving really odd. 

In my mind, it

No "Edit Form Code" in Button Properties box.

  

Using InfoPath 2007. VSTA is installed. Also have VS 2008.

Want to test button onClick, but when I double click but in form design, I don't have the "Edit Form Code" button.

ALT-SHT-F12 opens VSTA, but no code automatically added for the onCLick event like it would be with Edit Form Code button.

Any suggestions or explanation why I can't see it?


Accessing solution properties in code at design time

  

Hello all,

We have a project working with WCF embedded in a WindowsService. To facilitate testing, we have a Client Form and a Host Form. This project has multiple WCF services so we have 4 ClientForms and 4 HostForms. We are using multiple start up projects in the solution which is accessed by right clicking the Solution file at design time and selecting multiple clients and hosts. I would like to put that functionality on a form to allow dynamic switching (eg a series of check boxes for Client1, Host1, Client3, Host3, etc).

I'm guessing this pertains to using EVNDTE but I have not used that very much recently. Can this be done fairly easily, and if so, would someone be kind enough to post some code to get me started? Thanks in advance for any ideas and / or suggestions!


Have a great day!

User Controls : load and access properties from code behind

  

Hello,

I created a User Control :


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UCSousMenuPrincipal.ascx.cs"
    Inherits="view_usercontrols_UCSousMenuPrincipal" %>
    
<asp:DataList ID="dataListSousMenuPrincipal" runat="server" RepeatDirection="Horizontal" >
    <ItemTemplate>
        <asp:HyperLink ID="HyperLink1" runat="server"><%# Container.DataItem %></asp:HyperLink>
         
    </ItemTemplate>
</asp:DataList>


to which I added a property, so I can bind the DataList :


using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

public partial class view_usercontrols_UCSousMenuPrincipal : System.Web.UI.UserControl
{
    //Private Member    
    private object dataSource = null;
   
    protected void Page_Load(object sender, EventArgs e)
  &

Profile object /profile properties are not accessible in code behind

  

i have defined profile properties in my web config file but unable to access them in code behind. even profile object is not available. i have to writer fully qualified name like System.Web.Profile.

below is my web config

<profile>
      <properties>
        <add name="PropertyID" type="Int32" defaultValue="12" allowAnonymous="true" />
        <group name="myGroup">
          <add name="GID" allowAnonymous="true" />

How to increase MaxBytesPerRead and related properties in code

  

Hi,

I am hosting a WCF Webservice using WebServiceHost2 class (see http://msdn.microsoft.com/en-us/library/ee391967.aspx for REST Starter kit) from a window service. Some thing like

protected

 

override void OnStart(string[] args)

{

var host = new WebServiceHost2(typeof(...), true, new Uri(...))

var binding = new WebHttpBinding(WebHttpSecurityMode.TransportCredentialOnly);


binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;


host.AddServiceEndpoint(typeof(..), binding, string.Empty);

}

<

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

  
When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

  
You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

  
Free C# Code Snippets

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

WCF Tip: Using Properties in Service Contracts

  
you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Microsoft StyleCop: Source Code Analyzer for C#

  
StyleCop is similar in many ways to Microsoft Code Analysis (specifically FxCop), but there are some important distinctions. FxCop performs its analysis on compiled binaries, while StyleCop analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while StyleCop focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop.

Automatic vs Explicit Properties

  
If the reason that motivated the change from automatically implemented property to explicitly implemented property was to change the semantics of the property then you should evaluate whether the desired semantics when accessing the property from within the class are identical to or different from the desired semantics when accessing the property from outside the class.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend