|
Thank you!
That was the problem. The mnenonics was screwing it up.
|
|
|
|
|
Hello all,
I have this question of which I'm not able to find any solution on the internet. So I thougt that I could find one here.
I have a device hooked up to the serial port which provides the ability to connect analog potmeters to it. Now I'm able to get these ADC values and I want to pass these to windows OS to handle them further. The intention is that a game will see this as a joystick and can use the analog potmeters as joystick axis. I've done some reading about writing a device driver, but how do I make windows see my device as a joystick? Any help is much appreciated. I'm working mainly with C#.
Danny
|
|
|
|
|
|
Well, it is not the serial part that forms any difficulties. But I have this value of a Potmeter, which I aquired through a serial device, that I want to use as a joystick axis in games. So I want to pass this value to windowsXP so that it treats this as a joystick-axis. In other words, how do I simulate a joystick is connected which I can pass this value to in windows. I hope this is more clear what I mean.
Danny
|
|
|
|
|
Ah. Once you've acquired the coordinates from the pot, set the Cursor.Position property to move the cursor.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I do not want to control the mouse-cursor via a joystick, but I want joystick input like normal when a joystick is attached to the gameport. Now I have potmeters via a serial device which I want to use as the axis. How do I make windows see my joystick axis so I can use them in a game that supports DirectInput for joystick input.
Danny
|
|
|
|
|
Hi,
Is there any way to programmatically open the Shell file/folder properties dialog for a given file? Is it possible to open this dialog to a given tab?
Thanks,
DigitalKing
|
|
|
|
|
DigitalKing wrote: Is there any way to programmatically open the Shell file/folder properties dialog for a given file?
Yes.[^]
[edit]
Sorry - I was hasty in posting this note. See this[^] link instead. You'll need to convert the code to C#.
[/edit]
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Great! Thanks.
In case anyone else is interested, here's the code I came up with.
private const uint SW_SHOW = 5;
private const uint SEE_MASK_INVOKEIDLIST = 0xC;
private struct SHELLEXECUTEINFO
{
public int cbSize;
public uint fMask;
public IntPtr hwnd;
public string lpVerb;
public string lpFile;
public string lpParameters;
public string lpDirectory;
public uint nShow;
public uint hInstApp;
public string lpIDList;
public string lpClass;
public IntPtr hkeyClass;
public IntPtr dwHotKey;
public IntPtr hIcon;
public IntPtr hProcess;
}
[DllImport("shell32.dll")]
private static extern long ShellExecuteEx(ref SHELLEXECUTEINFO s);
public static void DisplayFileProperties(string path)
{
SHELLEXECUTEINFO shInfo = new SHELLEXECUTEINFO();
shInfo.lpFile = path;
shInfo.nShow = SW_SHOW;
shInfo.fMask = SEE_MASK_INVOKEIDLIST;
shInfo.lpVerb = "properties";
shInfo.cbSize = Marshal.SizeOf(shInfo);
ShellExecuteEx(ref shInfo);
}
|
|
|
|
|
hi
i want to change datagrid properties in form1 from other forms .. how to do this ???
i tested some waye (using public modifier for datagrid in form1 or using property to return datagrid properties or method that change datagrid properties from other forms but did't get result)
Please Help me how to this ???? (please give me a full details solution because i am beginner)
thanks ..
|
|
|
|
|
hi i want to save app setting in file and load it for next times ...
how to do this ???
(Please give me a full tutorial because i am beginner . thanks)
regards...
|
|
|
|
|
|
hi and thanks
the xml app setting is useful but only save string values . for example i want to save
datagrid1.AlternativeBackColor in app.config and retrieve it in form.load event . how to do this ?
thanks ...
|
|
|
|
|
hdv212 wrote: want to save datagrid1.AlternativeBackColor
AFAIK, the config file only stores strings. You could easily convert the color to a numeric value and store its string representation (name or RGB values) and do the reverse on the way out.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
How to convert a Color object to and from a string, for storing somewhere, has already been answered in your previous post regarding saving this value to the registry.
Please check there first. Once you understand this, the question of how to write it/read it to some form of configuration file is easy, and should be explained in the article linked above.
|
|
|
|
|
This just baffles me!
I know it is something simple and right under my nose but cant figure it out
static void Main(string[] args)
{
MessageBox.Show(args[0]);
}
How do i pass in arguments prior to running this program.
|
|
|
|
|
1) Create a link, and add them to the textbox that points to your program
C:\Programs\MyFile.exe -parameter1 -parameter2
2) Open the command prompt and do the same:
> MyFile.exe -parameter1 ...
3) In Visual Studio:
Menu: "Project -> [Program] properties..."
Then on the left: "Debug" and in the middle: "Command line arguments"
There are plenty of other possibilities, but these are the most common ones.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Alternatively, create a shortcut to your application and edit the shortcut by Right-clicking and selecting properties.
On the 'Shortcut' tab, just add the arguments you want in the target box so:
Target: "C:\program files\my app\my app.exe"
would become:
Target: "C:\program files\my app\my app.exe" myArgument1 myArgument2
This way you can setup different shortcuts that each pass different arguments.
Hope this helps.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Thanks!!!
new it was something easy
|
|
|
|
|
Hi folks,
I have a problem concerning a TraceSwitch I'm using in one of my recent projects:
I have a library assembly which is being referenced from a Windows service. Within this library I have several classes, dealing with file searching and parsing. the classes are designed for general use, so I don't write errors from the library in the Event Log. To enable tracing in the library I created a static class with two static members, the switch and the TraceListener (will write to a text file). For the library I created an App.config file withe the following XML code:
<br />
<system.diagnostics><br />
<switches><br />
<add name="ParsingLibTraceSwitch" value="3" /><br />
</switches><br />
</system.diagnostics><br />
The code for the Tracing class is like this:
<br />
namespace ParsingLib<br />
{<br />
public static class Tracing<br />
{<br />
private static TraceSwitch tracer = new TraceSwitch ( "ParsingLibTraceSwitch",<br />
"Enables tracing for the ParsingLib assembly" );<br />
<br />
private static TextWriterTraceListener traceListener = <br />
new TextWriterTraceListener ( "ParsingLib_Trace.txt" );<br />
<br />
public static TraceSwitch Switch<br />
{<br />
get { return tracer; }<br />
}<br />
<br />
public static TraceListener Listener<br />
{<br />
get { return traceListener; }<br />
}<br />
}<br />
}<br />
However, if I run and debug the service, the TraceLevel of the Switch is always TraceLevel.Off.
Does anyone of you have an idea what's wrong with the code? I'm using VS 2005.
Thank you in advance.
|
|
|
|
|
hi
i want to save app setting in registry (for example dataGrid1.AlternatingBackColor)
and this is way that i used for save value to registry :
RegistryKey regkey = Registry.CurrentUser.CreateSubKey(@"SST\Full_SaveSetting\Setting");
regkey.SetValue("Datagrid_AlternatingBackColor",dataGrid1.AlternatingBackColor);
and when i load dataGrid1.AlternatingBackColor from registry as following :
RegistryKey regkey = Registry.CurrentUser.CreateSubKey(@"SST\Full_SaveSetting\Setting");
dataGrid1.AlternatingBackColor=(System.Drawing.Color)regkey.GetValue("Datagrid_AlternatingBackColor");
An unhandled exception of type 'System.InvalidCastException' occurred in it :
Additional information: Specified cast is not valid.
how to cast regkey value to color to solve my problem ????????
|
|
|
|
|
I haven't tested your code but have you tried reading/writting the ARGB value to/from the registy?
It would be something like:
dataGrid1.AlternatingBackColor.ToArgb();
<br />
dataGrid1.AlternatingBackColor = System.Drawing.Color.FromArgb( argbValueGoesHere );
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
hi and thanks ::
but what is the argbValueGoesHere ?
and System.Drawing.Color.FromArgb() get an integer value and when i pass
regkey.GetValue("Datagrid_AlternatingBackColor")
to it don't accept it and when i cast it to int as following :
(int)regkey.GetValue("Datagrid_AlternatingBackColor")
it say me :
Specified cast is not valid.
how to do that ????
|
|
|
|
|
OK, the pointer should have been enough, but this is a sample from your code example:
To write color to the registry:
RegistryKey regkey = Registry.CurrentUser.CreateSubKey(@"SST\Full_SaveSetting\Setting");<br />
regkey.SetValue("Datagrid_AlternatingBackColor", dataGrid1.AlternatingBackColor.ToArgb() );
To read color from the registry:
RegistryKey regkey = Registry.CurrentUser.CreateSubKey(@"SST\Full_SaveSetting\Setting");<br />
dataGrid1.AlternatingBackColor = System.Drawing.Color.FromArgb( (int)regkey.GetValue("Datagrid_AlternatingBackColor") );
Personally, I think that using the registry to store this kind of information is a bad idea, just think, if the user wants to load the app on another machine, these preferences would have to be re-configured on the new machine. There are other ways EG using the app.config file etc.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
How can i remove the left row selection in a DataGrid control using C# ?
M.Gamal
|
|
|
|