|
Generate the assembly with a different name, like Interop.SHDocVw.dll, which is what VS.NET would call it if you did imported the typelib in the shdocvw.dll library by adding a COM references in the Add Reference dialog.
If you're using tlbimp.exe, use command line switches like this:
tlbimp /out:Interop.SHDocVw.dll %WINDIR%\System32\shdocvw.dll Type the following for more information about the switches available for tlbimp.exe:
tlbimp /? You should also consider signing this and keeping it in a global directory that's easy to reference. If you do sign it, you can install it in the GAC. Believe me, this is a common assembly in many applications, except that everyone signs it with a different key, if they sign it at all (production code should always be signed to help protect the integrity of the product, not to mention it's so easy there's no excuse not to).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You can convert the components of SHDOCVW.DLL to ActiveX components.
NOTE: This requires Visual Studio .Net!
Copy the file: C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin\AxImp.exe in any directory.
Then make a shortcut (or a link [I don't know the English word for it ]) to this file.
Type this text in "target" field:
"[location]\AxImp.exe" [path] [path] is the dll file to convert.
After doing that in the directory will be following files:
AxSHDocVw.dll and SHDocVw.dll !
Reference the file AxSHDocVw to your project.
An instance of a Browser Object looks like this:
private AxSHDocVw.AxWebBrowser axWebBrowser1;
You can use this Object like any other Windows Components.
If there are any questions left, let me know!
Good luck!
|
|
|
|
|
petermax2 wrote:
NOTE: This requires Visual Studio .Net!
No it does not, Aximp.exe comes with the .NET SDK, which is free to download. Also, if you have Visual Studio .NET, you can easily add the web browser from the toolbar and it will automatically generate the interop assemblies for you.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Why go to all that trouble to execute aximp.exe or any SDK utility for that matter? Simly add "C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin" to your PATH environment variable in your System control panel. This environment variable is used to resolve executable paths when you run a problem. If it exists in the PATH, you don't need to type the full path to the executable file. It's also used by the executable loader to locate DLLs that need to be mapped into the process space.
While you're at it, also add the Framework directories (ex: "C:\Windows\Microsoft.NET\Framework\v1.1.4322" so you can use the compilers and the assemblier without typing the full path. Do this for a good developer workstation setup. I make great use of it because I really don't use VS.NET for most code samples.
And Nick is right, you don't need VS.NET for the Framework SDK. The .NET Framework SDKs are freely downloadable installations separate from the Framework installations that provide everything you find in "C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK" on your machine, since VS.NET just includes the Framework SDK installation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You are rigth!
Sorry...
|
|
|
|
|
if i have a mdi child form within a mdi form and i want to restrict the child so it can't move outside of the parent form, how would i do this? this is what i have but when i'm moving the child form i get some weird painting effects.
protected override void OnMove(System.EventArgs e)<br />
{<br />
if (this.Left <= this.Parent.Left)<br />
this.Location = new System.Drawing.Point(this.Parent.Left, this.Location.Y);<br />
if (this.Right >= this.Parent.Right - 3)<br />
this.Location = new System.Drawing.Point(this.Parent.Right - this.Size.Width - 4, this.Location.Y);<br />
if (this.Top <= this.Parent.Top)<br />
this.Location = new System.Drawing.Point(this.Location.X, this.Parent.Top);<br />
if (this.Bottom >= this.Parent.Bottom - 3)<br />
this.Location = new System.Drawing.Point(this.Location.X, this.Parent.Bottom - this.Size.Height - 4);<br />
base.OnMove(e);<br />
}<br />
thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
I'm not sure of some auto-magical way to accomplish this, but what you're doing is roughly what needs to happen somewhere down the call stack anyway. So, what kind of "weird painting" effects are you getting? Is there a lot of flickering, or is something else going on (like your VCR time gets reset )?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
my vcr time is just fine but what i am getting is bad flickering. it flashes back and forth from where the form is suppose to be to where i am trying to put it. so is there a way to disable the mouse down or the form painting when it reaches the boundaries of the parent form?
thanks,
rob tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
I see. The form is still trying to go where you put it but when your code executes it tries to put it back to where you want it to be. You definitely don't want to stop painting, but you could try to override OnMouseMove and do NOT call base.OnMouseMove if you've reached your MdiParent 's extents. This might work, so long as it cancels the underlying WM_MOUSEMOVE notification message handler. I highly doubt it since the MouseMove event is fired in response to the mouse moving. In this case, try overriding the child form's WndProc and before calling base.WndProc , handle the WM_MOUSEMOVE notification message (0x0200) and just return without doing anything if you've reached your MdiParent 's extents.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
wow, you lost me there. i don't know the language well enough to do what you're suggesting. i guess i'll just put it back to the default, where the form is allowed to go off screen. thanks for you help though, i really appreciate it.
thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Consider this a learning experience, then!
Have you ever done MFC or even just straight win32 programming with the Windows Management APIs? If so, you know about all you need to know (undering marshaling and P/Invoke will be required a little, too, but nothing extraordinary.
In your class for which you want to override the behavior, just do something like this:
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCMOUSEMOVE)
{
if (Left <= MdiParent.Left || ...) return;
}
base.WndProc(ref m);
}
private const int WM_NCMOUSEMOVE = 0x00a0; Like I said, though, I'm really not sure this will work, although I have more hope for this than for override OnMouseMove since that happens in response to the WM_NCMOUSEMOVE notification message and can't be canceled.
This little line just determines if your window can move anymore and throws out the message if it can't. You might also notice I changed WM_MOUSEMOVE that I posted before to WM_NCMOUSEMOVE for the non-client area of the dialog...what was I think?!
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i'm always ready to learn. unforunately i havn't worked with MFC or windows management APIs. i've tried everything i can think of to get this to work and i tried playing around with the code you gave me but it seems like that code executes at odd times. i had it update a textbox when it drops into the if statement before it returns and it doesn't update it in the same spot everytime, it's weird. i would like to know where you got the WM_NCMOUSEMOVE = 0x00a0 though. what does this mean and why is 0x00a0 an int?
if anyone out there has any input for constricting the movement of a form to stay within it's parent that would be great.
thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
I got the constant value from winuser.h, the header with most of the constants defined for the Windows Management and related APIs. You can easily find these if you download and install the Platform SDK, which does get installed by default with VS.NET (though it's not pretty old).
Why is 0x00a0 an int ? You've never seen this notation? It's a simple hexidecimal notation, or base16, which is 0123456789abcdef. So, 10 (a) * 16 = 160. int (Int32 ) is only a 32-bit number, as is 0xXXXX (four alphanumeric characters).
I typically keep the hexidecimal notation that's defined with the C/C++ headers from the PSDK, though, because it makes lookups easier and lets me format my code better.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can I get The all user defined table name from a MSAccess Database using Ado.Net(c#)
This is Jitendra
|
|
|
|
|
You can use a query like the following:
SELECT Name
FROM MSysObjects
WHERE Type = 1 AND Name LIKE "MSys%" All the Access system tables start with "MSys", so unless you expect user tables to begin like this the query above should work fine.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks to u
This is Jitendra
|
|
|
|
|
It gives Problem regarding Permission when I execute the query the permission Exception is raising and saying that u don't have right to read MSys table .
Thanks FCriend
|
|
|
|
|
There is no "MSys" table, but many tables that start with "MSys", which is why I said "MSys*", like a wildcard match. Make sure you specify a proper table and that the credentials (username and password) you log in with have administrative privileges (like the "Admin" user).
Also, don't say things like "the permission Exception". If you need help, be specific and say SecurityException or InvalidOperationException or something like that, along with the exact exception message. There's many things that can go wrong in an application, even in specific blocks of code.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I write a winApp to send EMAIL. Since the server needs to authenticate, so
I need to use TcpClient rather than SMTPMail class. But the problem comes.
Following the DATA tag, I send strings like these:
"Subject:IP Notice"+CRLF;
"This is your IP."+CRLF+"."+CRLF;
But when I receive the mail, only subject was appear and there was no mail body. If I do it in this way, sending the follow strings:
"Subject:IP Notice"+CRLF;
CRLF;
"This is your IP."+CRLF+"."+CRLF;
Then the body exists.
Please do me a favor. I don't know why. Thanks a lot
|
|
|
|
|
This is what the SMTP protocol requires, as well as the HTTP protocol for that matter. You must have to carriage-return, line-feeds after the headers.
See RFC 821[^] (SMTP) for details.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Olap and XML/a .I want to the relationship between
This is Jitendra
|
|
|
|
|
Try the SQL and/or XML forums. This forum is for C#, a programming language for the .NET Framework.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I have asked something similar before but was distracted by another part of the app I am implementing and am only getting back to implement this part.
The problem is I have a client/server app. On the client I have a form which acts as a 'splash screen'. Using a combination of a few different methods I have 'locked-down' the client so that it is not possible to use the pc. What I need to do, using remoting, is to allow the server app to hide the splash screen form at the click of a button, therefore allowing users of the pc to use my client app. What I am attempting to implement is a internet cafe management system. All clients are locked until released by the server app by the splashscreen.
I am on a pretty tight time schedule so if anyone could help me with a bit of sample code to allow me to show/hide a remote form, or a nod in the right direction I would be really really grateful,
Thanks in advance,
John
|
|
|
|
|
One easy way would be to declare an interface with the Show and Hide methods:
public interface IVisibleProvider
{
void Show();
void Hide();
} Put this in an assembly shared by the client and server code. The client control can easily implement this - the Show and Hide methods already exist so just implement the interface without having to define the methods and you're done. The server can make calls on the client using this interface using the appropriate activation types (like a singleton or client-activated type) that allow the server to make calls back to the client (so use a TcpChannel as well since HTTP is a client-request, server-respond protocol by nature).
Another way is just to have the client handle the clicks or key presses and call a method on the server - passing some sort of client ID - and the server returns a value that signals if the client can be unlocked or not. If it can, unlock it, otherwise ignore the click or yell at the user. This would be much easier to implement and would allow you not only the ability to use either the TCP or HTTP channels, but also just to use a simple XML web service, much easier to implement and easier to make secure through the Web Service Enhancements (WSE) 1.0 SDK from Microsoft (includes WS-Security, WS-Identity, WS-Routing, and more and easily integrates with Web Service code) if you desired extra security (so users don't intercept messages and change them before they reach their destination).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I implemented the idea using an interface. However I am getting the following error when I leave the system idle for a few minutes and then try to show/hide the form across the network:
"no receiver registered"
From what I have been reading there is a timeout on the leave given to the object. Its getting a bit above my head at the moment. Is there any easy way to set the timeout to never? Have looked at the microsoft site and did a search but its very technical. Any pointers anyone?
Thanks,
John
|
|
|
|