|
That won't work for managed dlls. Either use them as COM objects, or use Managed C++ to interface to them.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
I need some help, bad. In trying to make a external macroing program. Were im stuck is at the part were you have the program automaticly send a key message to your program of choice. An example would be I hit the 'a' key and that tells the program to run a script. That uses keys and delay timers. All the code I have found is just about getting what key is pressed. I need the program to tell a nother program. Hay use this key then this key ect.
Thanks
|
|
|
|
|
it's possible to use hooks to send messages from one app to annother (search the forum for examples). IF you want to do something beyond what can be easily done by feeding the controlled app simulated user input you're dependent on the apps authors having provided some means to facilitate automation.
|
|
|
|
|
Thanks Dan, Ill see what i can dig up
|
|
|
|
|
I've posted this question before but i've not specified an important thing.
If i open a File in FileStream with FileAccess.Write, it is locked so i can't rightclick on it and copy or delete or move...
Is it possible in any way? ( I don't close the application or close the stream)
|
|
|
|
|
The operating system is being "nice" by honoring the file lock. What possible use case do you have to move a file that is still opened and being written too?
|
|
|
|
|
simply becouse it is a file that is created by my program and it is used just by my program.
When my program close the file is deleted.
I want to know if someone in some way can get that file durign my application running if my application is using it!!!
|
|
|
|
|
It is in the end just bits on a disk. If someone wanted to they could read it (unplug/cause a kernel memory dump, reboot and read the file). The file locking mechanim is strictly not a security feature: it is there to maintain a consistent IO for running applications. If you really want a file that is secured, then you must use security mechanism.
|
|
|
|
|
Hi!
I have already posted this question in this forum, but I have not yet got any response. So i have decided to post it again.
I am trying to create a RubberBand when cropping an image from a PictureBox using the mouse.
All is well when drawing the rectangle with the help of MouseDown, MouseMove and MouseUp events.
I don't know how to maintain aspect ratio of the rectangle when drawing it over the picture box (as in Adobe PhotoShop).
I can mail you my code for your reference.
Any Idea will be helpful.
-- modified at 12:12 Tuesday 25th October, 2005
|
|
|
|
|
I would think a simple approach to doing this would be to define a double aspect which you set to height/width of the original image (you'd need to put some checks in to avoid possible divide by zero exceptions here).
Then when tracking the rectange take whichever is largest of the (absolute) new width or new height and determine the value of the other variable (new height or new width) by multiplying/dividing this by aspect ...if that makes any sense?
If you think of a straight line being defined as y = mx + c, the gradient (m) of a line going through the bottom left and top right corners of the rectange should remain constant whatever the size of the rectangle.
Rob Philpott.
|
|
|
|
|
Memory Stream Problem :
I have a component class which access a local file and writes the contents of the file to a Memory using MemoryStream. This
is accomplished a method called "Initialize()". This method returns the MemoryStream object. This Class is shown below:
using System;
using System.IO;
using System.Net;
using System.Text;
namespace MemWriterComponent
{
public class MWC
{
//Private variables
private MemoryStream ms; //Used for writing to memory
private FileStream fs; //Used for reading local file
private string data; //string variable for holding data
public MWC()
{
//initialize private variables
ms = new MemoryStream();
}
//public method Initialize() which reads the local file and returns
//memory stream
public MemoryStream Initialize()
{
string fileName =
"D:\\NET_Prog_Samples\\Chapter2\\MemoryStreamExample\\MemWriterComponent\\bin\\Debug\\testy.txt";
//initialize the file stream object
try
{
fs = new FileStream(fileName,FileMode.Open,FileAccess.Read );
//read the contents of the file
byte[] bytesIn = new byte[fs.Length];
fs.Read(bytesIn,0,bytesIn.Length);
data = Encoding.ASCII.GetString(bytesIn);
//close fs
fs.Close();
fs= null;
//Write the read data into the memory
byte[] bytesOut = new byte[data.Length];
bytesOut = Encoding.ASCII.GetBytes(data);
ms.Write(bytesOut,0,bytesOut.Length);
return ms;
}
catch(Exception ex) {
Console.WriteLine(ex.ToString());
return new MemoryStream();
}
}
}
}
The second class (Console Application) tries to retrieve the contents from memory location. I made a reference to
MemWriterComponent, initialized the object and then tries to retrieves the contents from memory. This class is shown below:
using System;
using MemWriterComponent;
using System.Text;
using System.IO;
namespace MSReader
{
///
/// Summary description for Class1.
///
class MSR
{
[STAThread]
static void Main(string[] args)
{
try
{
//initialize the MWC component
MemWriterComponent.MWC mw = new MemWriterComponent.MWC();
MemoryStream msReader = mw.Initialize();
byte[] bytesIn = new byte[msReader.Length];
msReader.Read(bytesIn,0,Convert.ToInt32(msReader.Length));
string dataIn = Encoding.ASCII.GetString(bytesIn,0,bytesIn.Length).ToString();
Console.WriteLine(dataIn);
//clean up code
msReader.Close();
mw=null;
Console.ReadLine();
}
catch(Exception ex) { Console.WriteLine(ex.ToString());}
}
}
}
Problem is running a client doesn't give any error(s). But also doesn't print any thing.
If i try to retrieve Size of Memory Stream using Console.WriteLine( msReader.Length). the output is 611 bytes... which is
incidently the size of the file "testy.txt".
What am i doing wrong?
any suggestions???
|
|
|
|
|
farhan1976 wrote: Problem is running a client doesn't give any error(s). But also doesn't print any thing.
well you didnt write anything to print though it normal...
farhan1976 wrote: Problem is running a client doesn't give any error(s). But also doesn't print any thing.
If i try to retrieve Size of Memory Stream using Console.WriteLine( msReader.Length). the output is 611 bytes... which is
incidently the size of the file "testy.txt".
well it sure does or it would be a problem ^^
|
|
|
|
|
In the component Class, I did write data to the Memory stream - I opened Local File and read its contents -> string variable : data
//read the contents of the file
byte[] bytesIn = new byte[fs.Length];
fs.Read(bytesIn,0,bytesIn.Length);
data = Encoding.ASCII.GetString(bytesIn);
//close fs
fs.Close();
fs= null;
//Write the read data into the memory
byte[] bytesOut = new byte[data.Length];
bytesOut = Encoding.ASCII.GetBytes(data);
ms.Write(bytesOut,0,bytesOut.Length);
return ms;
|
|
|
|
|
my guess is that you need to do a ms.position=0; before returning ms.
|
|
|
|
|
hi
I need write a progam in .Net (c# or vb.net):
The program should display in a monitor(tv) video files(e.g. *.avi, *.mpg, ...) and also display TV channnels(analogical signal) depending on a schedule(user defined)
what I must use? ... ¿Managed DirectX?
Helpme please
|
|
|
|
|
hi
I need write a progam in .Net (c3 or vb.net):
The program should display in a monitor(tv) video files(e.g. *.avi, *.mpg, ...) and also display TV channnels(analogical signal) depending on a schedule(user defined)
what I must use? ... ¿Managed DirectX?
Helpme please
|
|
|
|
|
Hello,
Is there a way of changing the captions of MessageBox buttons to something else? Or, if I want different buttons' captions I have to create my own dialog box?
Thank you.
|
|
|
|
|
You'll need to create your own dialog box. The MessageBox class is pretty well sealed up and you can't do much with it beyond what it's supposed to do. It shouldn't take more that five minutes to whip up your own dialog box class in Visual Studio anyway.
|
|
|
|
|
|
Is there a tutorial on the different events and their sequence of firing for a typical windows forms form?
I am curious about comparing the event sequences from MFC to windows forms.
.............................
There's nothing like the sound of incoming rifle and mortar rounds to cure the blues. No matter how down you are, you take an active and immediate interest in life.
Fiat justitia, et ruat cælum
|
|
|
|
|
i have a problem i need to diasble the print screen in my application.
i have been program my application by using C# language and i need to prevent any user from copying any desplayed image on it.
i have been search alot but i couldnt find any.
i try to learn programming what ever i had i feal that i did'nt get anything
|
|
|
|
|
What do you mean by "disable the print screen"? You want to stop people copying text off your application using the clipboard? You want to stop people taking screenshots (in which case, I think you're out of luck!)?
|
|
|
|
|
You can disable print screen keys (PrtScrn and Alt-PrtScrn) by redirecting the hot keys to your applications main window. But there is no way you can't stop another application, like ScreenGrabber, from grabbing the screen, and your graphic images.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I thought dvd player apps could prevent 3rd party apps from doing screen grabs. I assume they do it by accessing hardware at a lower level than the win32api provides access to.
|
|
|
|
|
Not really. You're grabbing exactly what you should, the image in the frame buffer. The frame buffer just happens to be blank in the video window. The video you're seeing isn't being shown in this frame buffer, but is an overlay rendered by a different part of the video card.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|