Diamonddrake 397 Master Poster

I suggest using 1 form and using a tabcontrol. but hide its tabs.

I just posted the same thing on that codeproject article. Because its way overkill the way they have done it.

here is an example of hiding them tabs at runtime, but not and design time.

using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace customControls
{
  public class TabControlEx : TabControl
  {
    /// <summary>
    /// Gets or sets a value indicating whether the tab headers should be drawn
    /// </summary>
    [
    Description("Gets or sets a value indicating whether the tab headers should be drawn"),
    DefaultValue(true)
    ]
    public bool ShowTabHeaders { get; set; }

    public TabControlEx()
      : base()
    {
    }

    protected override void WndProc(ref Message m)
    {
      // Hide tabs by trapping the TCM_ADJUSTRECT message
      if (!ShowTabHeaders && m.Msg == 0x1328 && !DesignMode) 
        m.Result = (IntPtr)1;
      else
        base.WndProc(ref m);
    }
  }
}
Diamonddrake 397 Master Poster

Microsoft's word just uses ZIP. Its an XML plain text format that they then zip and save with a .doc extention. Then when the load it in it unzips it in memory and parses the xml. same with open office i do believe.

Diamonddrake 397 Master Poster

I am working on an application that is all about its interface. I want a very remote control accessible media browsing application. The Browsing is done. but playing video keeps getting complicated.

using DirectX is no problem, using the managed direct X video object works. But looks bad, doesn't preserve aspect ratio and has tons of memory leaks. So using directshow.net as a wrapper to avoid interlop you can easily create filter graphs to play video. But I can't seem to get any good looking video.

by default, rendering a file uses VMR7. But VMR9 preservers aspect ratio and supports a "windowless" mode that automatically draws to the surface of a handle you specify. Only problem is in windowless mode. It looks BAD! the image is blocky, it just looks unwatchable to me. so I trued windowed mode where I set the owner of the window to be my control and the style to be child. STILL LOOKS BLOCKY.

using "renderless" mode. whatever that means (i've read everthing i can find and its still unclear) It looks better, but when I child it and own it to my control suddenly it looks bad again, aspect ratio is wrong, and it studders.

I know that windows media player uses direct show to play its videos. So what are they doing that I am doing wrong?

If anyone knows how to use direct show to play a video on the surface of a control and …

Diamonddrake 397 Master Poster

Thanks, But I have read this before. I did find most useful the source for the 360 server. But Its unfortunately mostly about the server. Not the media renderer. The rest of the links on that page aren't very helpful. I guess I don't have as much time to devote to this as I hoped, for now listing shared resources seems to be working ok. since all the media server files were in shared folders anyway. I'm working on creating an easy nav that can be done with arrow keys only for network folder browsing.

Diamonddrake 397 Master Poster

Since I can't find any basic documentation on this, and all the tools I can find don't seem to work on either of my PCs. I have decided to just write a menu that searches the network for shared folders and lists them, And that was much more simple. Not what I wanted. But a suitable solution.

Diamonddrake 397 Master Poster

I have discovered that the media server is a upnp/av media server. I found a wealth of information about creating a server. but little about creating a media renderer. also it appears that all the tools like "DeviceSpy" don't see any upnp stacks on my system because of my network configuration, And that makes figuring out the protocol that much more difficult.

Diamonddrake 397 Master Poster

I have a ps3 and I have been using it to stream my huge media collection to my TV. my ps3 failed, I keep reflowing it but it keeps overheating but that's not what this is about. I have all my media set up the way I like it on the media server. But the network performance of Windows Media center lacks the speed and ease of use that I have come accustom too.

I would like to set up an app that just displays media servers on the network and allows simple navigation of them and streaming of video files. I can play videos with managed direct X with no problem, and designing an interface is the fun part. But I can't seem to find any decent documentation on connecting to "a windows media server"

If anyone could help me with this I would appreciate it. I just want to create a dirt simple application to make things easy to browse with just arrows and enter/back button navigation. Connecting to the media server is the problem. I could easily just network shared folders, but that's not what I want.

Diamonddrake 397 Master Poster

farooqaaa, That is a great code snippet you posted for the OP. But I do have one thing to suggest. I would use the Timer tick event to change the state of the variable. Not the paint event, as many thing can cause the paint event to be fired. if one is to expect that the blinking should be consistent. Then the toggle should also be done on interval, The paint event should only be used to paint, not change variables.

The code above would cause parts of the blinking graphic to act erratically if other windows were dragged around above the current one.

Although you did a great job of explaining your reasoning, and of course the code would certainly work either way.

Diamonddrake 397 Master Poster

You could always just binary serialize the object, write it to the stream, then deserialize the object from a buffer. Or even xml serialize the object to a string, then send the string as an array of bytes, and deserialize the string from the buffer back into the original object. Then all your program really needs is a common class to represent the object, or more simply. Just a common interface definition.

Diamonddrake 397 Master Poster

It also supports Ctrl+A to select all. It also by default supports the shell menu with Select all, copy, cut, and if applicable, paste as well.

Diamonddrake 397 Master Poster

Sorry I been away for some time.
I actually think something like
"C:\Users\username\Documents\Recipes\recipiename.specialrecipeext"

have a db store information about the recipes for easy searching. but the actual recipes them selves be stored as recipe files

But it would be complicated there is nothing wrong with using a database alone.

also, There are some free C# libraries out there that will allow you to create PDF documents on the fly. I have used a few and they do work. Good luck with you app.

Diamonddrake 397 Master Poster

Be sure to add an automatic database backup feature! And if it were mine i would grab one of those open source PDF libraries and add an "Export to PDF" feature so it will be simple for her to share her recipes with friends and family!

Of course you could consider storing information about the recipes in a DB and storing the actual recipes themselves in a plaintext format with a different extention in a monitored subfolder of the user's documetns folder. making it very easy to back up and share the recipes, you could then have these recipe documents automatically open with your software with the option of coping it to that user's recipes folder and adding the information to the collection!

Just some suggestions. This sounds like a great idea :)

Geodude0487 commented: Great advice!! Never would've thought about this on my own. +1
Diamonddrake 397 Master Poster

interesting article sknake, but titus i can agree that its a LOT of code. I wouldn't worry about the overhead of a TCP socket, Each user isn't going to have 120 open convertsations. As sknake pointed out, UDP is best used for live streams like audio. If you were to add a skype feature to your chat app. you would certainly want that p2p UDP connection. But just for text. TCP is best.

Using the P2P system you are pointing out would put significantly less stress on the server. But the question here is, are you planning to have 20,000 users? If not, having the server handle everything would be fine, assuming you created a nice thread pool that would cycle through pending messages and deploy them.

Its always nice to have your tools handle the trouble spots for you. like apps that generate objects based on xml schemas and tools that create asynchronous methods from a class or even compiled code. But it doesn't hurt when in a learning environment to try and do it by hand, just so you really know what's going on, how it works, and why it there.

Regardless, no matter how neat it is to make a chat application, unless you really feel like you can compete with Yahoo, Aim, MSNMessenger, Trillian, and Pidgin. Then its just a learning experience anyways. In which case, dive in and make mistakes that you learn from.

Diamonddrake 397 Master Poster

The staff is drawn dynamically. Because bar numbers and the high and low staff bars that are only drawn when a
note is present. I didn't want to use the
notes as controls as that adds a huge over head for each note and there could be hundreds. But it's on the back burner for now. Thanks for the help. I will try both suggestions
and get back to you. Thanks

Diamonddrake 397 Master Poster

It's NOT open source. This is just a project I've
been working on.

And it only works with the
non-wireless ps2/3 rockband drum kit.

Also it is a X86 build. 64 bit has some
issues with the direct x I'm using.

Wich raises another point. It requires direct
x

Diamonddrake 397 Master Poster

I see now that threads you have posted in have a bullseye and are inversed when they are new. But when I first stumbled upon a thread that I had started. It didn't have that icon. It just had a purple circle with the word "new" in it. Although now it is acting as it should. So my gripe is gone. Great job!

Diamonddrake 397 Master Poster

I had the privileged of seeing it in IMAX 3D. It was quite amazing. Now I own it in bluray :)

Diamonddrake 397 Master Poster

I've gotten my fair share of "looking forward to getting to know you better" PMs that flat pad post button is a nice touch. If only there was a "im not writing your software for you man!" auto respond button.

Diamonddrake 397 Master Poster

requimrar, Its impressive that you put that much work into a cosmos build.

Its important to remember with cosmos that its C# when you write it. But its NOT c# when you compile it. It has its own compiler that uses C# syntax and creates an unmanaged 16bit executable. So its not always going to act the way you would expect it under the CLR that windows uses.

Diamonddrake 397 Master Poster

I Dig the new appearance. But there used to be a tiny pencil icon that made it quite obvious that you had posted in a thread before. I relied on that icon for years. Not that its gone. I'm frustrated.

Other than that. Its a welcome change.

Diamonddrake 397 Master Poster

that's the alt text for the image. If the image failed to load that text would be there instead. Its your browser that's showing that pop up. not the site. But I agree it is annoying.

Diamonddrake 397 Master Poster

I miss the little pencil icon that made it very obvious that you had posted in a thread.

Diamonddrake 397 Master Poster

There is no way to just send a sms message. You need a gateway. Some providers like at&t provide a email gateway for free use ##########@txt.att.net (i think this is right) but it only works for at&t phones. In order to send a sms you must be part of the phone network. a sms message is a "push" message that is relayed to the phone when the phone is communicating with the cell tower maintaining service, not during calls or using the net. So somewhere there needs to be a device on a phone network relaying your programs messages to the phone network. And Phone companies don't just give away texting rights. It costs me 30 bucks a month just to use it on my phone. i would expect to pay hundreds to use it in a commercial setting from software.

So your options are to subscribe to a sms gateway and use its api to send messages. or get a GMS modem and pay for GSM modem phone service and interact with it to send SMS. (essentially automating a phone with your computer)

best of luck though.

Diamonddrake 397 Master Poster

Here is a PRE-BETA Release for those who are interested in the project. I Don't have all the profiles I need for the different drum kits. But I do have the graphics made for the Guitar Hero drum kit. Once I have more done I will set up a site for the project. This version works without a drum kit. you can click onscreen drum kit and simulate the effect. If you have the ps2/ps3 wired drumkit. just plug it into the usb port and click the getdrums button in the lower left of the app window. The bottom right of the app window has a play button with a enumeration of the midi drum channel. This will play midi drum channel sounds. the drum kit its self doesn't I tried but there was a delay that the midi api caused that wasn't conducive with a drums speed. So for now its disabled. Possible will be used in the full version. The metronome icon can be clicked to start the metronome and the slider or updown box can be used to adjust the bpm.

This is in no way an official release. This is just to show my progress and build interest in the project.

Suggestions and criticism accepted happily. Please note that many features are already slated to be included. This just takes time, and time is something we all have a very limited amount of. Hope you guys like it. don't be too harsh :)

Diamonddrake 397 Master Poster

I've been really busy with work, But I have gotten a snazzy interface, the ability to add more sounds easily, a metronome, and a reliable quality experience using it. But it currently only works with wired ps2/ps3 rockband drum kits. If anyone is interested in this as it is. I can release a daniweb exclusive beta.

Diamonddrake 397 Master Poster

... come on guy you're bouncing all around it. The reason you code didn't' work is because you created a new panel but didn't add it to the form's control collection.

The button is IRRELEVANT. you can assign the points and refresh the panel at any event. on load, on button, on mouse down. doesn't matter.

I have included an example project of a finished working solution. It could be adapted to work more toward your purpose. But this is a proof of concept.

Diamonddrake 397 Master Poster

You are still creating a graphics object. Don't do that. use the paint events args graphics object.

e.Graphics.DrawLine(.....);

and after your button click refresh the panel.

[I]panelname[/I].Invalidate(false);

Also start with a standard Panel control. get simple working before you move to complicated.

Diamonddrake 397 Master Poster

Ok, first off. Welcome to daniweb. Don't make it a habit to come post ambiguous questions without even pretending you know what you are dong. Please read this before posting on daniweb. http://www.daniweb.com/forums/announcement61-2.html

With that said. this is so simple I just did it for you. Here is a snippet for a transparent Picturebox control. This one is on the house. No more freebies. You'll have to show that you are trying.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace Transparent_picturebox
{
   public  class TransPicturebox : Control
    {

       public TransPicturebox()
       {
           this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
           this.BackColor = Color.Transparent;
       }


       private Image _Image;

       public Image Image
       {
           get
           {
               return _Image;
           }
           set
           {
               _Image = value;
           }
       }


       private bool _autoscale = true;

       public bool AutoScale
       {
           get
           {
               return _autoscale;
           }
           set
           {
               _autoscale = value;
           }
       }

       protected override void OnPaint(PaintEventArgs e)
       {
           base.OnPaint(e);

           if (_Image != null) //keep from crashing if there is no image
           {
               if (_autoscale)
               {
                   //Auto Scale the image to fit in the text box
                   Rectangle rectangle = new Rectangle();
                   Size size = this.Image.Size;
                   float num = Math.Min((float)(((float)base.ClientRectangle.Width) / ((float)size.Width)), (float)(((float)base.ClientRectangle.Height) / ((float)size.Height)));
                   rectangle.Width = (int)(size.Width * num);
                   rectangle.Height = (int)(size.Height * num);
                   rectangle.X = (base.ClientRectangle.Width - rectangle.Width) / 2;
                   rectangle.Y = (base.ClientRectangle.Height - rectangle.Height) / 2;

                   e.Graphics.DrawImage(_Image, rectangle);
               }
               else
               {
                   e.Graphics.DrawImage(_Image, new Point(0,0));
               }

           }
       }

    }
}
Diamonddrake 397 Master Poster

Well for starters you are using 2 separate stream objects, and using them quite oddly.

you should just be using 1 NetworkStream object instead of your stream reader and writer objects. NetworkStream clientstream = client.GetStream() This will allow you to read and write to the network with one object and its also important that you always write Bytes to the stream. you can't just write text to the stream you need to convert the text to a byte array in a buffer and send it in chunks. small strings it doesn't matter much. But if it were an entire paragraph you aren't going to get 1 to 1 writes and reads.

But none of that really matters. It doesn't work because your two application use DIFFERENT PORTS! your client is trying to connect to port 1000 while your server is listening on port 4296. Change the port in the connect method of the client app to match the listener on the server and you should be good to go. assuming that you have your ports forwarded on your network, unless of course you use local host.

Also your threading is kinda sketchy, but it should work. that application.doevents() appears to be used in an odd fashion. See what you can do with the information i have given you. If you can't get it working right I will go back and edit the projects and re-post them. I would have already done that. But you are doing a …

Diamonddrake 397 Master Poster

You'll need to throw a contol, like a panel, in the area you want the arrow to be drawn in. Then hook up its paint event. Then use the event's painteventargs object to access the panel's graphics object. and use the graphic's objects drawline method to draw from point to point. Drawing curves are a little more complicated as then you need to draw Arcs and they take a complicated set of params to achieve a desired effect. But all the documentation is there. its just about making it happen.

Diamonddrake 397 Master Poster

first off, if you have visualstudio 2008 installed then you have .net framework 3.5 installed. They come together in the installer. you can't have one without the other.

and assuming you mean a StatusStrip control. You just set its BackgroundImage property to your image. you can't set a text property to an image as that is a string type. C# is strictly typed. You could also add a button or label to the statusstrip and use the button or label's background image, or image properties.

Diamonddrake 397 Master Poster

this is really disappointing. Well I found if I draw part of the staff to an image in memory and draw the image its actually faster than manually drawing the entire staff every time. But its still dirty. I have lots of stuff going on so I'm in no hurry. Maybe someone will have some ideas on this eventually.

Diamonddrake 397 Master Poster

Not like I don't have 100 unfinished projects already. But I recently come across a mario paint composer by unfungames.com. I remember playing mario paint back on the Snes. So I gave it a whirl. Turns out they wrote it in macromedia director. and it sucks. It does what its suppose to but the interface is buggy and it just doesn't work right. So I come across mario sequencer. its in Japanese it works ok, but it lacks all the features that would make it worth while.

So I decided I would attempt to make my own. I know using directSound with a secondary audio buffer you can alter the pitch of a wav file. no problem there. I drew the staff already using gdi+, no problem there. but then the problem comes with how do I loop through the objects added to the staff?

Here is my idea. I'm just not sure the performance will be worth the time. Any suggestions would be appreciated.

I used 20px gaps vertically and 40px gaps horizontally. I figure i create a "note" class that holds its point to be drawn on the staff. and when you click to add a note it will check the point you clicked and move it to the next even 40px interval for x and 20px interval for y causing it to snap to the staff. I the note class a frequency variable that is automatically set depending on its postiton.Y property. and give …

Diamonddrake 397 Master Poster

Try reading through your code and being absolutely sure that you always "close" the port in every situation before you attempt to "open" the port.

you will get that exception sometimes if you attempt to open an already open port. otherwise its hard to say without seeing some code.

Diamonddrake 397 Master Poster

you need to override the WndProc method of your form, and be sure to register your hotkey using that form's handle. then you check for the hotkey id in the wndproc and call any method you want to there.

Diamonddrake 397 Master Poster

The wrapper classes are technically slower than the base socket class. But if you need the functionality of them you will end up building your own wrapper for the base socket class that will likely have its own performance drawbacks.

So its not exactly a simple question. Best I can advise it to research other programmers results and see what combination of techniques best serves your purpose.

Diamonddrake 397 Master Poster

JasonHippy, I love windows with a fiery passion you couldn't put out if you had the entire open source community wielding extinguishers. Besides. all the really cool open source stuff, even mono and monodevelop its self are all based on open standards that Microsoft designed, created, and released to the world.

Don't get me wrong. Microsoft has had its problems. But sir I would never dare to have not a single windows machine.

I have 7 PCs 2 running Ubuntu, 1 windows 7 (my favorite), 2 vista (least favorite), and 3 with XP sp3.
and I have one MacMini running snow leopard or whatever they are calling the latest release. bah.

Free stuff is cool and all, but the best things in life come at a price.

Diamonddrake 397 Master Poster

you'll need it to validate often using the web server. behind the scenes.

Diamonddrake 397 Master Poster

nah, when they download the setup from a site, the site would prompt them for an email address and mail them a key they would have to enter in the program before the program would work.

Its not a simple solution. But fairly effective.

Diamonddrake 397 Master Poster

Process.start() will run an application. But if you pass to it a document. like a .jpg it will open in whatever its default application is. for example passing "http://www.dianiweb.com" would open your default web browser and navigate it to daniweb.

if you want to control the application that opens said doument, you can create a process object, and set its startinfo property to the document, and pass the program to run it in into its start method.

Diamonddrake 397 Master Poster

There is a database on a webserver somewhere that holds Keys and the date&time they were activated/issued. Either set up a site that issues keys, or integrate it into the application. Have this system generate a key and add that to the database with the current date&time. then the application can contact the database, if the application's key isn't in the database instruct the user that their key is invalid and exit the application. if the key is in the database check the user's current time vs. the database's start time and determine if the trial is still active. else take appropriate action.

Diamonddrake 397 Master Poster

the problem with finding new and interesting ways to hide your data is that in attempts to thwart virus attacks and unwanted software Microsoft has limited the access to many areas of the registry and hard-disk. So that keeps you from getting too creative.

there is NO guaranteed way. If someone knows their way around windows well enough they will always be able to find a way around your trial version. if you name the registry entry something that has nothing to do with your application, then its going to be less likely a user will find it with a simple search. but using programs that watch for changes in the registry when a program is installed or first run. they can find your registry entry and can change it.

if you save your data to a file, they can still find it and changed it. which leads to the newest method used by Adobe. the internet validation. Every time you open PhotoShop CS4. it connects to the internet and checks if the user's key is a valid key, and if it isn't then the program wont work, if the app can't get to the net. it simply works. but you could easily make your app not work if that were the case. Then when people download your app, or first run it. you could have it contact a webserver and create a key for them, attach to that information when the evaluation started, and use the server. …

Diamonddrake 397 Master Poster

+The Client/server concept is this. The Client is whoever starts the contact between machines. the server is the one waiting to be contacted. after the connection is made. technically they can be treated exactly the same either end.

+you should be able to use the URL. The internet connection of the user contains a dns server that will resolve the hostname automatically. (woo internet magic)

+I'm not familial with DynDNS's services. When using a commercial server you don't have to worry about forwarding your own ports and the like. But most of them don't let you run your own software on a machine level like a server daemon like this would require. But if you find one that allows you to run your own programs locally on them, then go for it. otherwise, its not that complicated to forward some ports. its just a hassle having to maintain your own servers.

+there server app always creates and modifies the data on the servers HD. the client couldn't do such a thing on its own. Even FTP that appears to let you browse the HD remotely is really just an app that is sending you file lists, and streaming the files, You aren't really directly reading and writing files.

Sounds like you are doing great so far.

Diamonddrake 397 Master Poster

Its good that you found a way to get the job done. But its also important that you understand why what you were doing didn't work.

First off. in the program.cs file is where the entry point of the application is placed. This is the Main method. the Application.Run(new Form1()); call creates a message pump with the specified form as the owner of the thread. It accepts an instance of a form as a parameter. There is never a reference variable created that you can see, although the static class Application does hold a reference to it.

from within in object, the keyword "this" refers to that particular instance of the object. So, we can use "this" to refer to our main form. so when you create your new form, give it a varaible of type form1. and expose it as a property, or make it public or assign it using its constructor, whatever. you could do something like

form2 myform2 = new form2();
myform2.form1var = this;

then from inside form two you could

form1var.methodOnForm1();

Its great you found another way to solve your problems, (in fact in most situations putting worker methods in a utility class is the best practice) but accessing methods from different instances is an important part of using C#. try and get it down. you'll be glad you did.

Diamonddrake 397 Master Poster

If you are on a local network its super simple, but if you intend to go across the internet between server and client. Any router's that the server is behind will have to be configured to forward the selected port to the intended server PC's IP. (but that's obvious) easy to overlook though. its also important to choose a port that isn't used by usual daemons (for example port 25 is reserved for RemoteDesktop)

Diamonddrake 397 Master Poster

if you use comments inside a CSV type initializer its practice to use /*comment*/ multi-line compatible comment blocks. although technically it shouldn't matter. but you never know what the compiler is doing to the text so being SURE where you comment terminates does help rule it out of the problem.

Diamonddrake 397 Master Poster

you can't embed the .net setup. but you can freely share the .net redistributable. But don't worry. if you use visual studio to create a .msi installer package, it will automatically make sure you have the required .net version installed and if not, it will prompt to install it from Microsoft.

Diamonddrake 397 Master Poster

Then there is always the "out" param. if you choose to go that route. But I would go with Danny's suggestion before I messed with outs.

Diamonddrake 397 Master Poster

C# is a class based language, EVERYTHING is in a class. So the ideology here is correct. but you are forgetting that the name "form1" is a reference variable of type "System.Windows.Forms.Form" you can't use a variable if you don't have a reference to it. So what you need to do is pass a reference to one form to the next. you could do that through a property, or constructors, or whatever you feel.

Diamonddrake 397 Master Poster

That depends on where you are trying to send it, and how much of it will be sent.

if the data is not that large you could easily find a server somewhere and write a asp page that will take some data and send it in an email, then the app can just post data to that and it will email to you or whoever. just that simple.

now if the data is large, then you will have to move to something more complicated like a client/server application. which is dead simple, just use the TCPServer class, bind it to as port and start listening, create a TCPClient object and connect to the ip of the server with the specified port and you are 50% done with the application already.