|
Not sure. You might want to look around on CR specific forums
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
how can I use this code (sp_attach_db and sp_detach_db ) for running my programme in another pc ?
|
|
|
|
|
these are sql functions, you need to install sql in that pc to run your application
Becoming Programmer...
|
|
|
|
|
Read documentation on them. They are SQL stored procedures...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi gurus,
In an app. I need to have a Multiview control, like ASP.NET Multiview, to show different set of controls at a time to the end-user. As far as I know there is not such a control in .NET for WinForm apps. I also tried to hide TabbedControl's tabs and hide/show pages via code but I did not manage to do it.
Can anyone help me how to solve this problem out?
Thanks
Aref
|
|
|
|
|
Hi there,
I'd really appreciate any insight on the following problem:
I have a Luminary Cortex-M3 development board on a USB port. Luminary drivers offer a COM (COM15) port over USB and my board is writing to the port, 115200-8N1. Using a terminal program I do get the text from the board. When trying to write a C# program to read the data, I either het \0's or nothing at all. Writing to the board works fine. Environment is Microsoft Visual C# 2008 Express Edition and .NET Framework 3.5 on Vista Home Premium.
The code is as follows:
using System.IO.Ports;<br />
...<br />
private SerialPort port = null;<br />
...<br />
port = new SerialPort("COM15", 115200, Parity.None, 8, StopBits.One);<br />
port.Open();<br />
bool stop=false;<br />
while(!stop){<br />
while (port.BytesToRead>0)<br />
{<br />
int c=port.ReadByte();
}<br />
}<br />
...
Any idea what's going wrong? And please note that writing to the board succeeds and receiving data with a terminal program succeeds ?
Thanks in advance
Cheers
Matti
|
|
|
|
|
This is only a guess but i'd say it is serial port emulation driver your driver.
When you emulate a COM port over USB it doesn't operate the same as a hardware
com port.
Try sending the thread to sleep between 100 - 200ms before reading the byte.
Thread.Sleep(100);<br />
int c = port.ReadByte();
See if this helps.
Regards
A craft is an enemy if not well learned.
|
|
|
|
|
Thanks Mick, good try but didn't help, there's something else going wrong d
|
|
|
|
|
Hi,
I want to update the database table rows by using the grid view ...i know how to do this the problem is regarding the code which i have to write ..so is there any way (shortcut) to update or manipulate the database with out involving much code ......
......this question may reflect my lazyness but if anyone is having any idea so plz do let me know
regards
sindhu tiwari
Thanks to code project and all the members of it who have helped me
regards
sindhu tiwari
Merry Xmas ...happy new year.....***
its me sid
|
|
|
|
|
I have a picturebox (imgViewer) which is displaying an image (a map). Now i want to display another image (a smaller one) on top of this image. But this smaller image is a GIF animation of a blinking siren.
But when i paint it on the picturebox, the overlapping of the two images is being displayed properly, but it comes as a static image with only the first frame of the animation being shown.
This is the code I am using:
<br />
private void btn_Path_Click(object sender, EventArgs e)<br />
{<br />
Bitmap path = new Bitmap(@"C:\Engg\Siren.JPG");<br />
Graphics graph = Graphics.FromImage( this.imgViewer.Image );<br />
graph.DrawImage(path, 0, 0);<br />
<br />
graph.Dispose();<br />
}<br />
(Thanks to CKnig for the code above)
How can i make the GIF animation properly display as I want the blinking effect. Thanks in advance!!
|
|
|
|
|
You can't. A picture box shows one image, and it's not animated.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
PictureBox can display animated GIF. I do this frequently.
|
|
|
|
|
|
Hi.
I am still rather new to C# and realise this might be overly ambitious, but I am trying to create a reusable class that will capture keyboard input. I mostly want it so i can use hotkeys in my apps, but I cant even get a basic version working...
The class is finding the keyboard input ok, ie it will display keys pressed in a message box, so it is working that way.
What i cant get to work is for it to raise an event when a key is pressed (this will later be modified so only when specific combinations are pressed). I think part of the problem is that several of the methods are static, and therefore there is no object that can be associated with the event.
How do i set it up so the event is fired whenever a keypress occurs?
The code i am using is posted below.
<br />
public frmControl()<br />
{<br />
kHook.KeyPressEvent += new KeyEventHandler(kHook_KeyPress);<br />
}<br />
<br />
void kHook_KeyPress(object sender, KeyEventArgs e)<br />
{<br />
string keyPressed = ((Keys)e.KeyValue).ToString();<br />
MessageBox.Show(keyPressed);<br />
}<br />
<br />
class KeyboardHook<br />
{<br />
public bool isHookActive = false;<br />
private const int WH_KEYBOARD_LL = 13;<br />
private const int WM_KEYDOWN = 0x0100;<br />
private static LowLevelKeyboardProc _proc = HookCallback;<br />
private static IntPtr _hookID = IntPtr.Zero;<br />
<br />
public KeyboardHook()<br />
{<br />
}<br />
<br />
public void StartKeyboardHook()<br />
{<br />
_hookID = SetHook(_proc);<br />
isHookActive = true;<br />
}<br />
<br />
public void StopKeyboardHook()<br />
{<br />
UnhookWindowsHookEx(_hookID);<br />
isHookActive = false;<br />
}<br />
<br />
private static IntPtr SetHook(LowLevelKeyboardProc proc)<br />
{<br />
using (Process curProcess = Process.GetCurrentProcess())<br />
using (ProcessModule curModule = curProcess.MainModule)<br />
{<br />
return SetWindowsHookEx(WH_KEYBOARD_LL, proc,<br />
GetModuleHandle(curModule.ModuleName), 0);<br />
}<br />
}<br />
<br />
private delegate IntPtr LowLevelKeyboardProc(<br />
int nCode, IntPtr wParam, IntPtr lParam);<br />
<br />
public static IntPtr HookCallback(<br />
int nCode, IntPtr wParam, IntPtr lParam)<br />
{<br />
if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)<br />
{<br />
int vkCode = Marshal.ReadInt32(lParam);<br />
KHookArgs kh = new KHookArgs(vkCode);<br />
KeyPressEvent(kh);<br />
}<br />
return CallNextHookEx(_hookID, nCode, wParam, lParam);<br />
}<br />
<br />
public delegate void KeyPressHandler(KHookArgs kh);<br />
<br />
public event KeyEventHandler KeyPressEvent;<br />
<br />
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]<br />
private static extern IntPtr SetWindowsHookEx(int idHook,<br />
LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);<br />
<br />
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]<br />
[return: MarshalAs(UnmanagedType.Bool)]<br />
private static extern bool UnhookWindowsHookEx(IntPtr hhk);<br />
<br />
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]<br />
private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode,<br />
IntPtr wParam, IntPtr lParam);<br />
<br />
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]<br />
private static extern IntPtr GetModuleHandle(string lpModuleName);<br />
}<br />
<br />
public class KHookArgs : EventArgs<br />
{<br />
private string keyValue;<br />
<br />
public KHookArgs(int k)<br />
{<br />
keyValue = ((Keys)k).ToString();<br />
}<br />
<br />
public string ReturnKey()<br />
{<br />
return keyValue;<br />
}<br />
}<br />
|
|
|
|
|
Have you tried calling the StartKeyboardHook() method before testing?
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
There are many articles on codeproject that show how to implement keyboard hooks in c#. There is also one article targeting hotkeys.
|
|
|
|
|
i have developed a webproject(vs.net 2005) and we want to attach Trail version evaluation period for the project (say 30 days).
What are the best ways to implement so that no body can break?
we already tried of storing some porperties in registry but any body can break.
|
|
|
|
|
Member 1837661 wrote: What are the best ways to implement so that no body can break?
You're dreaming. Every protection scheme in use today, and for the forseeable future, no matter how elaborate, is breakable.
|
|
|
|
|
Dave Kreskowiak wrote: Every protection scheme in use today, and for the forseeable future, no matter how elaborate, is breakable.
You beat me to that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
The beauty of a web app is, it's online. The internet is bound to get involved in any really secure protection. Of course, because your code is C#, it's trivial to use a reflection tool to access the source, so no protection is ever going to come close to being unbreakable.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Host it yourself for them. Charge them for the hosting and maybe a one time fee, that is the safest way I have found to do it, the only way I will do it.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Expert Coming wrote: Charge them for the hosting and maybe a one time fee
Do you have any idea what a reasonable fee would be? My guess is pretty much what ever you want the profit to be after your costs.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi Member 1837661,
Member 1837661 wrote: What are the best ways to implement so that no body can break?
Impossible due to Untrusted Hardware and untrusted Operating System [1].
Jeff
[1] J. Giffin, M. Christodorescu, and L. Kruger, Strengthening Software Self-Checksumming via Self-Modifying Code, pp. 23-32, Proceedings of the 21st Annual Computer Security Applications Conference (ACSAC), 2005, ISBN 0-7695-2461-3.
|
|
|
|
|
|
Jeffrey Walton wrote: Does Microsoft offer any built in support for CAB file extraction yet?
In the .NET BCL?? Nope, not that I've found.
|
|
|
|