|
can any one tell me how to use a DLL made in VS C++ 6.0 to use in a VS C#.NET project. I tried adding one in my solution through referencing it in the C# project but it gave the error that "the DLL is not a valid .NET DLL"....any suggestions?
|
|
|
|
|
Is it a flat C/C++ dll or is it COM-based?
|
|
|
|
|
Its a simple C++ DLL, not a COM based. Infact it has all the working logic, and in the C# project i'm putting the user interface....any suggestions?
|
|
|
|
|
I would suggest you read into the P/Invoke (Platform Invocation Services) that are avaialbe in .NET. This[^] is a nice starter.
|
|
|
|
|
Thanks for your guidance Mr.Parker. Hope it helps
sitarooN se agay jehaaN aur bhee haiN....
|
|
|
|
|
Hi Nick
I try to use c code in c# project. I added c++ class Library and I created a library from c code. Then, I made a C# project and used its library (dll file) in it. It all works fine. But when I try to make memory allocation (malloc) in c code, it falling during executing. What can I do to make it run ?!
(I believe it all have a connection to project’s definitions)
Yossi
Ayallon valley
|
|
|
|
|
Post some of your code so we can look at it to see what's going on.
|
|
|
|
|
I'm writing a pocketpc program in C#. There is a treeview. But I find it hard to set a background image to the treeview. Does anybody know how to do it? Many thx.
|
|
|
|
|
I am trying to upload a file to a SharePoint server however it requires that it be an array of be an array of bytes. If I am uploading a document from my local NTFS partition, how do I access it as an array of bytes?
Cheers,
Jim
|
|
|
|
|
If hte document is a local file, why can't you use FileStream.Read?
<br />
FileStream fs = new FileInfo(localFileName).OpenRead();<br />
byte[] fileContent = new byte[fs.Length];<br />
fs.Read(fileContent, 0, fs.Length);<br />
fs.Close(); <br />
_________________________________
Vote '1' if you're too lazy for a discussion
|
|
|
|
|
Hi, Im new to this forum and pretty new to C#.
I am currently doing a computer science degree and creating a real-time application to allow a musical band to play together over an IP network (all in c#).
I am currently creating an RTP client but am struggling to find out how to generate a 32bit timestamp!
Please could someone point me in the right direction of how to go about this?
Thanks, Mat
|
|
|
|
|
Hi,
Please Help! My project is to write an application that allows the user to select a word document, copies the contents of the doc, and saves the info to the database. My problem is, if the document has a heater/footer my application won’t copy the info from the header/footer. Does anyone know how to access and copy the info from a header/footer? I'm very new at this and your help is very much appreciated.
Thanks
Reny5
|
|
|
|
|
It is located in the Document object I think. I didn't look too in depth, but have you looked at http://msdn.microsoft.com/library/en-us/odc_vsto2003_ta/html/WordObject.asp?frame=true#wordobject_link6
? That site should tell you where pretty much everything is.
If you need more help message me,
Jim
|
|
|
|
|
I have it working. Thanks for pointing me in the right direction
|
|
|
|
|
I have been looking for a graphing component. I have found a few, but was wondering if anyone used and was happy with a particular one. A grid would be used to plot points on the graph. Perhaps a component with grid built in would be nice as well.
Thanks in advance.
|
|
|
|
|
|
Hi,
I have created a windows installer using Visual Studio 2003 and it works fine but what I really want to do is make it launch the application each time windows starts up.
I don't want to use the startup folder in the start menu if I can help it as I know there is a way to add it to the registry, I just cant find a way to do it.
Any help would be much appreciated
Mike
|
|
|
|
|
|
Yup, thats exactly what I want, cheers.
one more thing though, how do I add the entry to the registry without knowing the install path of the target machine?
Cheers
Mike
|
|
|
|
|
Well, I sorted that out using the value of the reg key as [ProgramFilesFolder][Manufacturer]\[ProductName]\App.exe
This points to the right folder and the app works fine normally, but when it trys to launch on startup the Just-in-Time debugger window pops up saying there is a System.IO.DirectoryNotFound exception.
It seems to be looking in C:\Documents and Settings\Mike_Godber\img\Icon.ico for an icon that uses the relative path img\Icon.ico in my code. Not sure why it looks in that folder though as it should be C:\Program files\...\img\Icon.ico.
When I launch the app from Run using the same path as in the registry the app runs fine.
Any ideas why?
Mike
|
|
|
|
|
Oh, and I have just noticed that I haven't sorted the initial problem out. I still need a way to enter the reg key based on what ever directory the user chooses to install to, but I don't know how to get this value.
|
|
|
|
|
I have a windows service and I am trying to instantiate an instance of MAPI:
MAPI.SessionClass objSession = new SessionClass();
// Logon to the Exchange Server using Internet Mail method and profile
objSession.Logon("****", "****", false, false, 0, true, "****";
objFolder = (MAPI.Folder) objSession.Inbox;
objMessageList = (MAPI.Messages) objFolder.Messages;
//Set filter to get all unread mail
objFilter = (MAPI.MessageFilter) objMessageList.Filter;
objFilter.Unread = true;
objMessage = (MAPI.Message) objMessageList.GetFirst(objFilter);
However, when I look at the debugger during execution, the instantiation of the class does not seem to be working. All of the values only hold
"Session <error: an="" exception="" of="" type:="" {system.runtime.interopservices.comexception}="" occurred=""> System.Object"
I think this has to do with the threading apartment because the service is in MTA but the COM object possibly has to be in STA?
Suggestions would be really appreciated!
~Jim
|
|
|
|
|
The instantiation is okay, CDO returns all values only as System.Object.
Esmo2000 wrote:
objSession.Logon("****", "****", false, false, 0, true, "****";
Why do you pass Accountname/Passwort and profile info?
Esmo2000 wrote:
because the service is in MTA but the COM object possibly has to be in STA?
The first method call after Logon should work in both modes. For everything else, I would expect CDO to fail, because your identity gets lost with MTA.
When using MAPI in a service, make sure you are running STA and don't use .NET remoting. MAPI/CDO and .NET remoting are not compatible.
_________________________________
Vote '1' if you're too lazy for a discussion
|
|
|
|
|
Corinna John wrote:
The instantiation is okay, CDO returns all values only as System.Object.
Sorry, objects were not being stored as System.Object, they were saying exceptions had occurred (I guess when the debugger attempted to access the code).
Esmo2000 wrote:
objSession.Logon("****", "****", false, false, 0, true, "****";
Why do you pass Accountname/Passwort and profile info?
* That is what the object requires when it is instantiated? for that matter, it doesn't seem to like
objSession.Logon("myusername", "PASS", false, false, 0, true, "exchange.server.com/myusername");
is having any impact. Its calling it an "invalid argument"
Esmo2000 wrote:
because the service is in MTA but the COM object possibly has to be in STA?
The first method call after Logon should work in both modes. For everything else, I would expect CDO to fail, because your identity gets lost with MTA.
When using MAPI in a service, make sure you are running STA and don't use .NET remoting. MAPI/CDO and .NET remoting are not compatible.
Hrm, that would make sense. Regardless, I will need to send mails from this service, so how is that possible? Surely there must be a workaround?
Thanks for such a thorough response!
|
|
|
|
|
There are two possible combinations for Logon.
1. Use this one, if there is a profile configured locally for the account
session.Logon(name, password, false, true, 0, false, Missing.Value);
2. Use this one for a dynamic profile, if there is no local Outlook profile configured for this account:
session.Logon(Missing.Value, Missing.Value, false, true, 0, false, "serverName\raccountName");
The second call takes only server name and account name. It uses the service's current impersonation for authentication, so the service have to run with the mailbox owner's account (or impersonate it before logon, and undo impersonation after logon).
I don't know of any workaround for the MTA issue, but CDO works alright, if you don't use .NET remoting. You could open a socket and wait for requests from the client application. Serialize the mail content through the socket, and then send the mails.
You'll need the following classes:
- System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- System.Net.Sockets.Socket
- your own mail content structure
Client:
1. fill a mail content structure
2. open a client socket
3. serialize the mail content through the socket
4. wait for success response
Service:
1. open a server socket
2. listen for incoming connections
3. accept connection
4. deserialize mail content
5. send mail (CDO)
6. send response (socket)
7. back to 2.
_________________________________
Vote '1' if you're too lazy for a discussion
|
|
|
|