|
|
Like i said in the first post, ive used send key but it only works on the top program wich isn't always applicable, unless thier is some way of making it work on any running program
|
|
|
|
|
S0200356 wrote:
Like i said in the first post, ive used send key but it only works on the top program wich isn't always applicable, unless thier is some way of making it work on any running program
No, you can't. SendKeys uses the Windows API SendInput, which will generate keypresses as if they came from the keyboard driver, and will generate the proper messages for the topmost program.
I don't recall where I read that you need to use this API, and that SendMessage wasn't a reliable API for emulating keypresses. Sorry if I can't be more useful than this.
I think you can find almost everything about the keyboard in Windows here[^]
Yes, even I am blogging now!
|
|
|
|
|
hi there!
I don´t know if I this doubt is for this forum. (sorry if it isn´t)
I´m working with the WMEncoderLib and I want to know when the encoding process ends.
I saw a MSDN example and the last statement is like this...
// Start the encoding process.
// Wait until the encoding process stops before exiting the application.
Encoder.PrepareToEncode(true);
Encoder.Start();
Console.WriteLine("Press Enter when the file has been encoded.");
Console.ReadLine(); // Press Enter after the file has been encoded.
this example suppose that we press enter when the encode process finish. But I can I know that this process is finish?!! How can I change this code to make the program exit when the encoding finish?!
Thanks
|
|
|
|
|
ee99035 wrote:
But I can I know that this process is finish?!!
You could attempt to make the call asynchronous through BeginInvoke and EndInvoke . Have you looked into this?
- Nick Parker My Blog | My Articles
|
|
|
|
|
I already solve my problem
thanks
|
|
|
|
|
|
Ok here's my problem:
I've created a setup project that installs my application on a computer, and creates a shortcut to this application on the Desktop.
This application uses a configuration file that is supposed to be in the same directory as the application (save to "./configfile.cfg"). This file is updated every time the application is closed.
Also, in my application, the user can save a different type of file by himself, using a SaveFileDialog.
The problem is:
When the user saves a file during a session with my application (say, in My Documents), the configuration file ends up in the same directory (ie. My Documents).
BUT when the user doesn't save any file during the session, the configuration file ends up at the right place.
Does anyone know what's going on???
|
|
|
|
|
Could you post the code for saving with SaveFileDialog and saving of your configuration file.
www.troschuetz.de
|
|
|
|
|
Ok here's the code for my configuration file:
FileStream file = new FileStream("./config.cfg", FileMode.OpenOrCreate, FileAccess.Write);<br />
BinaryFormatter formatter = new BinaryFormatter();<br />
formatter.Serialize(file, network);<br />
file.Close();
And here's my code for saving the user file with a SaveFileDialog:
saveFile.Filter = "Events Tables files (*.etf)|*.etf|All files (*.*)|*.*" ;<br />
saveFile.FilterIndex = 1;<br />
DialogResult result = saveFile.ShowDialog();<br />
if(result == DialogResult.Cancel)<br />
return;<br />
FileStream file = new FileStream(saveFile.FileName, FileMode.OpenOrCreate, FileAccess.Write);<br />
BinaryFormatter formatter = new BinaryFormatter();<br />
formatter.Serialize(file, events);
file.Close();
|
|
|
|
|
Don't use the relative path string to open the filestream to your config file. Better
string path = Application.StartupPath + Path.DirectorySeparatorChar + "config.cfg";
FileStream file = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
www.troschuetz.de
|
|
|
|
|
Thanks a lot!
|
|
|
|
|
Hi guys,
i am using c# in my web app for the first time and have no clue how to get retrieved records to bind to a textbox.
i have successfully connected to the db and have databinded a few datagrids but i can't seem to get the textbox to show a value retrieved from the db.
please could someone be kind enough to show me the correct way to go about this.
thanks so much
|
|
|
|
|
|
I have a situation where I am reading a MS SQL database table containing user
names and passwords in a C# program.
After applying Server Pack 3 to SQL to this database I can no longer get a user
to successfully logon.
The program is in C# and the particular line of code is:-
dr["Passwrd"] = AE.GetBytes(password);
How can I resolve this.
Regards,
Alf
|
|
|
|
|
AlfCStockton wrote:
dr["Passwrd"] = AE.GetBytes(password);
The first thing I would suggest is to check and see what AE.GetBytes(password) is returning before you assign the value.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hello,
When I try to start a program from my mainwindow I get the error below. Anyone knows where I should look to solve this?
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.IO.FileNotFoundException: File or assembly name bison1.dll, or one of its dependencies, was not found.
File name: "bison1.dll"
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName)
at Bison.Shell.LoadModule(ModuleInfo moduleInfo) in c:\begvcsharp\mditest\bison-kit\shell\shell.cs:line 163
at Bison.Shell.ActivateModule(Int32 moduleIndex, Boolean releaseActive) in c:\begvcsharp\mditest\bison-kit\shell\shell.cs:line 182
at Bison.Shell.menuItem2_Click_1(Object sender, EventArgs e) in c:\begvcsharp\mditest\bison-kit\shell\shell.cs:line 209
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\begvcsharp\mditest\Bison-kit\shell\bin\Debug\bison1.dll
LOG: Appbase = C:\begvcsharp\mditest\Bison-kit\shell\bin\Debug\
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/begvcsharp/mditest/Bison-kit/shell/bin/Debug/bison1.dll.
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
shell
Assembly Version: 1.0.1781.27225
Win32 Version: 1.0.1781.27225
CodeBase: file:///C:/begvcsharp/mditest/Bison-kit/shell/bin/Debug/shell.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
interfaces
Assembly Version: 1.0.1781.27225
Win32 Version: 1.0.1781.27225
CodeBase: file:///C:/begvcsharp/mditest/Bison-kit/shell/bin/Debug/interfaces.DLL
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
regards,
Stefan.
|
|
|
|
|
Make sure the assembly bison1.dll is in the your executable's folder. U have a direct reference to it in your code (shell object, line 182). If u dont, then u must be using third party assemblies and the references are contained within those. In that case you will need to get a copy of the bison1.dll file.
|
|
|
|
|
Thanks again for your help. I needed quite some time to get my solution working, one of the things was assigning one outputpath for all projects in their properties.
regards,
Stefan.
|
|
|
|
|
is there a way I can access programs that are shown in the control panel and remove them? I can't find a way to open the control panel and then the remove programs option with code. How is the uninstallation of a program started then? thanks for the help. is this done through the registry?
danke schon. Aber Ich spreche Deutsch nicht wohl.
|
|
|
|
|
As the Subject asks, how can I store data in a SQL database which I take frome a DataGrid, I'm specially curios about the combined SQL C#-vars Command String.
I'm new in C# and I already get data from SQL to the DataGrid, I nowhere found an article about. Even not in Cookbooks.
PS: Is it possible to set every DataGrids Column Width to an own value?
tnx for Help
|
|
|
|
|
Check info on:
System.Data.SqlClient.SqlDataAdapter and specially the Update() and System.Data.SqlClient.SqlCommand
More info here:
SqlDataAdapter[^]
|
|
|
|
|
Is there a namespace in C# for grabbing a computer's information? with tools like MSINFO32, I can see that the objects do exist to retrieve that info, i just cant find it.
If c# doesnt have it, it should be possible to create a dll in c++ or vb.net to retrieve it, then grab that in C#, correct?
Yes, I am the highly suggestable type.
|
|
|
|
|
try using static object System.Environment.
|
|
|
|
|
Hi
I am writing a socket server for plain old TCP connections. I am just having real trouble trying to determine whether or not a remote connection (from eg. a telnet client) is in fact still active. The only good way it seems to do it is to send data to the connection and to see if it throws a socket exception. There must be a better way to determine that the telnet client has closed his session.
Does anyone know how I can do this?
|
|
|
|