|
What do you exactly mean by "the test application can't see the application running"?
SkyWalker
|
|
|
|
|
To 'plug-in' to our main application, we use a dll that will call CreateObject after which we can use some functions to manipulate our main app. CreateObject will start a new application if it wasn't already running but will use the running application if it was (already running).
This works and has been tested in many of our applications.
Know we have to manipulate our application when a "packet" is arrived. (it's a message with some data attached). I'm able to discover this packet, analyze it and call a Process.Start("MyTestApp.exe", "myargument"); (this is done by the service)
For some reason, the testapp manipulates the main app correctly when called as exe, but calls up a new instance when run from the service...
hence the testapp doesn't "see" the main app running.
(PS: yep I've tried a GetObject too, but somehow that crashes.)
we're getting there . (it's always difficult to explain these things, thanks for the patience)
|
|
|
|
|
If your app is a Windows Forms app, which actually supports only the single-thread apartment (STA) model, you must ensure that the thread handling the events, and the thread that created the Windows Forms control you want to update (or to be aware of something out there) coincide. This is not necessarily true by default and can lead to anomalies or even exceptions.
Another point would be for you to check if the arguments are passed correctly (maybe you need there a full path for some filenames passed as arguments).
Maybe this helped you a little bit.
SkyWalker
|
|
|
|
|
Mircea Puiu wrote: If your app is a Windows Forms app, which actually supports only the single-thread apartment (STA) model, you must ensure that the thread handling the events, and the thread that created the Windows Forms control you want to update (or to be aware of something out there) coincide. This is not necessarily true by default and can lead to anomalies or even exceptions.
I was looking into something like this but couldn't find it.
main app is VC6.0, the service and the testapp .Net 2.0.
Reading this my guess is I should look into the apartment state or something? Well at least it's a start (I had no clue at where to start looking)
Mircea Puiu wrote: Another point would be for you to check if the arguments are passed correctly (maybe you need there a full path for some filenames passed as arguments).
these are definitely correct .
Many thanks!
|
|
|
|
|
Have a look here[^], at CP
SkyWalker
|
|
|
|
|
|
How to display an array list of objects in a combo box?
|
|
|
|
|
Set the list to be the datasource, and set the dataitem and displayitem ( from memory ) properties so it knows what field to display.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi,
Please help me to solve this issue.
I am looking for a listview with 2 checkbox in the last column.
|
|
|
|
|
|
hi all,
i have 2 action which are using the same method-methodA,sometime the methodA will access by both of the action at the same time.But,it will promp out a message said, "This method cannot be access,because it is using by other action".My question is how can i make the method run the acction in order?
any hits are welcome,
thanks in advance,
cocoonwls
note: i have create my own user control which control by timer,so sometime,they will access a same method at the same time
|
|
|
|
|
If you use a timer control instead of a thread timer, the actions will run in the main thread instead.
If you need threading, use the lock keyword for code that you have to make thread safe.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi Guffa,
I am trying use Thread Timers,but what should i declare for, Syste.Threading.Timer or System.Timers.Timer?
thanks,
cocoonwls
|
|
|
|
|
That depends on what you need. System.Threading.Timer is more light-weight, see if that fits your needs.
---
Year happy = new Year(2007);
|
|
|
|
|
hi all,
I don't know if i can express my problem right but i hope you can understand what i am looking for.
let's start...
for an application i am developing (windows application), there is a kind of mail servicing. This mail servicing should send mails to the clients on a certain condition that i test using data from the database.
I had a problem with the client in defining the template that the mail should be sent uppon. I asked the client to define a default template to be used in all the mails and by having it i can enter it in the code. The client asked if i can leave it undefined. Meaning he wants to be able to change the template whenever he wish. He needs a special page for that.
I was thinking of something like the word templates, but till now i have no idea what should i do. I had never worked with microsoft office tools in C# coding. I think it is not so hard...
anybody can give me a clue.
by the way i tried searching the code project for a start but i couldn't find any article that helps. (maybe i didn't search correctly)
i didn't try googling yet cause, concerning code, i believe that what i can't find in codeproject i can't find anywhere.
Thanks for any help given.
|
|
|
|
|
You want them to be able to write a template for email text ? Just define special keys for the values you want to insert, such as <MAILTO>, and then you can use regex to replace them with the values you have for each email.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Christian Graus wrote: You want them to be able to write a template for email text ?
That's right..
Christian Graus wrote: Just define special keys for the values you want to insert, such as <mailto>,
That is what i was thinking of doing. but i don't know how to insert a template creating tool inside my application or coding one or something like that. and i don't know how to define those special keys.
Christian your always the savor in those situations thanks
|
|
|
|
|
Well, your template will just be a string. Your keys will be things that a user won't ever type otherwise, so I presented it looking like a node: <mailto>, but it could be $MAILTO, or even MAILTO if you like. The point is to come up with something consistent, and the user will just type a template into a textbox, such as
$POSTALADDRESS
Dear $MAILTO,
Thank you for downloading a demo version of $THEPROGRAM. As you're aware, this demo will expire on $EXPIREDATE. We hope you've enjoyed the demo, if you have any questions, don't hestitate to ask us, your designated contact at $COMPANYNAME is $CONTACTEMAIL.
Regards,
$MAILFROM
And so, you just load that into a string, and for each email, make a copy, then call the replace method on the string class to replace each of the keys with the value for that email.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ok man thanks a lot,
one more question please
am i able to insert a background picture or a logo or something like that.
thanks a lot
|
|
|
|
|
Well, you're rendering it, so you can render it over a bitmap if you want to. I expect you can also insert a bitmap into an email, although I'm not exactly sure.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I suppose he wants to send an html formated mail message with a custom background.
You can use the approach above, but if you need preview you will need to use something like BrowserControl to render how the html formatted message will look like.
If this is the question you can follow the steps below :
1. Present the user with some relevant interface to create the templates.
2. Define some kind of macro language so you can insert the variables you need in the text.
3. Make the text html, save it temporarly (or not temporarly) on the hard drive and load it to an WebBrowse control so the user can see the result, before save the template.
Hope it helps.
|
|
|
|
|
Hi friends,
In my C#.Net application i am trying to sort the gridview contents by using the following line.
dgAddressBook.Sort(dgAddressBook.Columns[23], ListSortDirection.Ascending);
but i am receiving the following error. Please help me to resolve this problem.
Error:
The original exception is: DataGridView control must be bound to an IBindingList object to be sorted. at System.Windows.Forms.DataGridView.SortDataBoundDataGridView_PerformCheck(DataGridViewColumn dataGridViewColumn)"
Thanks in Advance,
Regards,
Prya
|
|
|
|
|
|
Firing a DataGridView.Sort() on an unbound column generates an error.
Try use a bound column which is used to calculate the unbound one and fire the sort on that column. If you do not have one, create a dummy one.
SkyWalker
|
|
|
|
|
hi,
Thanks a lot. but i didnt understand bound and unbound columns. i am providing my code. can u pls. help me.
Code:
ICollection userDetails = new ArrayList();
//Here GetAllUsers is a function which used to get all the details of the users in domain
userDetails=GetAllUsers(DEFAULTDOMAIN, domainUser, domainPassword);
dgAddressBook.DataSource = userDetails;
dgAddressBook.Sort(dgAddressBook.Columns[23], ListSortDirection.Ascending);
if (userDetails != null)
{
dgAddressBook.Columns["Initials"].Visible = false;
dgAddressBook.Columns["PhysicalDeliveryOfficeName"].Visible = false;
dgAddressBook.Columns["GivenName"].Visible = false;
dgAddressBook.Columns["Country"].Visible = false;
dgAddressBook.Columns["Result"].Visible = false;
dgAddressBook.Columns["Enabled"].Visible = false;
dgAddressBook.Columns["HomePage"].Visible = false;
dgAddressBook.Columns["DisplayName"].Visible = false;
dgAddressBook.Columns["Id"].Visible = false;
dgAddressBook.Columns["UserName"].Visible = false;
dgAddressBook.Columns["IsTotallyLoaded"].Visible = false;
dgAddressBook.Columns["IsDistributed"].Visible = false;
dgAddressBook.Columns["dbReturnCode"].Visible = false;
dgAddressBook.Columns["dbReturnMessage"].Visible = false;
dgAddressBook.Columns["ManagerName"].Visible = false;
dgAddressBook.Columns["EmpType"].Visible = false;
dgAddressBook.Columns["PostOfficeBox"].Visible = false;
dgAddressBook.Columns["State"].Visible = false;
dgAddressBook.Columns["FirstName"].DisplayIndex = 0;
dgAddressBook.Columns["LastName"].DisplayIndex = 1;
dgAddressBook.Columns["Description"].DisplayIndex = 2;
dgAddressBook.Columns["TelephoneNumber"].DisplayIndex = 3;
dgAddressBook.Columns["StreetAddress"].DisplayIndex = 4;
dgAddressBook.Columns["City"].DisplayIndex = 5;
dgAddressBook.Columns["FirstName"].HeaderText = "First Name";
dgAddressBook.Columns["LastName"].HeaderText = "Last Name";
dgAddressBook.Columns["Description"].HeaderText = "Designation";
dgAddressBook.Columns["StreetAddress"].HeaderText = "Street";
dgAddressBook.Columns["TelephoneNumber"].HeaderText = "Mobile Phone";
dgAddressBook.Columns["AdditionalPhoneNumbers"].Width = 130;
dgAddressBook.Columns["DateOfJoin"].HeaderText = "Date of Join";
dgAddressBook.Columns["PersonalEmail"].HeaderText = "Personal E-mail";
dgAddressBook.Columns["Email"].HeaderText = "Office E-mail";
Thanks in Advance,
Regards,
Prya
|
|
|
|