|
Hi,
There are several ways try this.
1. First create windows service application(minimal application)
2.
<br />
private static Form Form1;<br />
protected override void OnStart(string[] args)<br />
{<br />
Form1=new Form();<br />
base.OnStart(args);<br />
<br />
}<br />
Ravi
|
|
|
|
|
I would suggest that the best way would be to refactor the application logic away from the form (into a dll) and refactor the form to use this. Then you can create a service project to call the relevant app code.
Paul
|
|
|
|
|
You really shouldn't do this. What you are looking for is a service that has the "Interact with desktop" option selected. This is not recommended practice. Services are intended to be run at the system level, even when someone is not logged in so they aren't supposed to have any UI.
To do what you want, you need to create a Windows service and a Windows client application (2 different executables). The client application can run at Windows startup (when a user logs in). When the service needs to display an alert, it needs to inform the client application that there is something to display to the user. There are a lot of different ways to do this, from shared memory to remoting/wcf calls.
|
|
|
|
|
hi there,
i placed a picture box in my app, and i want to open image through the data which is in byte[]
can some tell how?
Becoming Programmer...
|
|
|
|
|
You need to assign that byte[] to be the contents of a MemoryStream ( from memory ) and then you can construct a Bitmap using a Stream in the constructor.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hy,
<br />
byte[] buffer;
Bitmap bmp = new Bitmap(width, height);<br />
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);<br />
Marshal.Copy(buffer, 0, bmpData.Scan0, buffer.Length);<br />
bmp.UnlockBits(bmpData);<br />
This is an example of how I used to copy rgb values from a byte array to a bitmap. Of course you have to know the width, height and pixelformat of the image.
Hope it helps,
Do your best to be the best
|
|
|
|
|
Yep i know pixel format (BGRA)
ok buddy i will try then tell you the result
Edited
yeah its working but i have problem that is my format is in BGRA and i didnt find any PixelFormat for it so i convertered my format to ARGB but it isnt showing anything but if left it as BGRA then its showing half correct pict
can you please take a look on the codes
byte[] byt = new byte[0];
.............................................................................
.............................................................................
.............................................................................
byte[] dirtybyt = new byte[width * height * 4];
fs.Position = offset;
fs.Read(dirtybyt, 0, width * height * 4);
byte[] temp = new byte[width * height * 4];
for (int i = 0; i < width * height; i++)
{
temp[i * 4 + 0] = dirtybyt[i * 4 + 3];
temp[i * 4 + 1] = dirtybyt[i * 4 + 2];
temp[i * 4 + 2] = dirtybyt[i * 4 + 1];
temp[i * 4 + 3] = dirtybyt[i * 4 + 0];
}
byt = temp;
.............................................................................
.............................................................................
.............................................................................
Bitmap bmp = new Bitmap(width, height);
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
Marshal.Copy(byt, 0, bmpData.Scan0, byt.Length);
bmp.UnlockBits(bmpData);
pictureBox1.Size = new System.Drawing.Size(width, height);
pictureBox1.BackgroundImage = bmp;
-- modified at 2:52 Wednesday 3rd October, 2007
-- modified at 3:03 Wednesday 3rd October, 2007
Becoming Programmer...
|
|
|
|
|
The code seems to be OK. It's important how you read from the file and copy the data into the byt array.
Do your best to be the best
|
|
|
|
|
hi friends i have tried to send sms to india through my application but unable to send it the code is as follows
protected void Send_Click(object sender, System.EventArgs e)
{
try
{
SmsTest.net.webservicex.www.SendSMS smsIndia= new SmsTest.net.webservicex.www.SendSMS();
SmsTest.com.webservicex.www.SendSMSWorld smsWorld = new SmsTest.com.webservicex.www.SendSMSWorld();
if(rdoType.SelectedValue == "1")
smsIndia.SendSMSToIndia(txtMobileNo.Text.Trim(), txtEmailId.Text.Trim(), txtMessage.Text);
else
smsWorld.sendSMS(txtEmailId.Text.Trim(), txtCountryCode.Text.Trim(), txtMobileNo.Text.Trim(), txtMessage.Text);
lblMessage.Visible = true;
lblMessage.Text="Message Send Succesfully";
}
catch(Exception ex)
{
lblMessage.Visible = true;
lblMessage.Text="Error in Sending message"+ex.ToString();
}
}
protected void rdoType_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(rdoType.SelectedValue =="1")
txtCountryCode.Enabled = false;
else
txtCountryCode.Enabled = false;
}
}
}
and the exception is
Error in Sending messageSystem.Net.WebException: The remote name could not be resolved: 'www.webservicex.net' at System.Net.HttpWebRequest.GetRequestStream() at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at SmsTest.net.webservicex.www.SendSMS.SendSMSToIndia(String MobileNumber, String FromEmailAddress, String Message) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\smstest\e1b64363\4f679e02\App_WebReferences.dvkrcwdj.1.cs:line 46 at SmsTest.WebForm1.Send_Click(Object sender, EventArgs e) in c:\Documents and Settings\Tapi-net\Desktop\SmsTest\SmsTest\SendSms.aspx.cs:line 52
so will u please help me out.
thanking you in advance.
Amol Pate
|
|
|
|
|
Your code is a black box, no-one here can help you unless they have used that webservice. The problem is lower down than this code. Your best bet is the documentation of the web service you are trying to use.
I can see www.webservicex.net, I wonder if you have network issues ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want to bind a dataset in SQL reporting services. My procedure outputs data from 3 select statements. But when i try to bind it in
reporting services,the dataset shows the resultset of only the 1st select statement
of the proc.
In all my reports before, I had used only 1 select statement to output data in the proc
and they had all worked fine in reporting services. What should I do to get the
resultset form all three select statements in the dataset.
|
|
|
|
|
I was trying to create a Generic class and a Generic method inside. Please check the following code
class Program
{
static void Main(string[] args)
{
MyClass<int, string> m1 = new MyClass<int, string>();
Console.WriteLine(m1.Calculate(10));
Console.Read();
}
}
class MyClass<T,F>
{
public F Calculate(T t)
{
ObjArr.Add(t);
}
}
In this I am giving two generic types for MyClass. I have supplied int and string there. My generic function (Calulate()) returns type F, which is instantiated as string. Now how will I return the type from Calculate() method ?, because we are not getting any objects for type F ? Any help would be appreciated.
-- modified at 2:10 Wednesday 3rd October, 2007
|
|
|
|
|
Did you escape "<" with "&lt;"? The code isn't correct as-is.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
TJoe wrote: Did you escape "<" with "<"? The code isn't correct as-is.
OOPS.. I forgot that. Now check please
|
|
|
|
|
Your code doesn't make much sense, so I'm not sure what to tell you. If you explain what you would like the method to do (e.g. add two numbers then return the string representation), then I can probably help.
I don't think you will be able to use your code as-is. Basically, you would need to write code that knows how to convert T to F for every class in .Net. Because I could define the class as "Class<Hashtable, Boolean>". There's no relation between T and F.
-- modified at 2:29 Wednesday 3rd October, 2007 - damn <
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
TJoe wrote: If you explain what you would like the method to do (e.g. add two numbers then return the string representation), then I can probably help.
I was experimenting generics. So i thought of making a method in which if parameters are integer it will return the sum of two numbers as integer, if both are string it will combine both strings and return ? But I feel this is stupidity or is it possible to do like this ? If not what will be the actual use of Generics ?
|
|
|
|
|
I suggest reading this[^] or search for other articles on generics.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
i am devloping the application in which i m recieving the sms from the mobilei m devloping application in c# anybody can help me.
|
|
|
|
|
The way to receive SMS, is to be connected to the mobile phone network, and have a phone number. Have you accepted this job from a project site, or have you just decided to do it, without doing any research in to feasibility ?
There are libraries for sending SMS via paid gateways, I don't see how you can receive SMS on a computer that is not connected to the phone network. How can it be addressed to you if you don't have a number ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i have done all the task ,it is sending the message but not receiving the message i have written the following event for receiving but it is not working
private void oGsmModem_NewMessageReceived(ATSMS.NewMessageReceivedEventArgs e)
{
txtMsg.Text = "Message from " + e.MSISDN + ". Message - " + e.TextMessage + System.Environment.NewLine;
}
|
|
|
|
|
It is possible that the event never get triggered.
What is connected to your computer in order to receive/send messages?
I am using a GSM modem where i can use only AT commands. There is an AT command available that pass me an event when a message is received.
Provide more information about your project.
|
|
|
|
|
Hi All.
I have a problem in my Web Page.
I Want reload data from DataBase after 15 seconds to WebPage. otherwise, my page must update new data from database to page after 15 seconds. But I don't know How do it?, I must use AJAX ?. How to Create above Page?.
I very need to sovel this problem as soon as.
Hope you help me.
If you have source code, you can show me.
thanks.
|
|
|
|
|
Not really a C# question but I'll help anyway.
You need to add a META tag inside that page's HEAD section. For example:
This little snippet will reload CodeProject.com every 15 seconds.
|
|
|
|
|
But in WebPage have using <marquee> tag to scroll page.
I want reload data in page at time, then position of all records in page not change <-- because page load then setting all position of records.
Example:
time A:
Position records.
Record 1
Record 2
Record 3
....
time B: <--- at time update data.
Record 2
Record 3
....
if using javaScript -- meta --> Position Record of B is.
time B:
Position records.
Record 1
Record 2
Record 3
....
|
|
|
|
|
You can use javascript timer and submit the page after 15 second and on page load you can update the data. not need to use ajax.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|