|
Thanks for your help - that key exists, but it is empty, although I've set up an SMTP account. I've searched the entire registry, and the server is not there. Any info you can give me on the COM objects would be appreciated.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello. I have a windows based application in C#, and i am using a reference to Word 2003. My problem is launching time as it takes way too much to start the application. Used the debug to see why and what i have noticed is that the whole problem lies with loading Word interop dll file:microsoft.office.interop.word.dll It takes somewhere between 25 and 30 seconds to get this dll loaded from GAC. Any one has any idea why? How can i speed this up?
Thanks
|
|
|
|
|
Use C++, you won't have this problem.
|
|
|
|
|
Does it take a long time to start _your_ app or to launch Word via automation?
Alex Korchemniy
|
|
|
|
|
Can someone please give me some information on sending data through a USB port. What I am trying to do is use the USB port (I get how to do it on a COM port). I am using VC# 2005. I have searched the internet repeatedly but cannot find anything.
Overall, what I am trying to do is just activate a LED with a transistor via a progam made in C# by hooking up the the BASE pin of the transistor to the DATA+ pin on the USB cable and then powering the circuit with the cable. Sorry if this is a horrible description... Then, theoretically, send data through the data line to flip the transistor on. (btw: this is just an experiment)
Thanks!
|
|
|
|
|
For something low-level like this: C++ is the perfect and most comfortable language to use
Search for DeviceIoControl
Alex Korchemniy
|
|
|
|
|
|
Thanks, I'll check those out. ![Wink | ;)](https://www.codeproject.com/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
Hi guys, my aswer is this:
I created a very simple appliation called ElevatorApp. When I start my 2 threads, both of them enter in the WaitSleepJoin state, and I don't know why.
My intention with this app is: when the thread 1 starts it lock the Floor object, set it and release it. In the thread 2, it will see that the floor is the same that the elevator is stops and show their name.
Please, can anyone helps me?
Thanks a lot.
class Class1
{
[STAThread]
static void Main(string[] args)
{
Random rGen = new Random();
int iNum = rGen.Next(0,19);
Floor floor = new Floor();
Elevator Elv1 = new Elevator(floor, iNum);
Elevator Elv2 = new Elevator(floor, iNum);
Thread T1 = new Thread(new ThreadStart(Elv1.Move));
Thread T2 = new Thread(new ThreadStart(Elv2.Move));
T1.Name = "Elevador 1";
T2.Name = "Elevador 2";
T1.Start();
T2.Start();
}
}
public class Elevator
{
private Floor andar;
private int iDest;
public Elevator(Floor floor, int iNum)
{
andar = floor;
andar.iFloor = 0;
iDest = iNum;
}
public void Move()
{
if(andar.iFloor != iDest)
{
andar.iFloor = iDest;
}
else
{
iDest = andar.iFloor;
}
}
}
public class Floor
{
private int floor;
private bool bDef = true;
public Floor()
{
}
public int iFloor
{
get
{
lock(this)
{
if(!bDef)
{
Console.WriteLine(Thread.CurrentThread.Name);
}
else
{
Monitor.Wait(this);
}
Monitor.Pulse(this);
}
return floor;
}
set
{
lock(this)
{
if(bDef)
{
if(floor != 0)
{
Console.WriteLine("Chamada no andar {0}", floor);
bDef = false;
}
else
{
Console.WriteLine("Terreo");
}
}
else
{
Monitor.Wait(this);
}
floor = value;
Monitor.Pulse(this);
}
}
}
}
|
|
|
|
|
I'm not sure what you're trying to do. The reason the two threads are in the WaitSleepJoin state is that one of the threads executing the Move function tries to access the iFloor property, acquires the monitor and executes Monitor.Wait. It then relinquishes the monitor and goes to the WaitSleepJoin state. The second thread also follows the same path, acquires the monitor and then waits till someone pulses it.
The bottomline is that both threads execute Monitor.Wait and no one is calling Monitor.Pulse.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I'm having this strange problem where I have updated data in one MDI child window, and want to refresh the data in another MDI child window.
I have a function called populateExhibitions which fills a listview with data from my db. This works fine first time round. But when I called populateExhibitions from another MDI child window,
i.e
<br />
frmExhibitions fExhibitions = new frmExhibitions();<br />
fExhibitions.populateExhibitions();<br />
it then calls my populateExhibitions function again, but it never updates the data in the list view. Even though the data coming from the database is indeed updated! (The datareader object proves this to me!)
<br />
public void populateListViewExhibitions(DataListView.DataListView dataListView)<br />
{<br />
dataListView.Items.Clear();<br />
OdbcConnection objConnection = new OdbcConnection(getConnString());<br />
string sql = "Select id, name from exhibitions order by name";<br />
<br />
objConnection.Open();<br />
OdbcCommand objCommand = new OdbcCommand(sql, objConnection);<br />
OdbcDataAdapter objDataAdapter = new OdbcDataAdapter(objCommand);<br />
DataTable dtListView = new DataTable();<br />
<br />
objDataAdapter.Fill(dtListView);<br />
dataListView.AutoDiscover = false;<br />
dataListView.Columns.Add("ID", "ExhibitionID", 200);<br />
dataListView.Columns.Add("Name", "name", 200);<br />
dataListView.DataSource = dtListView;<br />
<br />
objConnection.Close();<br />
<br />
objConnection.Open();<br />
OdbcDataReader objDataReader;<br />
objDataReader = objCommand.ExecuteReader();<br />
<br />
<br />
while(objDataReader.Read())<br />
{<br />
MessageBox.Show("Name = " + objDataReader["Name"].ToString());<br />
<br />
<br />
}<br />
<br />
objDataReader.Close();<br />
objConnection.Close(); <br />
}<br />
What am I missing here?
|
|
|
|
|
greg_quinn wrote:
frmExhibitions fExhibitions = new frmExhibitions();
fExhibitions.populateExhibitions();
In the first line, you are creating a new instance of the form, and that's the one you are refreshing. What you want to do is to access the existing instance. You could try storing the instance in a public field in your main form class, or if you will only have one instance of that child, in a static field in the frmExhibitions class.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
What I am trying to do is this: take contact information from a database and create a .pst file that can be imported into Outlook.
So far, I have only been able to update the contact information on my own computer. Is there anyway to export that contact info to a .pst with C#?
|
|
|
|
|
I have an MDI child window in which I am updating data. Once this data is updated I need to call a function in another existing MDI child window.
How do I call this function in the other MDI child window?
Thanks
|
|
|
|
|
You need to have a reference to the other child window you need to call. You can have a property or constructor parameter that allows the main form to set the child window reference.
Or, you can have the main form act as a mediator and pass a reference to it to all child forms. The child forms then call methods on the main form, which in turn calls appropriate methods on the child forms.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi, Sir and Madam
Is it possible to get my webpage url and website url
Thank You.
|
|
|
|
|
god4k wrote:
Sir and Madam
Both!? There is only one person I know that could fit both, and she is post-op now so is really now just a Madam.
god4k wrote:
Is it possible to get my webpage url and website url
Yes....
In your web form (the class derived from Page ) you will have access to a property called Request which returns an HttpRequest[^] object. There is a propery on the HttpRequest called Url[^]. This will give you the webpage URL.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
I have been working on a client/server application model for a long time and am having a terrible time dealing with file transfer. The main problem is basically having to build and parse the messages myself. I have been looking through a lot of Remoting and other forms of client/server interaction and it seems like some of the ideas here would provide a much more efficient and elegant solution to a client/server program.
What I have been kind of wandering is if there is a simple way to serialize data then send it to the server who in turn just channels it to the appropriate client after doing some basic extraction/parsing. From what I've seen if I could utilize XML and SOAP then the task shouldn't be too difficult, but as I am waiting for some books to arrive on the subjects, I am eager to get started.
Can anyone lead me in the correct direction if I wanted to do the following:
Serialize messages into XML format to send to the server
Server receives the XML message, parses it, then sends it along to the approporiate client
It seems intuitive that if, instead of streaming binary data to send files manually (which is how I am currently having to approach it) I could just serialize a byte array, or in the case of images, serialize a PictureBox, this whole mess could be cleaned up simply.
Any assistance would be appreciated.
|
|
|
|
|
Sounds like you want to build a web service.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yeah, the premise of the Web Service is exactly what I need, but I haven't been able to figure out if I can use the Web Service to keep track of clients?
|
|
|
|
|
AFAIK, a web server responds to requests, and that's it. What are you trying to do, exactly ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well I am basically working on a simplistic messaging program, which I have completed with success, however I need to have file transfer abilities. So far, all of my attempts have failed due to interleaving of messages of which I cannot seem to prevent. It would seem that there might be a better way of transferring data using XML and perhaps serialization that would alleviate the problems of having to custom build and parse my own messages. The whole idea of the web service is pretty much exactly what I am looking for, except the fact that it only response to clients per request. If there was a way to create a server using the same technology I would definitely like to attempt to do so.
|
|
|
|
|
I'd definately use FTP to transfer files, unless there are firewall issues. Just send your client an FTP address, and it FTP's back for it's file. That's what FTP is for, and converting a file into XML is going to make it bigger.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello Guys,
how are you, hope you are fine?
This is my first time I am doing the ASP.NET C# SO Please please give me a fever in the following codes using C#:
//build id
ID= select MAX(COM_ID) FROM COMPLAINT;
dCmd1 = new suggestionCMD(strSQL1, dbConn);
if (id=0) then {
id +=1;
dCmd2 = insert into COMPLAINT (COM_ID, "COM_TITLE", "COM_DESC", "COM_STATUS","COM_REASON_DESC", COM_USER_ID, COM_DATE, COM_A_ID, COM_Updated_On);
}
dCmd.ExecuteNoneQuery();
IF (strSQL1+=0 || strSQL1 >0){
strSQL1 = strSQL1+1;
}
void InsertCommand(object sender, System.EventArgs e){
suggestionCon CMDConnection;
CMDConnection = new suggestionCon("Server=localhost;
uid=sarah;pwd=sarah;database=suggestion");
suggestionCMD CMD;
CMD = new suggestionCMD("Insert Into COMPLAINT (Title, Description) Values (COM_TITLE, COM_DESC )", CMDConnection);
CMD.Parameters.Add("COM_TITLE", suggestion.Varchar2, 30). Value = InsertTitle.Text;
CMD.Parameters.Add("COM_DESC", suggestionDbType.Varchar2, 100). Value = InsertDescription.Text;
CMDConnection.Open();
CMD.ExecuteNonQuary();
CMDConnection.Close();
LoadData();
}
void PrintButton(){
// Set the page margins
Rectangle rPageMargins = new Rectangle(e.MarginBounds.Location,
e.MarginBounds.Size);
// Generate the offset origins for the printing window
Point[] ptOffsets = GeneratePrintingOffsets(rPageMargins);
// Make sure nothing gets printed in the margins
e.Graphics.SetClip(rPageMargins);
// Draw the rest of the Form using the calculated offsets
Point ptOffset = new Point(-ptOffsets[_iCurrentPageIndex].X,
-ptOffsets[_iCurrentPageIndex].Y);
ptOffset.Offset(rPageMargins.X, rPageMargins.Y);
DrawForm(e.Graphics, ptOffset);
// Determine if there are more pages
e.HasMorePages = (_iCurrentPageIndex < ptOffsets.Length - 1);
_iCurrentPageIndex++;
}
Regards,
Saif
|
|
|
|
|
Firstly, what do you mean by fever?
Secondly, it would be easier for someone to help you if you explain what you're trying to do, and where it's going wrong rather than just posting some problematic code.
|
|
|
|