Hi, I have coded few methods in C++ language. These methods are to be used in C#.NET . I guess I need to convert the .CPP file(C++ code) into DLL and then import the methods in C#. I made a Win32 project and converted the exe(C++ code) into unmanaged C++ DLL. Then I tried to call its method in C#.NET as : using System.Runtime.InteropServices; public partial class CDLL : System.Web.UI.Page { [DllImport("C:\\Project1\\TestProject\\Debug\\TestProject.dll", EntryPoint = "testMethod", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern void testMethod(); protected void Page_Load(object sender, EventArgs e) { testMethod(); } } After running the above code i am getting error like : Unable to find an entry point named 'testMethod' in DLL 'C:\Project1\TestProject\Debug\TestProject.dll'. Can any one suggest how to run the above code successfully. Thanks.
Pranav Thakur
Posts
-
How to call unmanaged C++ DLL in C#.NET -
AjaxControlToolkit.dll in .NET 3.5 MVC application.Hi, I am trying to use AjaxControlToolKit in .NET 3.5 MVC application but I am getting the error:- Could not load file or assembly 'AjaxControlToolkit.dll' or one of its dependencies. The system cannot find the file specified Following are the steps I performed:- 1)Added AjaxControlToolKit dll in bin folder 2)In aspx page <%@ Register Assembly="AjaxControlToolkit.dll" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>; Same code is running fine in .NET 3.5 if I don't go for MVC architecture. Please suggest some idea. Thanks.
-
SSIS packageHi, I have successfully implemented insert/update logic in my SSIS pacakge. If a new project id is found in the source file then I insert a new row in the database table. If an existing project id is found then I update the corresponding row in the table. The above logic work fine but not in case if there is multiple identical project ids in the source file. The update logic fails in this case. I though of deleting and then inserting the rows for update logic but could not do so. Can anyone help. I am using lookup control and contional split control for identifing the existence of a new row or existing row.
-
Set FocusI am using a footer of a datagrid to add a row. After adding I want to set the focus on the first control of the footer.How can I achieve this.The following code is not working: protected void gdViewCompliance_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Add") { Some code here ((TextBox)e.Item.FindControl("txtFtExeName")).Focus() } }
-
select values from a table dyunamically in Stored procedureHi, I have created a "test" table having 4 column Q1,Q2,Q3 and Q4 with values one,two,three,and four respectively. Please refer the code below:- Declare @loopId int set @loopId=1 Declare @vr varchar(100) declare @variable varchar(100) while @loopId<=4 begin set @vr='Q'+''+Convert(varchar,@loopId)+'' Select @variable=@vr from test print(@variable ) set @loopId=@loopId+1 end In the above code I am printing the values of each column of table "test" one by one.But the out put of the above code is Q1 Q2 Q3 Q4 but i want to have the values not column name.This is a sample code which I will be using in one of my stored proc.What wrong I am doing.Please help.
-
document.getElementById("") javascript ASP.NET.i declared a global variable like this: string ddl=""; then in page load i wrote the following line: ddl = ddlCountry.ClientID; now in javascript i write like : var DrpDwn = document.getElementById("ddl"); alert(DrpDwn). Above is code is not working.What is wrong I am doing.Remember ddlCountry is inside wizard control.
-
document.getElementById("") javascript ASP.NET.Hi, I want to getElementById of a control which is inside a Wizard control in ASP.NET 2.0. My code is like : var ddl=document.getElementById("ddlCountry"); if my ddlCountry is inside a Wizard control then how I will get the control by getElementById("").The above code works fine if ddlCountry is not inside wizard control.If it is inside wizard control then the above code does not work.
-
single instance of a Web applicaiton.Hi, I am working on web applicaiton. I have uploaded the application on server but I want only one person can access the applicaiton at a time. In other words I want only a single instance of my applicaiton running at a time.Remember I am on web applicaiton not window applicaiton.
-
single instance of an application using Application start in global.asax.Hi, Can any one suggest me how to maitain a single instace of an application using Application start method of Global.asax.
-
Saving User Name And Password.Thanks for your reply. Actually I want to know other better ways to save username and password without using cookies.Please help.
-
Saving User Name And Password.Hi, I have written a code to save username and password on client machien using cookie.The code is as follows:- HttpCookie loginCookie = new HttpCookie("logCoockie"); if (this.Login1.RememberMeSet) { //Check if the browser support cookies if ((Request.Browser.Cookies)) { //Check if the cookie with name LoginCookie exist on user's machine //if (loginCookie == null) //{ //Create a cookie with expiry of 30 days loginCookie.Expires = DateTime.Now.AddDays(30); //Write username to the cookie loginCookie.Values.Add("UNAME", this.Login1.UserName.ToString()); //Write password to the cookie loginCookie.Values.Add("UPASS", this.Login1.Password.ToString()); //} //If the cookie already exist then wirte the user name and password on the cookie //else //{ // loginCookie.Values.Add("UNAME",this.Login1.UserName.ToString()); // loginCookie.Values.Add("UPASS",this.Login1.Password.ToString()); //} } Response.Cookies.Add(loginCookie); } else { Response.Cookies["logCoockie"].Expires = DateTime.Now.AddDays(-3); } But it is not recommended to save such information in cookie.Can anyone help to use any alternative way to save such inforamtion. Thanks.
-
Login Control in Visual Studio 2005I have written some code.But its incompleate. Please explain me in detail how to go ahead from here. protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (this.Login1.RememberMeSet) { //Check if the browser support cookies if ((Request.Browser.Cookies)) { //Check if the cookie with name PBLOGIN exist on user's machine if ((Request.Cookies["PBLOGIN"] == null)) { //Create a cookie with expiry of 30 days Response.Cookies["PBLOGIN"].Expires = DateTime.Now.AddDays(30); //Write username to the cookie Response.Cookies["PBLOGIN"].Values["UNAME"] = this.Login1.UserName.ToString(); //Write password to the cookie Response.Cookies["PBLOGIN"].Values["UPASS"] = this.Login1.Password.ToString(); } //If the cookie already exist then wirte the user name and password on the cookie else { Response.Cookies["PBLOGIN"].Values["UNAME"] = this.Login1.UserName.ToString(); Response.Cookies["PBLOGIN"].Values["UPASS"] = this.Login1.Password.ToString(); } } } }
-
Login Control in Visual Studio 2005Hi, Please any one explain me in detail how can I make use of "Remember me next time" option for Login Control. Thanks.
-
Singleton PatternOk, my purpose was to understand singleton pattern with some live example.Can anyone please explain this singleton pattern with suitable example.
-
Singleton PatternHi, I want to open only one PDF file using singleton pattern.I have written a code as follows on button click event:- FileInfo objFile; string strFileName; strFileName = "User Manual - Quality Feedback System.pdf"; objFile = new FileInfo(Server.MapPath(ConfigurationSettings.AppSettings["App_Name"]) + "\\" + strFileName); Response.Clear(); Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + objFile.Name); Response.Flush(); Response.WriteFile(objFile.FullName); Response.End(); The problem with the above code is that it opens more than one PDF file if button is clicked more than once.How can I make sure that one PDF file gets opened using Singleton design pattern.I am clear with the concept of singleton pattern but I am not able to implement this concept in my problem.Please help.