Hi, I'm experimenting on UPnP in Windows Vista Ultimate with Media Center. I've set up a few UPnP AV media servers and could connect to the data from Windows Media Player. But in Media Center I could only browse local files and no files from other UPnP servers. That's why I'd try to write a C# UPnP client, that uses ALL available AV servers and not only the local storage in Vista MCE. I've found out there are Intel tools für UPnP, but they are written in C. There is also UPnP support in Platform SDK CE, but I'm using UPnP on a standard PC. I did not find any UPnP clients in C# here on codeproject. Maybe I've overlooked one in the results or someone of you knows some good external links on how to build a UPnP client in C# (without manually writing the protocol). Thanks in advance, Norbert
N O R B E R T
Posts
-
UPnP AV Client in C# -
typedef in templates?I've had the warnings supressed, and I forgot about that. I'm sorry for posting without reading all errors AND warnings before. Thanks for your fast help. Norbert
-
typedef in templates?sorry, it seems my <'s have been removed. Here should be the corrected version of the code:
template <typename K, typename V> class Repository { private: typedef std::map<K, V> ReposMap; public: typedef ReposMap::iterator iterator; typedef ReposMap::const_iterator const_iterator; public: Repository() { } ~Repository() { } private: ReposMap m_objects; };
-
typedef in templates?I'm writing a class which is more or less a STL map with a few enhancements, e.g. sending of update notifications. To still have STL like access to the map, I forward the map iterators in my class with public typedefs. The problem is, those typedefs seem to be missing a semicolon where there is definitely none missing;
#include template class Repository { private: typedef std::map ReposMap; public: typedef ReposMap::iterator iterator; //line 14 typedef ReposMap::const_iterator const_iterator; //line 15 public: Repository() { } ~Repository() { } //[...] some other functions ... private: ReposMap m_objects; };
MSVC8 gives the following error msgs compiling this code:Error 2: error C2146: syntax error : missing ';' before identifier 'iterator' 14
Error 3: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 14and the same error msgs again for line 15 before 'const_iterator' I was wondering what the error could be in that few lines of code. Typedefs should be able to work with template parameters, so there shouldn't be an problem, should it? I'm trying to compile this and some other versions of the same problem for two days now, but I don't have an idea, what could cause the problem, so I'd appreciate any suggestions. thanks in advance, Norbert
-
MSVC++ 8 SP1: delete const pointer [modified]Thanks for your replies and especially for the links. Norbert
-
MSVC++ 8 SP1: delete const pointer [modified]After some sloppy refactoring I found something like this in my code:
class FooBar; void foo(const FooBar* const pBar) { //do something //... delete pBar; }
So far, so bad. What surprised me, was the fact that this code compiled without any error or warning. I was told, that this compiles also in GCC. This also compiles though a non-const member function is called:void foo(const FooBar* const pBar) { pBar->~FooBar(); }
Can you tell me why these snippets work (or at least compile)? thanks, Norbert -
Safely create System.Drawing.Bitmap from managed int[]No it wasn't. I knew that article, but I didn't get that code working. Also the ImageConverter which is mentioned in the articles message board didn't work for me. My code, as nasty as it is by now looks like this:
using System.Runtime.InteropServices; using System.Drawing; ... public void saveImage(String filename) { List byteList = new List(); lock (this) { foreach (int color in m_data) { byteList.AddRange(System.BitConverter.GetBytes(color)); } } byte[] byteData = byteList.ToArray(); GCHandle handle = GCHandle.Alloc(byteData); ; try { IntPtr imgDataPtr = Marshal.UnsafeAddrOfPinnedArrayElement(byteData, 0); if(imgDataPtr != IntPtr.Zero) { Bitmap img = new Bitmap(this.Height, this.Width, byteData.Length, PixelFormat.Format32bppArgb, imgDataPtr); Random rnd = new Random(); img.Save(filename, System.Drawing.Imaging.ImageFormat.Tiff); } else { System.Diagnostics.Debugger.Break(); } } catch(Exception e) { System.Diagnostics.Debugger.Break(); } finally { handle.Free(); } }
The creation of the Bitmap always threw ArgumentExceptions, when the PixelFormat is anything else than Format32bppArgb. It took me quite a time to figure out, that PixelFormat was the parameter which caused the problem, since I don't see any obvious differences between Format32bppArgb and Canonical which are both 32 Bits / pixel and should at maximum cause some mixed up channels when stated wrong. So maybe I'd get the Bitmap creation running with one of the linked examples above, if I check again for the correct PixelFormat, but by now I think I better use that maybe unnecessarily complicated version you helped me to figure out. If I get a shorter and less complicated version running, I'll post it here. Norbert -
Safely create System.Drawing.Bitmap from managed int[]Thanks for your reply. I'm getting a valid (non zero) IntPtr with your help, so I can create a new System.Drawing.Bitmap. The saved image is not what I did expect, but that's a problem with the PixelFormat. So thank you very much for your help. Norbert
-
Safely create System.Drawing.Bitmap from managed int[]I am searching for a few days now, but I didn't find any examples of creating a System.Drawing.Bitmap without using unsafe code. I've an int[] with one pixel in BGRA per int. The pixel values are created in my program, so I don't have any loadable bitmap so far. I tried to create a bitmap via new Bitmap(Int32 width, Int32 heigth, int32 stride, System.Drawing.Imaging.PixelFormat format, IntPtr scan0); but I didn't get the IntPtr to refer to the data correctly. If anyone has an idea how to correctly create that bitmap, I'd appreciate your help. thanks in advance, Norbert
-
OpenGL & Cg - How does it affect each otherI recently found out that I don't really understand how OpenGL and Cg shaders work together. My shallow knowledge of this topic was that more or less every option set in OGL could be reset in Cg. That works for vertex positions, light positions, texture coordinates and texture IDs and a lot of other stuff. But OGL render options like drawing full faces or only grid models can't be overridden in Cg. At least I couldn't do it. I wanted to ask if anyone knows a good tutorial concerning this topic. thanks, Norbert
-
Adding Icon to Win32 EXEthat helps. thanks.
-
Adding Icon to Win32 EXEI was wondering how to add a customized icon to a simple c++ win32 console application. I guess this question has been asked a lot of times before, but I couldn't find an answer here on elsewhere in the web. I'm using Visual Studio 2003. thanks, Norbert