|
can you embed a wav inside a resouce file somehow ? also is it possible to PInvoke the "error" sound that accompanies a MessageBox with the MessageBoxIcon.Error property set ?
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
jtmtv18 wrote:
can you embed a wav inside a resouce file somehow ? also is it possible to PInvoke the "error" sound that accompanies a MessageBox with the MessageBoxIcon.Error property set ?
The embedding is easy, just add the wav to your project and set it embedded content, the use Assembly.GetManufestResourceStream("namespace.filename.ext") to get a stream object from this.
Playing it. The is a nice article of CP that shows you how to play wave file with P/Invoke. Let me know if you need help loading from memory.
Cheers
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
i do need help setting up the memory stream. i use directx 9.0 to play it; ie
private void PlayAudio(string fPath){<br />
Audio player = new Audio(fPath);<br />
player.Start();<br />
}
if the audio file is coming from a memory stream how do i get the bytes to stream to the above method ? thanks leppie. ps.. the audio file will be named Error.wav;
just reading the overload methods for Microsoft.DirectX.AudioVideoPlayback.Audio i find that it only takes a (strin filename) ..how can i tell it to play my embed resource instead? (which will come in a stream)
The Code Project Is Your Friend...
|
|
|
|
|
jtmtv18 wrote:
directx 9.0
Thats a bit over the top , dont you think?, use p/invoke rather
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Aeru IRC project is looking for developpers and artists.
Aeru IRC is free and open source IRC Client for .NET.
Unlike most of others .NET IRC Client, I don't use a external IRC library, it's my own IRC implentation.
You can find the client at http://aeruirc.sourceforge.net/
I need developpers who can contribute their coding talent to fix bug, refactoring somes parts and adds features. I work with Windows.Forms and Magic Library(soon UtilityLibrary for the toolbar).
Also, I need artist to draw the menu icons, tab icons. In future, I will neeed an artist to doing toolbar images(I waiting for a artist to implent this feature).
If you are interested, email me at shock@shockdev.ca.tc.
Thanks in advance!
-Shock The Dark Mage
Aeru IRC programmer and project maintener.
Trully, if there evil in this world, It lies within the heard of mankind
Shock The Dark Mage
shock@romhack.net
Main Project: Aeru IRC - http://www.sf.net/projects/aeruirc
|
|
|
|
|
what exsactly is Aeru IRC ? a irc chat client right ? whats diffrent about it ? (if i may ask)... i would like to help with what ever i can. How many people are working on it ?
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
Aeru IRC is a simple irc client I started from nothing without using extern librairies to implant IRC Protocol. I'm using Magic Library for the GUI and soon Utility Library. You can use Visual Studio .NET or SharpDevelop.
You can help me by adding features, fix bugs and refactoring the core(IRCConnection and IRCParser)
Currently I'm the only developping Aeru IRC and I got one artist.
Contact me with MSN, my address is shock@shockdev.ca.tc
Trully, if there evil in this world, It lies within the heard of mankind
Shock The Dark Mage
shock@romhack.net
Main Project: Aeru IRC - http://www.sf.net/projects/aeruirc
|
|
|
|
|
I am trying to achieve the flat treeview look of VS.NET, (IE, a SystemColors.ControlDark colored FixedSingle border).
And this does appear to be massively harder than it first seemed. The border AND the scrollbars on the treeview are part of Non-Client area of the control. So, I first thought that I might subclass the sucker, paint the border in the NC area of the control, and then throw away WM_NCPAINT, cant do that, because the scrollbar doesn't paint. So, I am left with passing it back to the DefWndProc, and then painting over the border, causing massive flicker.
I also tried to update the HRGN in WM_NCPAINT and it wouldnt have any of it.
Has anyone successfully painted their own border on the TreeView, ListBox, TextBox or RichTextBox ??
Maybe there is an easier way I have overlooked? Any help would be greatly appreciated.
|
|
|
|
|
Noone got any ideas? Damn this one is a beasty.
|
|
|
|
|
In most cases you let WndProc handle the WM_NCPAINT method, then overpaint it yourself. A few of the controls will let you paint the border without having it painted by WndProc first, but many won't. I know this is double-painting, but with some controls there's just no way around it, save for rebuilding the entire control yourself. Also, after painting the border on some controls you will need to Send WM_ERASEBKGND and WM_PAINT after you've painted the border so that things like scrollbars are re-drawn.
Also, take care with the way you are creating your graphics object for painting. Some controls will work with a simple Graphics.FromHdc(Handle), but others will need to get their graphics instance from user32.dll like this:
[DllImport("user32.dll")]<br />
private static extern IntPtr GetWindowDC(IntPtr hWnd);<br />
Graphics g = Graphics.FromHdc(GetWindowDC(Handle));
One last note, make sure you don't set UserPaint, DoubleBuffer, AllPaintingInWmPaint for controls that you are going to paint borders on using the WM_NCPAINT WndProc override - doing so will only create you much frustration.
There are many controls in the base library that need to be WndProc painted, and all of them have their own little quirks. It took me a couple of days to learn the ins and outs of each, but once you've got the basic ideas it's fairly straight forward.
|
|
|
|
|
This was one of the first things I tried, I set the border to FixedSingle, so that it was 1 pixel around the edge, and then I painted over the border after the control had finished painting it. Of course, this causes flicker when resizing, which was what I was keen to avoid.
Drawing a damn rectangle isn't always as easy as it first seems
|
|
|
|
|
Are you interested in just the treeview, or all the controls previously listed?
|
|
|
|
|
Here's how to user-paint the border of the TreeView control:
1) Create a class that inherits from System.Windows.Forms.TreeView
2) Add the follwing using directive:
using System.Runtime.InteropServices;
3) In the class body, add the following user32.dll wrapper method:
[DllImport("user32.dll", CharSet=CharSet.Auto)]<br />
private static extern IntPtr GetWindowDC(IntPtr hWnd);
4) Add the follwing WndProc override method:
protected override void WndProc(ref System.Windows.Forms.Message m)<br />
{<br />
if( m.Msg == 0x0085 )<br />
PaintBorder();<br />
else<br />
base.WndProc(ref m);<br />
}
5) Add the PaintBorder method:
<br />
private void PaintBorder()<br />
{<br />
Graphics g = Graphics.FromHdc(GetWindowDC(this.Handle));<br />
Rectangle r = new Rectangle(0, 0, Width, Height);<br />
<br />
<br />
g.Dispose();<br />
}<br /> That's it! Note that every control has it's own unique methods for border painting. This particular method will work only for some of the controls,
others will require the WM_NCPAINT to be handled by WndProc before you go painting border, causing a double-paint. Other controls require you to
create the Graphics object from the actual parent form rather than the control itself.
On final note, ensure the border style is 3D, not Single or none.
Hope this helps!
|
|
|
|
|
hi!
I want to make a snapshot mh, for example if you know the programm "Hypersnap". I have an window (lets say an IE window) and now I want to have a bitmap/jpg of a foto in that window...
hope its clear what i mean...
any ideas? (im have absolute none
thx
|
|
|
|
|
Here[^]
Use the code to capture the screen, then use their crop function to crop it to you control's this.ClientRectangle
I walk these roads,
I climb these mountains,
Though they are nothing,
But paths and hills,
for the only mountain is success,
and the only road is life.
|
|
|
|
|
Dear All,
Please let me know whether you know how to have reinstall feature in a Windows Installer .msi module. Normally when you setup an application and then run the .msi again, you have the repair and remove features, Now what I must do to have some other options like reinstall or upgrade to new versions?
Regards,
Sassan Komeili Zadeh
|
|
|
|
|
How about a bootstrap setup.exe that removes the current installation and then loads the new .msi file to install it. Other than that I'd think you'd have to use Installshield or Wise Installer to upgrade, or write your own app that checks current files to upgrade them if needed.
I walk these roads,
I climb these mountains,
Though they are nothing,
But paths and hills,
for the only mountain is success,
and the only road is life.
|
|
|
|
|
Dear Jonny,
Thanks.
Actually I used this solution before, but it is hard to manage upgrade mode with bootstrap and installer both.
regards,
Sassan
|
|
|
|
|
Sassan Komeili Zadeh wrote:
reinstall or upgrade
What's the difference between reinstall and repair?
For doing an upgrade, simply add a record into the new MSI's Upgrade table, telling it to upgrade the current project up to but not including the new version.
ie.
If you want to upgrade to v2.00.9 and the Upgrade Code of the project is {99999999-9999-9999-9999-999999999999} then you need the following in the Upgrade table:
Upgrade Code: {99999999-9999-9999-9999-999999999999}
Version Min: NULL
Version Max: 2.00.9
Language: NULL
Attributes: 1
Remove: NULL
ActionProperty: MYUPGRADEPROPERTY (call it whatever you like, as long as it's block-caps and not used elsewhere)
It's then advisable to add a property SecureCustomProperties, containing MYUPGRADEPROPERTY, so that this property can't be used by anything else. If there's already a SecureCustomProperties then you should add ";MYCUSTOMPROPERTY".
This should force a new version to remove an old version before installing.
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
Dear Paul,
Sorry for late reply.
Actually I have an application which has an storage folder and also a database which extracts user information. I want to repair module fix the functionality of application if for example some .dll files are missed but the storage and db are remained with the user previous data.
But in reinstall I want to erase DB and user storage in order to have everything as the first time user installs.
Can you help me with this scenario?
Thanks for the upgrade solution.
Regards,
Sassan
|
|
|
|
|
Sassan Komeili Zadeh wrote:
But in reinstall I want to erase DB and user storage in order to have everything as the first time user installs.
Can you help me with this scenario?
I would suggest this is a software job, not an installer job; but then I write installers for a living at the moment and I tend to suggest everything is a software job, rather than the installer.
It's not easy to add an entry path to the installer, unless you have InstallShield Developer or something else with a built in Dialog Editor.
You could add a custom action to the Repair which throws up a message box asking if the user wants to remove the database.
But I really would encourage you to make database creation and rebuilding part of the software itself. It's much easier and MUCH more controllable.
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
I have an obejct with some properties , one of those propps is a delegate..
now i would like to be able to show this in a propp grid , and let the user choose a method for the delegate prop (kinda like choosing events in c#)
any ideas?
//Roger
|
|
|
|
|
Roger J wrote:
I have an obejct with some properties , one of those propps is a delegate..
now i would like to be able to show this in a propp grid , and let the user choose a method for the delegate prop (kinda like choosing events in c#)
F#$$king cool idea I'm gonna use it
Roger J wrote:
any ideas?
TypeConvertor with Reflection, send me the code and I'll try figure it out.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Oh , forgot to say , in my case , it should not be so cool as you might think ,
it should be used in a control , so i want to be able to choose methods at designtime , and i guess the code doesnt need to be compiled ´for them to show up....
so i would guess reflection would not be the way to go (in my case) (??)
//Roger
|
|
|
|
|
Roger J wrote:
it should be used in a control , so i want to be able to choose methods at designtime , and i guess the code doesnt need to be compiled ´for them to show up....
I just got thinking...an event is a delegate, so why not just define the delegate as an event? Then you get all of the goodie for ZERO effort... I will look into it a bit more though.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|