I have an application that the user may open normally by double clicking its icon on the desktop, but I also want to add a couple of specific 'short-cut' options to the contect menu that should only show when the windows explorer context menu is opened by right clicking the application's icon. Each of these options will start the program, perform a function of the application specified by the menu option that was selected, and then close the application. Because none of these functions involve working on a file or folder, I don't want these options to show on any other file's or folder's context menu. My idea is to use command line switches to specify the different application functions, I just need to know how to set up the context menu and limit it to just the application's icon. If it makes any difference, I am using Vista, but I'll want to also set this up in WinXP. Thank you.
howardjr
Posts
-
How do you customize the windows context menu so that it shows specific options only only when opened for a specific application? -
How can I determine the right button image for my custom combobox button for the selected desktop motif? [modified]I wrote a custom combobox that uses an image button. However, if the user changes their desktop motif, then the button images on my combobox won't change, which doesn't look very good, expecially if there are any regular drop-down-lists on the page. Is there a way to determine which motif the desktop is using with javascript, vbscript, or something else? An alternative would be to "sample" the color of one or more points in the button area of a regular drop-down-list on a page before the one my combobox is displayed on, then use this information to determine the motif, and have my aspx's code select the right button-set for my combobox when building the page. How can I "sample" the color of a drop-down-list's button? Incidently, I'm using IE6 SP6 with VB.Net 2003 with client-side javascript for my target browser and the development language. Thank you
-
VB.NET 2003 Properties with Parameters don't always seem to work properly in the Designer.I wrote a Designer module to display my custom component and allow the various properties to be accessed in the properties pannel. Then I thought I would add an optional parameter with a default value of space to the properties that manage the styles for three of the subcomponents that are expressed as strings. My code would see the space and use the content of the Value parameter to control the entire style string value. If something other than a space were seen then it would be used as the name of the attribute, and the content of Value would be the value of that attribute. With all of this said, it didn't work, but wouldn't really tell my why, even when using the debugger set up to debug during the design time. I had already used the same technique to expose a user property that used an optional parameter to provide an index into an array of strings managed by the property which worked fine, but because I have yet to figure out how to write my own property dialog to expose the optional index parameter, only the top most element is accessible through the property pannel, but from within my back-end code I could access the other elements using the parameter fine. With that success, sort of, I thought I would use the optional parameter to provide a way to ask for the style attributes with the string managed by another property, but that's when the gray box of death started displaying for my component. While floating your mouse pointer over one of these boxes you would see that the specific style property could not be set to the values from the associated aspx component style property, but walking the execution through the debugger didn't find any problems, and the components rendered properly and worked just fine in the client-page. Anyway I finally discovered the source of the problem when I tore-down my code and tried removeing the various things I had done since the last working copy I had in source safe, and found that only removign the parameter from the property fixed the problem, even though none of the code actually used the parameter.
-
Designer is showing a gray box but I can't figure out why. Please help.I developed my own custom web combobox component which used to display just fine in the VS 2003 designer. I also developed the designer for my component in VB.Net 2003. Unfortunately, while I was working on getting the properties in the component to work just the way I wanted them too, the component stop displaying properly in the designer, so now I get the gray box telling me that there was an error creating the component, and a pop-up saying that the style string for my component's button couldn't be set to the values in my ASPX page for all of the instances of the component in the page. I've walked though the code using the debugger and don't get any errors, and the component renders properly with the settings that the designer is complaining about. Anyone have any suggestions on how to debug this? Thank you. P.S., if anyone knows of some good resources on how to develop designer modules and property editors for the designer, please pass them along. I am in serious need of creating my own property dialogs for my component. Assuming it ever works in the designer again.
-
How can I rendering select list item with added attributes?In JavaScript and HTML, I created an list of options for a select list that had a UserProperties opbject, in which I created a "list" of arbitrary sub-attributes, similar to the style attributes. Then I added a function that could get this information from the selected option. This all worked well for storing additional values in the options, which could be referenced when the select's onSelect/OnChange event fired. Now, I want to include this capability in my component. I created a property that allows me to manage the UserProperties as an arrary. Then when the select list's children are created, I use the ListItem attribute.add method to push the array value into the option. Unfortunately, Mircrosoft let you add the attribute, but doesn't render tham. :( I could pass the array to the page, and then hava javascript push the values into the options, but that would be redundant. I was hoping that there was a render for the option that I could override, and then create the tag strings myself. In the past, before linking all of my sub-components together as childern under a main span element and then letting the render method do all of the work, I was explictly was calling the render for each sub-component explicity, and adding 'little bits' of hard coded html to the output stream to implement to new features I wanted in my component. Now that the sub-components are all linked up as childern of the main span, I need some way to get the render to call my render method for the options instead of the built-in one. It seems to me that if good modular programming practices were employed that the option rendering would be a seperate routine from the select rendering routine, and that the option rendering routine would be overridiable. The online help says "Gets a collection of attribute name and value pairs for the ListItem that are not directly supported by the class." But then goes on to say "Use the Attributes collection to manage the attribute name and value pairs declared in the opening and closing tags of the ListItem, but not directly supported by the class. You can programmatically add or remove attributes to the collection." When I look at the Attributes collection, there is a render method, but its not clear to me how I could call get my code in to execute it. Any ideas? Thank you
-
How can I rendering select list item with added attributes?I can add an attribute to each option in a drop-down list, using the System.Web.UI.WebControls.ListBox.Items.Item(ItemIndex).Attributes.Add() method, but they are ignored when the list is rendered to the web-page. How can I render them? I'm currently adding the controls as childern to a span element, and then using the span.RenderControl(output) method to do the heavy lifting. Is there a method that I can override that specifically renders the options?
-
How can I rendering select list item with added attributes?I can add an attribute to each option in a drop-down list, using the System.Web.UI.WebControls.ListBox.Items.Item(ItemIndex).Attributes.Add() method, but they are ignored when the list is rendered to the web-page. How can I render them? I'm currently adding the controls as childern to a span element, and then using the span.RenderControl(output) method to do the heavy lifting. Is there a method that I can override that specifically renders the options?
-
Using Reflection to get the name of a function parameter.Thank you for your reply. I've tried to stay away from using strongly typed data sets in favor of "self-healing" code. I'm forced to use VS2003 with .Net 1.1, so this may not be a problem with the later version(s), but when the database changes, i.e., a column goes from not null to null, we've had to update the strongly typed data sets and the programs. I'm more interested in having the code able to deal with nulls directly. However, I'll need to look at the link you gave, it may be that we're not using stongly typed data sets properly. As I said in my first posting, I want to be able to create a class structure instance to contain all of my database column data. Currently I'm testing the columns for null as they are read from the database using a query. If the value is null then I set a paired member flag variable to true and a 0 or empty string, or some other default value in the value member variable, and if the column isn't null, then I'm setting the flag to false and store the column value in another member variable. The flag member adds the suffix '_Is_Null' to the name of the one used by the value member. This works well enough, I just need to check the '_Is_Null' suffixed flag member to see if the database value was Null or not to determine how to use the value member variable. However, when it came to sending values back to the database via a stored procedure I wanted to "hide" this code so the assignments easier to read. Instead of passing both the flag member variable and the value member variable to the function in which I was hiding the test, I decided to pass the name of the value member into the function, and use Reflections to look up the paired flag member and its value, then return the appropriate value to be assigned to the stored procedure's parameter. This too works well enough, except that because I was passing in the name of the member as a string instead of the member's value, I'm not able to take advantage of the compiler check for misspelled member names. So, I want to use the value member instead of its name in the function call. However, when I tried using them with the debugger I could see the data types of the parameters, but I couldn't figure out how to get the names of the variables passed in to them with the function call. Another issue is that Reflections tells me what the containing class's type name is, but not the instanced variable, so if I had more than one instance of the class, how would I know that I'm looking at the right instance when I resolve the
-
Using Reflection to get the name of a function parameter.I wrote a routine using some of the reflection features to look for paired member fields in a class. The function looks up this variable's value and the value of the paired variable, which may or may not actually exist. If it does, then its boolean value is read, and if true the function returns a System.DBNull.value, otherwise the function just returns the value of the named field passed into it when called. Rather than use variant variables to store my database fields, I'm using two fields to store the value read from a database. The first is a typed field variable for the actual data, if it's not Null, and the second is a boolean to track if the database value was Null or not, i.e., Name and Name_Is_Null, both of which belong to an instance of the DataBase_Info class. Currently, the function is called with a string containing the name of one of the member fields, and there is only one instance of DataBase_Info. Now I'd like to pass the actual field variable to the function, and have resolve the class instance, if there is a paired member, and return either the value passed in if their isn't a paired member or it's false, otherwise return System.DBNull.value. How can I resolve the name of a variable passed in as a parameter and its container at run-time? Thank you
-
A question about two regular expression patterns, please help.Ah, thank you for that additional information :)
-
A question about two regular expression patterns, please help.Thanks!
-
A question about two regular expression patterns, please help.When I append showDialog='Name' to the url location to my page the following statement returns minus 1, for no match.
document.location.search.search( /(^\?|,)showDialog=(['"])?(Name|Number)(\1)?(,|$)/i )
but the next statement returns zero, for a match starting at the begging of the string.
document.location.search.search( /(^\?|,)showDialog=(['"])?(Name|Number)(['"])?(,|$)/i )
The difference between the two is that the first one is supposed to match the quotes that enclose the word Name or Number. On page 170 of the O'Reilly book, JavaScript The Definitive Guide, by David Flanagan, a very good book on JavaSrcipt, the following example is shown and works:
/(['"])[^!"]*\1
This pattern looks for either a single or double quote, followed by any other characters, then the matching single or double quote that was initially found. What I need for there to be an optional initial single or double quote, followed by either Name or Number, then the matching quote that matches the initial single or double quote, if any. This pattern is to occur immediately after the url location's query string's question mark or after that after a comma. The pattern should then end with a following comma or the end of the string. Can any Regular Expression Gurus tell me why the first statement doesn't work and the correct pattern to use? Until then I can use the second expression, understanding that the Name/Number value may not actually be enclosed with matching quotes. Thank you.
-
How do you quote parameters for an Oracle Select statement string when the parameter contains a quote?True enough -- I never know what I'm going to do when I'm sleep-computing.
-
How do you quote parameters for an Oracle Select statement string when the parameter contains a quote?Thank you for your comments and the links. It looks like the article on protecting against SQLInjection Attacks covers what I need very nicely. In my case I'm lucky in that I'm the one writing the select statement and dealing with the parameter values, so since I'm not going to Attack my own system :) , I don't have to worry about this. Thanks again.
-
How do you quote parameters for an Oracle Select statement string when the parameter contains a quote?I understand your comment about not normalizing the feet and inches, but the value is stored in a text field as part of an inspection comment, which later I was asked to retrieve. I don't know how the comment was put in so, but the value is in the database, so I'd like to know how to quote the search value. Comments aside, how do you quote strings that already have quotes in them, either a single or a single and a double quote?
-
How do you quote parameters for an Oracle Select statement string when the parameter contains a quote?I've been quoting string parameters using single qoutes as follows:
QueryString = "Select * " & _ "From Employees " & _ "Where LastName = '" & EmpLastName & "'"
This works well unless the last name includes a quote, i.e., "Mc'Donald" So how do you quote the string in visual basic so that Oracle won't hang up on the interior quote? The same thing happens when you need to query or store feet and inches values ( 9'4" ). So how would I quote that? Thanks P.S., this is for Oracle 8i, if it makes a difference.
-
ComboBox custom web/server-side control - where's the data?This is a work around that I used after I got some help from Sebastián Streiger after posting a similar question on his article's feedback:
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) MyBase.OnInit(e) Try If Page.IsPostBack() Then ' The page can have many instances of this component, so don't want to push the ' cwcComboBoxInfo state class instance infomation through the ViewState, so put ' a reference to in a session variable, actually done at the end of the Render ' Sub. ' ' When the page is posted back, the component state is restored by setting the cwcComboBoxInfo to the reference value saved in the session variable. ' If Not HttpContext.Current.Session(cwcComboBoxInfo.ID) Is Nothing Then cwcComboBoxInfo = CType(HttpContext.Current.Session(cwcComboBoxInfo.ID), cwcComboBoxInfoClass) End If ' Get the postback data. LoadPostData() ' There is a bug in VS.NET 2003 that prevents the LoadPostData ' function from overriding/shadowing the listbox base class's ' IPostBackDataHandler.LoadPostData and RaisePostDataChangeEvent ' implementation, so call the LoadPostData function directly to ' get the posted data. End If Catch Ex As Exception Throw New cwcComboBoxException("OnLoad: Exception - Component " & Me.ID & ", " & _ Ex.Message) End Try End Sub ' ------------------------------------------------------------- ' The following was a suggested fix to the IPostBackDataHandler implmentation problem, but ' it didn't seem to help. Instead, Sebastián Streiger suggested that the Impments ... ' statement should be removed from the LoadPostData function and RaisePostDataChangeEvent Sub ' declarations. However, while this allowed me to compile the code it doesn't seem to get ' called by the .NET Framework. So I implmemented a override LoadPostData function with no ' parameters that I directly call from the OnLoad event sub above. Public Shadows Interface IPostBackDataHandler Function LoadPostData(ByVal sPostData
-
ComboBox custom web/server-side control - where's the data?Here is an important missing piece that needs to be added after the inherits statement:
Implements INamingContainer
Now I no longer get the conflicting messages, only one that says:
'System.Web.UI.IPostBackDataHandler.LoadPostData' is already implemented by base class 'System.Web.UI.WebControls.ListBox' and cannot be implemented again.
So now my question is how do I override or shadow the one in the base class so I can capture the rest of the data that my component sends back? My component is a combobox, and should send back the TextBox value and the ListBox Index. Even if getting the LoadPostData to work, it isn't clear to me how you get both of these data values out of it. The example code I've seen so far says that the Key value is the name of my component, which is used as an index in the NameValueCollection paramenter, so it seems to only be set up to get one value. Also, since I have two values, which one will it get?
-
Is it possible to add virtual controls to the DOM tree?Thanks again. I'll tackle this one after I get my PostBack Data working.
-
ComboBox custom web/server-side control - where's the data?Using the following code I can see my data:
Dim CBX1 As cwcComboBox.cwcComboBox = Me.cwcComboBox1 Dim CBX1Value As String Dim CBX1Values As String() CBX1Value = CBX1.Page.Request.Params.Get(CBX1.ID) CBX1Values = CBX1.Page.Request.Params.GetValues(CBX1.ID)
CBX1Value = "Three,3", CBX1Values(0)="Three", and CBX1Values(1)="3" So the data is there. However, when I try to access the data the "correct" way by declaring a LoadPostData function as follows:
Public Function LoadPostData( ByVal Key As String, ByVal PostData As NameValueCollection ) As Boolean _
Implements IPostBackDataHandler.LoadPostData
:
End FunctionThe compiler says that IPostBackDataHandler is not implemented by this class, but my custom component inherits from the ListBox webcontrol. So at the top of my class, after the inherits statement, I tried using:
Implements System.Web.UI.IPostBackDataHandler
But the compiler says its already implemented by the listbox base class, which seems to disagree with the earlier compiler error! Anyone know what's going on with this?