|
Heath Stewart wrote:
I may come off as a bit of an ass sometimes to some people
Damn the torpedoes, full steam ahead.
Andy
|
|
|
|
|
Hi.
How do i drag and move a window using the mouse, when the window do not have a titlebar???
I thought of using MouseDown, MouseMove and MouseUp to move it, but i can't seem to get it to work
As their an easier way??
|
|
|
|
|
may be this code can help you
add mousemove event and form_load event to your form and three variables x,y,click,first to your class
check this code is true or not.
private int x,y;<br />
bool click=false;<br />
bool first=false;<br />
private void Form1_MouseMove(object sender,System.Windows.Forms.MouseEventArgs e)<br />
{<br />
if(e.Button==MouseButtons.Left)<br />
{<br />
if(click&&first)<br />
this.Location=new Point(this.Location.X+e.X- x,this.Location.Y+e.Y-y);<br />
x=e.X;<br />
y=e.Y;<br />
click=true;<br />
first=!first;<br />
}<br />
else<br />
click=false;<br />
<br />
}<br />
<br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
x=this.Location.X;<br />
y=this.Location.Y;<br />
}
|
|
|
|
|
Great! that was exatly what i needed! thanks a bunch.
|
|
|
|
|
Back in the days of MFC, this was as simple as adding a handler for the WM_NCHITTEST (0x0084) message and returning HTCAPTION (2).
I just tried doing the equivalent of that on a C# project of mine but it didn't work!
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0084)
m.Result = (IntPtr)2;
base.WndProc(ref m);
}
What's also weird is that m.Result always comes in with a value of 0, no matter where I place the cursor on the form.
By the way, how did you create a form without a titlebar?
Regards,
Alvaro
He who laughs last, thinks slowest.
|
|
|
|
|
I think I've seen someone doing it in C# using Windows message processing like you show...
Forms can be created without titlebars via
myForm.FormBorderStyle = FormBorderStyle.None
The graveyards are filled with indispensible men.
|
|
|
|
|
Hi.
I have a batch-file that creates a logfile.
My C# Programm should read this file even if this will still be updated.
The (wonderful) editor "Textpad" can easily open that file ...
my C# Program can't .. I get 'file is used by another process' Error.
I already tried :
FileStream output = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read, FileShare.Read, 4196, true);
but I still get the error.
Can anyone help me PLEASE ??
|
|
|
|
|
Try using:
File myFile = File.Open(...)
using the version that takes a FileShare enumeration, and then create the FileStream from that.
|
|
|
|
|
Hi Eric.
I tried, like you said --- but this results in an error (File.Open returns a FileStream !).
He can't convert from FileStream to File .. so I assumed you meant :
FileStream myfile = File.Open(FILE_NAME, FileMode.Open, FileAccess.Read, FileShare.Read);
But this also causes the exception as before.
Or did I misunderstood you ?
|
|
|
|
|
When you specify sharing, you need to match the sharing that the file was opened with. In my tests, using FileShare.ReadWrite worked.
|
|
|
|
|
Like you said : It works !
I misunderstood the FileShare .. I thought that was for my access.
Thank you very much !
|
|
|
|
|
What's wrong with this code?
I'm trying to create a new Win32_NetworkAdapterConfiguration object using
C# and copy an older object into it. I get the "Provider is not capable
of the attempted operation" exception at the CopyTo
path = "Win32_NetworkAdapterConfiguration=1";
ManagementObject MyOldConf = new ManagementObject(path);
MyOldConf.Get();
path = "Win32_NetworkAdapterConfiguration";
ManagementClass MyClass = new ManagementClass(path);
MyClass.Get();
ManagementObject MyNewConf = MyClass.CreateInstance();
MyClass.Put();
tr("MyNewConf "+ MyNewConf.ToString());
MyOldConf.CopyTo(MyNewConf.Path); //ERROR!!!
Console.WriteLine("new conf : " + MyNewConf["Description"]);
|
|
|
|
|
How can write a program that dose not need any install or setup and all of dll or libreries be with program(for example only copy program in destination and progarm work)
|
|
|
|
|
You're gonna have to redistribute the .Net framework, largely because MS hasn't really pushed it to end-users yet.
There is an app I downloaded a day or two ago that allowed you to take only the portions of the .Net framework that your app uses and bundle it inside your executable (along with any other dlls needed by your app). Can't remember the name of it offhand...maybe someone else knows it.
The graveyards are filled with indispensible men.
|
|
|
|
|
Besides the .NET Framework (which MUST be installed), you can use touchless deployment by writing your application correctly, i.e. rely on .config files only (no registry).
The application I architected runs both from local or LAN machines, or from across the Internet or an intranet with no change. The assembly binding uses the current codebase of the application plus any private paths your config files specifies (see the <runtime> section documentation in the .NET Framework SDK).
You also need to worry about code access permissions, though. In .NET 1.0, the default Internet Zone allows no code to run. In .NET 1.1 some basic permissions are granted to code running from the Internet. You can change or add these code policies, though. There is plenty of documentation about code access security in the .NET SDK Documentation. Just look for "code access security". I'm also working on an extensive article or chain of articles but it'll be some time.
It's important to read, though, because you really must understand them before using them. You don't want to open someone's machine to attach by accident, and you want to make your application work with different permissions granted, i.e. some are required and some are optional. Take a look at the System.Security.Permissions namespace classes for more information about this stuff, as well as the documentation for code access security.
If you don't need to run from a remote source, you don't necessarily have to worry about it (although it's still a good idea to check permissions in your app before executing an action that requires them, otherwise a SecurityException is thrown). Just use COPY/XCOPY to copy your apps and dlls to the local machine and make sure they are in the right place. You can leave all the exes and dlls together with no problem. You can use the application configuration file to specify additional paths, similar to what ASP.NET Web Matrix does.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
For example,to add a new toolButton in the ToolBar of printPreviewDialog ,or add a new label or textBox in it.
thanks a lot.
|
|
|
|
|
You'll need to derive from PrintPreviewDialog and use a combination of adding and removing controls with the Controls collection property, and overriding the WndProc to handle lower-level functions.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
i have to protect my program so please if some one know any way to protect it from being coppied to another computer maybe( we use the computer number).
|
|
|
|
|
Take a look at my article at http://www.codeproject.com/dotnet/xmldsiglic.asp[^]
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
HI ,
I have made a procedure for sql server with visual c++ and i have test it on my computer and it is well but when i have move it to the server it could not work and it give me the following error
ODBC: Msg 0, Level 16, State 1
Cannot load the DLL sim.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
can any body help me
|
|
|
|
|
First, make sure it's in the Binn directory for the appropriate SQL server instance. I'm sure you've problem done that.
The big thing to remember is that servers often don't have the latest and greater technologies - only that which is required to run. My common mistake (I seem to make it every time but quickly realize what's wrong) is that I developed XP's in VS.NET 2002 or 2003 which uses the VC++ runtime 7.0 or 7.1 respectively. Our SQL Server doesn't have either of those runtimes. This is most likely your problem.
You can either "blindly" copied msvcr70.dll or msvcr71.dll and any other dependencies to %WINDIR%\System32 or to the appropriate Binn directory (or anywhere else in the %PATH%, although those two places are the logical choices). To make sure you get all the dependencies, run depends.exe (from the Platform SDK which was probably installed with your Visual Studio or is available for free online) on your XP (extended proc, not Windows XP ) and see what is required. Make sure those files exists on the server somewhere in the %PATH%. You could also copy depends to the server and run it on your XP from there - it'll tell you what's missing.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
thanks v.much it was the msvcr71.dll missing file on the server, but the strange thing that i have use wise installer to install that library from it, i have make an installation file which contain the merge module of VC++ library and it did not work so when i have copy the file to the server it works so thank you for your help and in the next time i will write this question in the SQL section
|
|
|
|
|
The merge module probably doesn't contain the right version of the VC++ runtime. To my knowledge (and I've beta tested and used WFWI since before 1.0), they have not yet released MSMs for newer runtimes (???). If they have, make sure you use the right MSMs. If nothing else, nothing special is needed to just copy them to the [SystemFolder] directory.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Oh...and wrong forum! This would be better in the VC++ or SQL forum (and more is more likely to get answered there). Just for future reference...
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
When I try writing a mathematic expertion with a right to left language in textbox or list box arrange of words change and expertion left to right arrange (for mathematic expertion) change to rihgt to left and it will be more confusing and not readable please tell me how I can stop this conversion
|
|
|
|