|
hmmm, what do you know... this Heath Stewart character knew the answer to this question.
I'm just curioius, did you sorta know this already. Or did you search for it?
/\ |_ E X E GG
|
|
|
|
|
This - and most solutions I post - I know already. I'm both blessed and cursed with a photographic memory. Besides, HTTP and HTML (if you call that programming) was one of the first programming things I did besides the dinky little things I did on my C64, so the HTTP Server: header was nothing new.
It's not that I always remember the exact method or property, though. In some cases, I know that a certain class has a certain method or property that takes certain parameters and returns a certain type. As I've said many times in the past, it isn't so much memorizing every signature in the .NET Framework (or anything else for that matter), as it is remember that something exists and roughly where to find it. The important part of research is at least becoming familiar with what's available and having an idea of where to look. So, using your question as an example (if I couldn't remember what the property or method was called), I knew it would be on the HttpWebResponse (since the whole pluggable protocol API is aptly and consistently named - the HttpWeb part - and that the client couldn't know what the server was till it got a response back - thus using Response instead of Request) so I would just jump to that class and look.
-----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-----
|
|
|
|
|
That's cool, a photographic memory... I wish I had one!
Thanks for your help. Both times.
/\ |_ E X E GG
|
|
|
|
|
Hello,
What would be the best way to go about making a computer restart after my setup program has finished running?
I can't seem to find anything built-in to the setup program. Will I need to specify a custom action to do this?
Thanks,
Blake
|
|
|
|
|
If you're using Windows Installer, it decides if a reboot is necessary. If - for some odd reason - you need to reboot regardless of what Windows Installer thinks, create a REBOOT property in the Properties table and set it to Force. If you're using VS.NET's installer project, you'll have to download the Windows Installer SDK on the Platform SDK web site, install Orca (copied to your machine as Orca.msi in the PSDK's bin directory), open your compiled MSI, and add the property to the Properties table manually.
If you need to conditionally set it, you can use a CustomAction that sets the REBOOT property to Force. Note the case of the REBOOT property, though - it must be all uppercase.
You could also write a custom action DLL, but it isn't necessary since - as you can see - you can have Windows Installer do it.
-----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 for the info.
If I am using the bootstrapper sample form Microsoft's website to do a silent installation of .Net framework, will Windows Installer take the .net framework installation into account when determining if the reboot is necessary? And, I am using MDAC and Jet merge modules in the setup program also. Will it take these into account?
Thanks for the reply!
Blake
|
|
|
|
|
The bootstrapper runs before the Windows Installer package, so Windows Installer won't know. I'm not aware of how the bootstrapper could tell the installer to reboot, since the bootstrapper typically only knows about the Database object (where the properties are read-only). Perhaps the bootstrapper can get the Instance after invoking MSI on the package, but you'd have to read the Windows Installer SDK. I've never had to attempt modifying the installer from the boostrapper to know.
In most cases, though, you want the bootstrapper to reboot before restarting the Windows Installer package. If the .NET Framework installation isn't finalized when your MSI package begins, you may run into problems. While rare, I have had problems where - after installing SP2 - the GAC wasn't setup completely and trying to install assemblies into a GAC that didn't exists screwed some things up. It wasn't disasterous, but your average stupid user using your product might not like it.
As far as Jet and MDAC go (they are merge modules), if Windows Installer determines that files they needed to replace are in use or that the machine needs to reboot (which is stupid in most cases for NT-based Windows OSes because the user need only logout and back on), it will do so either when necessary or at the end, depending on what you set the REBOOT property to. Valid values are Force, Surpress, and ReallySurpress. See the Windows Installer SDK for more information.
-----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-----
|
|
|
|
|
Just one comment not on the technical side. If you don't wish to royally piss off most of your users, don't force a reboot at all, unless it is extremely neccesary. Several programs i've used lately have popped up a box at the end simply saying "Click OK to reboot". This is rarely neccesary, and certainly wasn't in some instances.
This is amazingly bad usability design, and is hugely presumptious. Try to avoid this! Just a comment
|
|
|
|
|
This is a moot point with Windows Installer. Setting REBOOT to Force still prompts the user with a Yes/No dialog. Your comment is most definitely valid in a custom installer, but that's not the case here.
-----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-----
|
|
|
|
|
Please give it some thought about forcing a clients machine to reboot. Just think how irritating it is when an application reboots your machine. Personaly believe the best option is to place messages in the installer to say a reboot is necessary, and leave it up to the end-user.
My one cent.
|
|
|
|
|
Has anyone used C# to do a mailmerge for word 2002?
I have a CSV file that is coma delimited that is created by a web page. Need to take that CSV file and have it do a mailmerge to a Word doc.
|
|
|
|
|
Anonymous wrote:
Has anyone used C# to do a mailmerge for word 2002?
Google is your friend. Go to Google and do a search on the keywords in your question (hint)[^].
Roger Stewart
"That is disgusting... Yet oddly fascinating!"
|
|
|
|
|
Any know what I'm doing wrong? I have this mailmerge and it does not seem to Close WINWORD.EXE.
I also tried using oWordDoc.Close(ref oFalse, ref missing, ref missing); line in the code and it will not close it either. Tried using both oWordApp.Application.Quit(ref oFalse, ref missing, ref missing); and oWordDoc.Close(ref oFalse, ref missing, ref missing); Then it seems to hang the web page. Any help would be nice.
object fileName = "c:\\temp\\letter.doc";
string SourceFile = "c:\\temp\\Names.csv";
object SourceFormat = Word.WdOpenFormat.wdOpenFormatText;
object oFalse = false;
object oTrue = true;
object missing = System.Reflection.Missing.Value;
object query = "SELECT * FROM `DirectMailList123200311834$`";
object SaveAsFileName = "c:\\temp\\MergedLetter.doc";
Word.Application oWordApp = new Word.Application();
Word.Document oWordDoc = oWordApp.Documents.Open(ref fileName, ref missing, ref oTrue, ref missing,ref missing,ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
oWordDoc.MailMerge.OpenDataSource(SourceFile, ref SourceFormat, ref missing, ref missing, ref oTrue, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,ref query,ref missing,ref missing, ref missing);
oWordDoc.MailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument;
oWordDoc.MailMerge.Execute(ref oFalse);
oWordApp.ActiveDocument.SaveAs(ref SaveAsFileName, ref missing, ref missing, ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing);
oWordApp.Application.Quit(ref oFalse, ref missing, ref missing);
|
|
|
|
|
Hi everybody
Does anyone know if there is a way to implement named pipes using C#?
Thank you very much!!
Spiros Prantalos
Miami the place to be!!
|
|
|
|
|
First, let me just say that .NET Remoting is the recommended way for inter-process communication - even over disparate networks like the Internet. See the System.Runtime.Remoting namespace for more information, or read the MS Press book, ".NET Remoting" (it's pretty good for both beginners and advanced developers alike).
Having said that, you have to P/Invoke the CreateNamedPipe function and create a SECURITY_ATTRIBUTES structure like so:
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr CreateNamedPipe(string name, int openMode, int pipeMode,
int maxInstances, int outBufferSize, int inBufferSize,
int defaultTimeout, ref SECURITY_ATTRIBUTES);
[StructLayout(LayoutLind.Sequential)]
public struct SECURITY_ATTRIBUTES
{
public int length;
public IntPtr securityDescriptor;
public bool inheritHandle;
} If you don't want to worry about the SECURITY_ATTRIBUTES struct in the CreateNamedPipe method, you could probably change the param to a generic object and pass null when calling the method. See the SDK documentation for CreateNamedPipe for details about what else to pass.
Now, that returns you a handle (IntPtr in .NET). You can use that in a call to the constructor for FileStream :
IntPtr handle = CreateNamedPipe(@"\\.\pipe\Name123", ...);
Stream s = new FileStream(handle, FileAccess.ReadWrite); Now you've got a Stream to work with using managed code.
-----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'm trying to play a variety of sounds ( .wav files ) in a C# program and am having problems doing so. First off, I couldn't find any .NET native way to do so. Then I wanted to use the Win32 API call PlaySound, but since it's a lib and not a dll I can't do that. Finally, I wanted to use DirectX9, but after installing the SDK, if I put "using Microsoft.DirectX;" on the top of my form it says it doesn't exist.
Any clues?
Thanks,
|
|
|
|
|
DirectX is the way to go, but putting using Microsoft.DirectX isn't enough (and you'll want to use the Microsoft.DirectX.DirectSound namespace anyway). You actually have to add the appropriate assemblies to your project references. Right-click on your project and click "Add Reference". Find the appropriate assemblies (Microsoft.DirectX and Microsoft.DirectX.DirectSound) and add them to your project. For any classes you use, you must include the assembly that contains that class in your project references (except for classes in mscorlib.dll, which is automatically referenced unless the compiler is told otherwise - which you can't do from VS.NET).
-----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-----
|
|
|
|
|
Ok, I wanted to do that, but they don't appear. I can't add them under the ".Net" tab.
|
|
|
|
|
Do the same thing and click the "Browse" button. Browse to those assemblies and double-click to add them.
-----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-----
|
|
|
|
|
Could you please be more specific? What file exactly do I have to browse to, and where would it be located. I searched my harddrive for Microsoft.DirectX and nothing was found. I have some XML files with the appropriate names, but that's it.
|
|
|
|
|
shizam wrote:
Could you please be more specific?
Could you be more explorative? I mean, it's not that hard. If you have installed the DirectX SDK (with the managed assemblies - yes, you actually have to go to msdn.microsoft.com/directx and download it), they would show up in a search. If you still can't find them, they're installed into %WINDIR%\Microsoft.NET\Managed DirectX\vVERSION. Select the appropriate assemblies which - agian - I did give you the names of in the first place. If you don't see them, then go to a folder's Tools->Folder Options, then click the View tab and show hidden files. Any good developer should've already enabled this option since working with DLLs and other normally hidden files is necessary.
Figuring out things for yourself will teach a lot more than having people do them for you.
-----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-----
|
|
|
|
|
Well Heath, maybe you shouldn't be answering questions if you're going to be mean about it.
1) I've been trying to solve this problem over 2-3 days, so I did not immediately jump and ask for help the first time I had a problem
2) I do have "show hidden files" enabled because I've experienced those types of problems before. Your comment that "Any good developer should've already enabled.." this options is ridiculous. People make mistakes, even good developers.
3) Yes I've installed the DirectX SDK, it's a 227 MB self extracting exe that was downloaded from Microsoft's web site.
4) In the directory you specify, I only have .XML files, and no DLL files.
So please don't respond anymore unless you're going to provide answers or suggestions. If you want to ridicule people, log on to chat.yahoo.com
|
|
|
|
|
These forums are for developers, not for people looking to others to do their work for them. Check practically any replies from the regulars and you'll see it isn't just me.
Even if you've installed the DirectX SDK, there is a separate install for the managed runtime. If you took the default path for the SDK installation, the install would be in C:\DX90SDK\Developer Runtime\Managed DirectX\Retail for the release builds, or replace Retail above with Debug for the debug build.
One more thing - all this was discussed on the URL I previously gave you for the DirectX SDK download site and for other information - including samples - about DirectX 9. Reading documentation is essential, SDK documentation and installation guides.
-----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-----
|
|
|
|
|
Well I am a "professional developer", have been once since leaving college with my piece of paper.
I'm trying to set up .NET and DirectX and not having much luck here.
The directory mine was installed to was "C:\DXSDK", and that was the default.
I do NOT have the "Developer Runtime" sub-directory under there.
I'm read the readme's and most of the stuff on that link you were talking about already, no luck.
|
|
|
|
|
Go to http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp[^] and click on the Redist[^] link.
Make sure you download the Summer 2003 updates because many bugs were fixed. This is both a full and upgrade installation so you don't really need to uninstall the previous version.
-----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-----
|
|
|
|
|