|
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
|
|
|
|
|
Hi folks,
I currently have to interop to an old ActiveX control that requires the STA threading model. In order to get the control to work, I have to use STAThreadAttribute on the Main method of my desktop application, and set my ASP.NET application to be ASP compatible.
This has impact on the threading of the rest of the application which is undesirable (especially on the ASP.NET application).
Is there any way to load the ActiveX into a separate STA threaded AppDomain, and keep the main AppDomain MTA? I haven't been able to find any examples or explanations for this.
We need to have considerable interaction with the ActiveX control throughout the rest of our code, and I don't know the impact of cross-AppDomain calls on performance, but I can't test until I find out how to separate the AppDomains.
Any interop/threading guru's out there?
PS. We can't rewrite the Activex control as it is third party (and has been discontinued). It contains complex mathematical parsing that we need to maintain for backward compatability.
Dr Herbie
Remember, half the people out there have below average IQs.
|
|
|
|
|
Hi
I have a mdi form which opens another form inside the container.
there are menus available in both the forms.
when i load the child form in the mdi container the menus appear outside the form as a part of the mdi form menu
how can this happen??
i have checked up with all the names of the menus and their items.
but each is unique
pls help!!
Sukanya
|
|
|
|
|
ok, I have an app that I don't want to to have the blue bar across the top, but I need a way that the user can move the form. how is this done? (I want them to be able to click, hold, and drag anywhere on the form where another control is not covering it).
thanks in advance,
Stephen
|
|
|
|
|
You obviously need to capture the click event, and as the mouse is moved, move your window. In C++, it was ::SetWindowPos, if C# does not have an equivelant, you can just import that function into C#.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I do that in this article. All you need to look at is the form event handler code.
http://www.codeproject.com/dotnet/ABTransClockArticle.asp[^]
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
I have a reg. expression to search for strings between the "<" and ">" tags. but how do I change the color of all the matches to blue?
|
|
|
|
|
There are few different ways you can do this (as always), you could use the Regex.Split, go through and call Replace on all the matched values with your corresponding value (blue for you) and then use String.Join to put it all back together.
|
|
|
|
|