|
When some action has been added to a context menu in Windows Explorer using a Verb such as "save" (which is not the default action), how to access that Verb from the Main function of the program which is invoked from such Context Menu item in explorer, i.e., how to choose as to which action is to be taken depending upon the command-line arguments?
Is there any sample code for this purpose?
Thanks.
|
|
|
|
|
Just check the arguments that are passed in, and branch accordingly. static void main has a string array passed into it, that's the arguments collection.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks.
But, arguments show only the filename on which the context menu was clicked. What about the "Verb" or the action such as "save"? I mean how to check whether context menu item corresponding to Verb "open" was clicked or Verb "save"? This is relevant when more than one context menu items are placed by one application.
Thanks in anticipation.
|
|
|
|
|
OK, I get it. Try this[^] MSDN page.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi all,
The dateTime is showing in a Label like this:
this.label1.Text=DateTime.Now.ToString("dd ,MMMM ,yyyy");
Now suppose that this program open in 24 hours ..Then How can I change date Time of the Label Continuously with out using a Timer?
Can any one send me better url to download DateTime Components with attractive skins?
thanks in advance..
|
|
|
|
|
pubududilena wrote:
Then How can I change date Time of the Label Continuously with out using a Timer?
You can't. to change something, you need an event, and if the event is time, you need a timer.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
as Christian said you need a timer
but why you want to do t without timer?
|
|
|
|
|
hi,
If I use Timer ,Then Application is going to be Little Slow.But If I used another Component like Date Time Picker then it is ok..But I coundn't find atrractive DateTime Component or Library.
regards,
pubudu
|
|
|
|
|
A timer and a date/time picker has completely different uses. What is it that you are try to do, really?
---
b { font-weight: normal; }
|
|
|
|
|
Well any component you use will have a 1 sec timer.. you need to refresh your control on 1 second, don't you?
|
|
|
|
|
You could just change the text of the label continously in a loop. However:
This would cause the text of the label to flicker a lot.
It also uses all the cpu time it can, causing the computer to run at 100% cpu all the time. This will give you a lot of heat, and render the computer virtually useless for anything else.
---
b { font-weight: normal; }
|
|
|
|
|
private System.Threading.Thread timerAvoidanceThread = null;<br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
timerAvoidanceThread = new System.Threading.Thread(new System.Threading.ThreadStart(TimerReplacement));<br />
timerAvoidanceThread.Start();<br />
}<br />
<br />
private System.Threading.AutoResetEvent wellItsNotATimer = new System.Threading.AutoResetEvent(false);<br />
public void TimerReplacement()<br />
{ <br />
while(true)<br />
{<br />
if(wellItsNotATimer.WaitOne(1000, false))<br />
{<br />
break;<br />
}<br />
<br />
wtfLabel.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}<br />
}
|
|
|
|
|
Hi,
I have coded the login page of my project.In that i have used the forms authentication.now it is working fine.But the issue is, In the Login screen there is a link for forgot password.If we click that link, it has to open a popup window asking for the username and emailaddress. But now whats happening is if i click the forgot password link it redirects me to login page. Please help me out. Thanks in advance.
thankyou
Anand.
|
|
|
|
|
You have to change your web.config so the forgot password page is excluded from the forms authenication control.
#########################################
<location path="forgetpassword.aspx">
<system.web>
<authorization>
<allow users="*,?"/>
</authorization>
</system.web>
</location>
###########################################
|
|
|
|
|
I am doing a project Mbile Medic.
This project aims to implement a C# based system that helps a doctor tap into his patient database at the hospital via his personal mobile phone and monitor their condition. This helps the doctor monitor his critical patients wherever he may be. The project is implemented by creating the patient database software system for the hospital. The communication module for the software system interfaces a mobile phone (lets call it X) via a serial port or a USB port (depending on the model). The doctor sends an SMS message with the patient ID via his mobile phone to X. The software system collects the message from X and based on the patient ID, queries the database for the patient details, summarizes it, and sends it back to X which then sends the summarized message back to the doctor. The doctor will also be able to send alerts and prescribe medication using this system.
I am using Siemens s35i.
If i send the command to get manufacturer info (AT+CGMI) am getting the response. But if i send the command to receive messages Iam not able to receive messages.. Actually i don know which commands to use. Can u please help me...
Jimi George
|
|
|
|
|
I have a matter with Ms.Access. I don't know how to pass the value from one form to another form. Also, I want to set this value to the text-box of the destination form.
For example:
I'd like to transfer the value '5' inside the code VBA of the form 'form1' to the form 'form2'. After moving successfully, I want to show this value in a text-box of the destination form. Please point me to a way of solutions.
Thanks so much...
|
|
|
|
|
This is the C# forum.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
My question is simple -> can I get full name of assembly in which resides my function that is currently running. To clarify:
<br />
static string ReturnName()<br />
{<br />
return "This function runs in assembly named:"+ Class.Property.ToWhich.U.Need.To.Point.Me<br />
}<br />
Tnx
|
|
|
|
|
How about Reflection.MethodInfo.GetCurrentMethod().GetType().Assembly.GetName().Name ?
Or something like that.
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
But you were close
Tnx a lot!
|
|
|
|
|
I'm drawing a few shapes on an img field on a windows form by overriding OnPaint, and using a double buffer as many people have detailed here. However, my shapes disappear after they are drawn. If I put a Refresh() at the end of my OnPaint override, it works (but obviously bogs down)If I set a timer it flickers at the rate of the timer.
What am I doing wrong?
|
|
|
|
|
Uf, that happend a lot when I first used drawing. What I learned is that drawing directly in OnPaint event isn't good solution in most cases, better draw it in Form_Load for example.
What you must know is that in this case you need refresh you drawing in Form's Activated event... because if you hide ur Form (which happends a lot when in debug mode) and than show it again your precious work will be gone...
If you follow my suggestion and drop function calling in Page_Load then you'll have code like this:
<br />
Form_Load()<br />
{<br />
DrawStuff();<br />
}<br />
<br />
Form_Activated()<br />
{<br />
DrawStuff();<br />
}<br />
In case you stick with OnPaint() I guess simple this.Invalidate(true); in Form_Activated should do the trick.
I guess someone will eventualy give you right answer but if you get stuck, drop a code - that will help us to help you.
cheers
|
|
|
|
|
Thank you for the response
I am still a bit confused, however. One of the shapes I'm drawing I'd like to follow the mouse as it moves over the img box - So I would have to refresh() each time the mousemove event triggers, correct?
If I put the refresh() in the mousemove event it seems to work fine as long as the mouse is moving, but as soon as the mouse stops, the shape disappears. This is really frustrating!
Thank you for any help - mutty
|
|
|
|
|
This is working for me... even if Refresh in MouseHover is commented... but maybe you should try uncommenting it.
<br />
private void pictureBox1_MouseHover(object sender, System.EventArgs e)<br />
{ <br />
}<br />
<br />
private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{ <br />
Refresh();<br />
}<br />
<br />
private void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
using (Graphics g = this.CreateGraphics())<br />
{<br />
PaintEventArgs pa = new PaintEventArgs(g, this.ClientRectangle);<br />
g.SmoothingMode = SmoothingMode.AntiAlias;<br />
<br />
pa.Graphics.DrawLine(new Pen(Color.FromArgb(255, 0, 0, 0)), <br />
new PointF(MousePosition.X-10, MousePosition.Y+10), <br />
new PointF(MousePosition.X-20, MousePosition.Y+20));<br />
} <br />
}<br />
In any case, if you can't get it to work, drop me .cs on pele@zig-zag.net and I'll look into it.
Cheers
|
|
|
|
|
Hi!
I was just wondering how I could delete 1 row from the results I get in my datagrid. Everytime data shows in my datagrid, an edit/delete button appears for every row i fetch. Now what I want to happen is that if I fire my delete button only the row aligned to it gets removed. Now my problem is that my page hangs when i click the delete button. I've debugged it and it stops right before my curly bracket
<br />
if (Page.Request.QueryString["Mode"] == "Delete")<br />
{<br />
objCol.DeleteColors(Page.Request.QueryString["key"],"");<br />
Response.Redirect ("SysColors.aspx");<br />
}
<br />
public bool DeleteColors(string strObject,string strColors)<br />
{<br />
try<br />
{<br />
strSQL = " DELETE FROM sys_colors";<br />
strSQL += " WHERE object = '" + strObject+ "' ";<br />
strSQL += " AND c_code = '" + strColors + "' ";<br />
<br />
OdbcCommand cmdDelete = new OdbcCommand();<br />
cmdDelete.CommandText = strSQL;<br />
cmdDelete.Connection = cnnDS;<br />
cmdDelete.ExecuteNonQuery(); <br />
<br />
return true;<br />
}<br />
catch (Exception e)<br />
{<br />
throw e;<br />
}
I hope I didnt forget anything this time...Thanx for all your help! Much appreciated! My apologies for the inconveniences
Kampai!!!
|
|
|
|