|
mee wrote:
The error message "Access is denied" is show when i using the ASP.NET to call the component.
ASP.NET runs in its own user ID ("ASPNET"), so that user must be given permission to access your file.
Paul
I think there're pieces of me you've never seen - Tori Amos, Tear in Your Hand
|
|
|
|
|
Hi Paul ,
Thanks for your reply, i have already given permission to ASPNET user , IIS user [IUSR_Machinename] and everyone with Full control on the excel file.
The error on browser actually highligt the following line (this line actualy program in the C# component).
ExcelObj = new Excel.Application();
Is it possible because ASPNET user do not have access to any of the excel library file . Anyway i also try to set the EXCEL9.OLB permission to the ASPNET user. It still giving the same error.
Regards
LSL
|
|
|
|
|
I have a C# application that calls functions on a MFC COM dll. I can easily debug my C# code, but I can't seem to be able to step into the MFC code. Did anybody try this?
Thanks
|
|
|
|
|
Have you tried to add a DebugBreak() statement in your MFC code. Actually when the .NET virtual machine leaves his context to execute unsafe code, I believe it is up to you to manage to catch up.
How low can you go ? (MS rant)
|
|
|
|
|
True, it does start VC6, but it throws me in disassembly. I can't actually step into the MFC code.
|
|
|
|
|
Are you using the debug version of the COM DLL?
Paul
I think there're pieces of me you've never seen - Tori Amos, Tear in Your Hand
|
|
|
|
|
Anonymous wrote:
True, it does start VC6, but it throws me in disassembly.
That's what DebugBreak() usually does, even in a simple WIN32 only environment. Use the debugger callstack.
How low can you go ? (MS rant)
|
|
|
|
|
Have you tried to turn on the option to debug unmanged DLLs? Select your project in Solution Explorer. Right-click, select Properties, select Common Configuration Properties, Debugging, then Enable Unmanaged Debugging. The default is False. Set it to True.
Gaul C. Ihenacho
|
|
|
|
|
Is there a way that I compile a C# project as unmanaged?
Thanks
|
|
|
|
|
C# by its very nature is always managed. It can use unmanaged code through the Interop Services. If you need to do this, you could stub unmanaged code through a C# implemented Facade Design Pattern[^]
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
Is this possible? I'm using Visual Studio Enterprise Edition and I do have Visio 2002 installed here as well. I know how to use UML to create the diagrams, I just don't know where the code generation feature is...
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
menu->
"UML"
then
"CODE"
then
->"Generate"
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
hello
i need help on how to convert xsl:fo or xml document to pdf using c sharp
i BADLY need that.
Asim
|
|
|
|
|
|
Try changing the procedure to:
CREATE PROCEDURE Get
@ID PK_SMALLINT = NULL
Select * from Table
where ( (@ID IS NULL) or (ID = @ID) )
|
|
|
|
|
I try to subclass a window using WinAPI but I get a problem on the function declaration in DLLImport. Please help me if you can. Thanks anyway.
|
|
|
|
|
MSFT Eric Gunnerson article on win32 interop[^].
You should also post the exact function names you are trying to interop.
How low can you go ? (MS rant)
|
|
|
|
|
Hi there,
here is my problem: i need a certain class to be used in a webmethod an a client. In order to do so i made a little library called ChatLib containing the class ChatMsg. Both, webservice and client, have the line "using Chatlib;", but the proxy (which is generated by the Visual Studio) seems to do something different.
The Compiler tells me that he is not able to convert 'chatclient02.localhost.ChatMsg' to 'ChatLib.ChatMsg' (referring to a line in the windows form, where i want to start the webmethod).
(in german: "Implizite Konvertierung des Typs 'chatclient02.localhost.ChatMsg' zu 'ChatLib.ChatMsg' nicht möglich.")
exchanging the line "using Chatlib;" by "using chatclient02.localhost;" in the client makes the compiler happy but the program does not run properly which means that there are system exceptions thrown.
i would be grateful for every answer especially those, that support the usage of Visual Studio.NET
PS: I already posted this one on another board, which was probably the wrong address. If this is true for this board, too, i might be happy getting an answer such as: "this is the wrong board, try this: ...".
|
|
|
|
|
I guess you would have someone to answer you if you made your code available somewhere.
How low can you go ? (MS rant)
|
|
|
|
|
here you are, this is the library:
<br />
using System;<br />
<br />
namespace ChatLib<br />
{<br />
public class ChatMsg<br />
{<br />
public string content;<br />
public long authorid;<br />
public long messageid;<br />
<br />
public ChatMsg()<br />
{<br />
this.content = "";<br />
this.messageid = 0;<br />
this.authorid = 0;<br />
}<br />
public ChatMsg(string msg)<br />
{<br />
this.content = msg;<br />
this.messageid = 0;<br />
this.authorid = 0;<br />
}<br />
public ChatMsg(string msg, long number)<br />
{<br />
this.content = msg;<br />
this.messageid = number;<br />
this.authorid = 0;<br />
}<br />
public ChatMsg(string msg, long number, long id)<br />
{<br />
this.content = msg;<br />
this.messageid = number;<br />
this.authorid = id;<br />
}<br />
}<br />
<br />
}
this is the webservice:
<br />
using System;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Diagnostics;<br />
using System.Web;<br />
using System.Web.Services;<br />
using ChatLib;<br />
<br />
<br />
namespace chatserver02<br />
{<br />
public class Service1 : System.Web.Services.WebService<br />
{<br />
<br />
private const int buffersize = 5;<br />
private static ChatMsg[] msgbuffer = new ChatMsg[buffersize];<br />
private static long lastid = 0;<br />
private static int lastpos = 0;<br />
<br />
private ChatMsg MsgNum(int pos)<br />
{<br />
if(pos >= buffersize)<br />
{<br />
ChatMsg nullmsg = new ChatMsg("", -1);<br />
return nullmsg;<br />
}<br />
int realpos = 0;<br />
realpos = (lastpos - pos)%buffersize;<br />
return msgbuffer[realpos];<br />
}<br />
<br />
public Service1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
#region Component Designer generated code<br />
<br />
private IContainer components = null;<br />
<br />
private void InitializeComponent()<br />
{<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if(disposing && components != null)<br />
{<br />
components.Dispose();<br />
}<br />
base.Dispose(disposing); <br />
}<br />
<br />
#endregion<br />
<br />
<br />
[WebMethod]<br />
public ChatMsg Horch(long lastmsg)<br />
{<br />
<br />
<br />
<br />
if(lastmsg < (lastid - buffersize))<br />
{<br />
lastmsg = lastid - buffersize;<br />
}<br />
<br />
ChatMsg returnmsg = new ChatMsg("", lastid);<br />
<br />
if(lastmsg < lastid)<br />
{<br />
while(lastmsg < lastid)<br />
{<br />
returnmsg.content = returnmsg.content + MsgNum((int)lastid - (int)lastmsg).content;<br />
lastmsg ++;<br />
}<br />
return returnmsg;<br />
}<br />
else<br />
{<br />
return new ChatMsg("", lastid);<br />
} <br />
}<br />
<br />
[WebMethod]<br />
public int Verkuend(string text)<br />
{<br />
lastid = lastid + 1;<br />
ChatMsg newmsg = new ChatMsg(text, lastid);<br />
newmsg.content = newmsg.content + "\n\n";<br />
lastpos = (lastpos + 1)%buffersize;<br />
msgbuffer[lastpos] = newmsg;<br />
return 0;<br />
}<br />
}<br />
}<br />
and this is the client:
<br />
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
using ChatLib;<br />
<br />
namespace chatclient02<br />
{<br />
public class Form1 : System.Windows.Forms.Form<br />
{<br />
public static Form1 me;<br />
<br />
private long mylastmsg = 0;<br />
<br />
private System.Windows.Forms.TextBox inbox;<br />
private System.Windows.Forms.Button sendbutton;<br />
private System.Windows.Forms.TextBox outbox;<br />
private System.Windows.Forms.Button startbutton;<br />
private System.Windows.Forms.StatusBar feedbackbar;<br />
private System.ComponentModel.Container components = null;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if( disposing )<br />
{<br />
if (components != null) <br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
<br />
private void sendbutton_Click(object sender, System.EventArgs e)<br />
{<br />
localhost.Service1 pf = new localhost.Service1();<br />
<br />
AsyncCallback cb = new AsyncCallback(Form1.donothing);<br />
<br />
IAsyncResult ar = pf.BeginVerkuend(inbox.Text, cb, pf);<br />
<br />
<br />
<br />
<br />
inbox.Text = "";<br />
inbox.Focus();<br />
<br />
feedbackbar.Text = "sende botschaft...";<br />
}<br />
<br />
public static void donothing(IAsyncResult ar)<br />
{<br />
localhost.Service1 pf = (localhost.Service1) ar.AsyncState;<br />
me.feedbackbar.Text = "botschaft gesendet";<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
private void InitializeComponent()<br />
{<br />
this.inbox = new System.Windows.Forms.TextBox();<br />
this.sendbutton = new System.Windows.Forms.Button();<br />
this.outbox = new System.Windows.Forms.TextBox();<br />
this.startbutton = new System.Windows.Forms.Button();<br />
this.feedbackbar = new System.Windows.Forms.StatusBar();<br />
this.SuspendLayout();<br />
this.inbox.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) <br />
| System.Windows.Forms.AnchorStyles.Right);<br />
this.inbox.Location = new System.Drawing.Point(0, 152);<br />
this.inbox.Multiline = true;<br />
this.inbox.Name = "inbox";<br />
this.inbox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;<br />
this.inbox.Size = new System.Drawing.Size(288, 48);<br />
this.inbox.TabIndex = 0;<br />
this.inbox.Text = "";<br />
this.sendbutton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);<br />
this.sendbutton.Location = new System.Drawing.Point(144, 200);<br />
this.sendbutton.Name = "sendbutton";<br />
this.sendbutton.Size = new System.Drawing.Size(144, 32);<br />
this.sendbutton.TabIndex = 1;<br />
this.sendbutton.Text = "send";<br />
this.sendbutton.Click += new System.EventHandler(this.sendbutton_Click);<br />
this.outbox.AcceptsReturn = true;<br />
this.outbox.AllowDrop = true;<br />
this.outbox.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) <br />
| System.Windows.Forms.AnchorStyles.Left) <br />
| System.Windows.Forms.AnchorStyles.Right);<br />
this.outbox.BackColor = System.Drawing.SystemColors.Window;<br />
this.outbox.Multiline = true;<br />
this.outbox.Name = "outbox";<br />
this.outbox.ReadOnly = true;<br />
this.outbox.RightToLeft = System.Windows.Forms.RightToLeft.No;<br />
this.outbox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;<br />
this.outbox.Size = new System.Drawing.Size(288, 152);<br />
this.outbox.TabIndex = 2;<br />
this.outbox.Text = "";<br />
this.startbutton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);<br />
this.startbutton.Location = new System.Drawing.Point(0, 200);<br />
this.startbutton.Name = "startbutton";<br />
this.startbutton.Size = new System.Drawing.Size(144, 32);<br />
this.startbutton.TabIndex = 3;<br />
this.startbutton.Text = "start session";<br />
this.startbutton.Click += new System.EventHandler(this.startbutton_Click);<br />
this.feedbackbar.Location = new System.Drawing.Point(0, 238);<br />
this.feedbackbar.Name = "feedbackbar";<br />
this.feedbackbar.Size = new System.Drawing.Size(288, 16);<br />
this.feedbackbar.TabIndex = 4;<br />
this.feedbackbar.Text = "...";<br />
this.AcceptButton = this.sendbutton;<br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
this.ClientSize = new System.Drawing.Size(288, 254);<br />
this.Controls.AddRange(new System.Windows.Forms.Control[] {<br />
this.feedbackbar,<br />
this.startbutton,<br />
this.outbox,<br />
this.sendbutton,<br />
this.inbox});<br />
this.MinimizeBox = false;<br />
this.Name = "Form1";<br />
this.Text = "Form1";<br />
this.ResumeLayout(false);<br />
<br />
}<br />
#endregion<br />
<br />
[STAThread]<br />
static void Main() <br />
{<br />
me = new Form1();<br />
Application.Run(me);<br />
}<br />
<br />
private void startbutton_Click(object sender, System.EventArgs e)<br />
{<br />
localhost.Service1 pf = new localhost.Service1();<br />
<br />
AsyncCallback cb = new AsyncCallback(Form1.incomming);<br />
<br />
IAsyncResult ar = pf.BeginHorch(mylastmsg, cb, pf);<br />
<br />
feedbackbar.Text = "erwarte daten von " + ar.ToString();<br />
}<br />
<br />
public static void incomming(IAsyncResult ar)<br />
{<br />
localhost.Service1 pf = (localhost.Service1) ar.AsyncState;<br />
ChatMsg ergebnis = pf.EndHorch(ar);<br />
<br />
<br />
if(me.mylastmsg != ergebnis.messageid)<br />
{<br />
me.feedbackbar.Text = "habe daten empfangen";<br />
me.mylastmsg = ergebnis.messageid;<br />
me.outbox.AppendText(ergebnis.content.Replace("\n","\r\n"));<br />
}<br />
<br />
me.feedbackbar.Text = "erwarte daten...";<br />
<br />
System.Timers.Timer aTimer = new System.Timers.Timer();<br />
aTimer.Elapsed+= new System.Timers.ElapsedEventHandler(OnTimedEvent);<br />
aTimer.Interval = 250;<br />
aTimer.AutoReset = false;<br />
aTimer.Enabled = true;<br />
}<br />
<br />
public static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)<br />
{<br />
localhost.Service1 pf = new localhost.Service1();<br />
AsyncCallback cb = new AsyncCallback(Form1.incomming);<br />
<br />
IAsyncResult arn = pf.BeginHorch(me.mylastmsg, cb, pf);<br />
}<br />
}<br />
}<br />
hope this might help...
PS: the code is a bit messy i guess, parts of it are from the VS help, anyway, the compiler has its problem with this line, where i want to start the webmethod:
IAsyncResult ar = pf.BeginHorch(mylastmsg, cb, pf);<br />
|
|
|
|
|
I found a solution when i made a little exsample application concentrating on this whole using library business (for a prof who did not quite understand my problem):
It turns out to run properly when i refer to ChatMsg as localhost.ChatMsg (i think it's the namespace of the proxy) not using or refering any ChatLib in the client. This might not have worked for the original purpose because of the messy code, i have to tidy it up i guess
Greetings and sorry for the code
|
|
|
|
|
Hi! I've been working with C# for a while now but have hit a few snags...I would sure like info about the following things:
1. Hardware and C#
2. Accessing hardware serial numbers in C#
3. Computer System Hardware Classes and C#
4. Accessing Win32_BIOS - Win32_DiskDrive functions in C#
5. How to get a list of functions contained in a DLL file
Any help would be appreciated and thanks for the time spent on answering this beforehand...
Fahad
<fahad_khalil@msn.com>
|
|
|
|
|
For anything Win32 related you should go to MSDN[^] and check out Eric Gunnerson's latest article. He has a really good explanation of how to do Win32 stuff from C#.
As for the hardware related issues...I don't think you can do that in C#. I believe you would have to use, again, the Win32 API. However, you may not even be able to do that(You might have to go all the way down to Assembler).
And lastly, as for the DLL. You can use the System.Reflection.Assembly class to load a DLL and examine it's properties and methods. Even if it's a COM DLL, then .NET will create a wrapper for you and you'll be able to see the info that you want.
Hope this helps.
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
|
|
|
|
|