|
In all honesty, I have only been programming for about two years, and most of it has been basic console programs with C++. I was going to be an architect. This is all very new to me, and I have tried other languages, but it doesn't mean I'm not open to others. I understand .NET MC++ easier than the others I have tried. I've heard C# is easier and it looks exactly like C++ to me. Thanks for the information though, maybe I'll investigate MFC.
Mike - I love to program!
|
|
|
|
|
allenmpcx wrote:
I understand .NET MC++ easier than the others I have tried. I've heard C# is easier and it looks exactly like C++ to me. Thanks for the information though, maybe I'll investigate MFC.
I don't know what you've tried, but MFC apps are pretty simple, if you know a bit of C++. The framework is not perfect, but it's a huge improvement on Win32. C# looks a lot like C++, so it's easy to move, and it's definately a much easier way to get to WinForms than MC++ is.
I'd investigate C# and MFC as good alternatives. DirectX is available in both, but it's a ton easier in C#, because C# handles all the COM pointer stuff for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Now I'm extremely intrigued. Most of my application was written in MC++ and if I were to transfer it over to C#, would .NET still create the .exe file, and would I get that Resource Editor GUI that is provided? If so, I'd switch my application to C# right now.
Mike - I love to program!
|
|
|
|
|
allenmpcx wrote:
Most of my application was written in MC++ and if I were to transfer it over to C#,
There's no automatic conversion, but you could certainly put your existing non GUI code in a dll and call it from C#.
allenmpcx wrote:
would I get that Resource Editor GUI that is provided?
I believe the resource editor in C# is better than the C++ one, unless MC++ gives you the same one.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Not to prolong this, but how would I put all my code inside of a .dll and call it from C#? If its too complicated, or takes too long, I might just re-write everything to make it more efficient and learn C#. As long as I can have the .exe and the Resource Editor, I'll be fine. Thanks for the information, I love programming epiphanies.
Mike - I love to program!
|
|
|
|
|
Well, you'd basically create a managed C++ dll and move the code into it. Your current project would be set up to create an exe. If the code can be easily ported to c#, I'd do that instead, the cross language thing could be a pain later.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How would I create a C# Forms application using Microsoft Visual Studio .NET?
Mike - I love to program!
|
|
|
|
|
new/project/c#/windows application. Something like that.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
One last question, then I'm all done, and I greatly appreciate the information:
Would you happen to know how to add a double buffer to a Panel? In C++ I did this:
Panel->SetStyle(ControlStyles::UserPaint, true);
Panel->SetStyle(ControlStyles::AllPaintingInWmPaint, true);
Panel->SetStyle(ControlStyles::DoubleBuffer, true);
However I got errors about accessing SetStyles when it is of type Panel. However, I paint everything on the panel. Is there a way to add a double buffer?
Mike - I love to program!
|
|
|
|
|
I use those same calls to make my app double buffer. I wonder why you can't do it to a control.
I draw all my images myself, and if you do that, you can certainly set double buffering up like that in your main window.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
A piece of advice - the MVP next to Christian's name means "Microsoft Valued Partner" and there are about 70 for C++ on the planet so you have one of the top guys around helping you out.
I would suggest MFC too, the DirectX SDK comes with lots of examples including ones on playing sound.
Basically you put individual sounds into secondary buffers and they are combined into the output buffer which goes to the output device.
For samples under 1MB you can just read them into the secondary buffers, above that it is reccomended you use streaming into the secondary buffers.
I hope this helps.
Elaine
The tigress is here
|
|
|
|
|
To answer the original question (at least for C++):
If all you want to do is play wave files, then you can simply call the PlaySound function. If you need to anything more sophisticated like mixing sound files together, etc. then you'll probably need DirectX. But for basic wave files, the PlaySound function is very easy.
From regular C++ (someone else will have to help with proper imports for the managed environment):
#include "mmsystem.h"
#pragma comment( lib, "winnmm.lib" )
void SomeFunction()
{
PlaySound( szSoundFileName, NULL, SND_FILENAME | SND_ASYNC | SND_NOWAIT );
}
|
|
|
|
|
Hi everybody,
I need a fast help drawing a line (function lineto) on top of a programmatically created Cstatic Control.
I tried setting back with SetWindowPos(&wndBoottom... but nothing.
Do you know any way or i should create a custom line control?
Thanks in advance.
ginognaus
|
|
|
|
|
A CStatic only contains text. You'll need to make your own control, best bet IMO is to derive from the static and owner draw.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Assuming m_Static is your static control:
CDC *pDC = m_Static.GetDC();
pDC->MoveTo(0,0);
pDC->LineTo(100,100);
|
|
|
|
|
Hello,
Derive a class from CStatic using Class Wizard. Draw enough code in OnPaint(...).
Is it OK?
- NS -
|
|
|
|
|
the problem is that i have a window and a Cstatic control on it. I have to draw a line that goes on both. Knowing this, are your solutions still valid or i shoul build a bevelline(that what i need) class and set it's position with SetWindowPos?
tnx
|
|
|
|
|
I feel you have a better method than me! It will be fine if you set the zorder of bevelline control to the top of the static control in SetWindowPos(...).
- NS -
|
|
|
|
|
ginognaus wrote:
I need a fast help drawing a line (function lineto) on top of a programmatically created Cstatic Control.
This link might help you
http://www.codeproject.com/cpp/cppfaq10dec04-23jan05.asp#q214
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i am working on a Database project thats one table in its Database contains an images, i am retrieving data with CRecordset.
the problem is when i try to get the retrieved data from CLongBinary to bitmap, i try:
////////////////////////////////////////////////////////
bitmap.FromHandle(HBITMAP(varValue.m_pbinary->m_hData));
::OpenClipboard(this->GetSafeHwnd());
::SetClipboardData(CF_BITMAP,HBITMAP(bitmap));
::CloseClipboard();
////////////////////////////////////////////////////////
but i colud not paste the data from the clipboard to Microsoft Paint.
any one has an idea about this.
|
|
|
|
|
A HBITMAP is a handle, it's not the actual bitmap data. How did your data get in there ? If the data is pixel data on a non paletised image, you can create an image of the same depth that's a DIBSection and copy the bytes in.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I'm trying to get the shell to start labeledit on an item
in a namespace exension I've created...
I've tried some things but nothing have worked, e.g. to get
the item's contextmenu, but since it's my application who supplies
that menu, it doesn't work...
Any one have a slightest clue how you do this?
"There is an empty room full of people who think you are creative"
|
|
|
|
|
Have you consulted Michael Dunn's nine-part article on namespace extensions? It might shed some light on the problem you are having.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Jepp, I've read them...
"There is an empty room full of people who think you are creative"
|
|
|
|
|
Hello Gurus,
I wish to build an application that will be a map designer for old fashionned 2D games.
The workspace will contain:
- references to tiles which are bitmaps either opened from existing bmp files or created by the application. So I will provide a simple bitmap editor. These bitmaps will be stored in separate .bmp files at a given path. I intend to save the path of the bitmap files in the main document. The tiles will be 3 sizes: 8x8, 16x16 or 32x32. The tiles are in 4 gray scales.
- tables: Once tiles are done (at least one tile), we can create tables of tiles. The tables will contain references to the tiles. All tiles in a table are the same size: 8x8 or 16x16 or 32x32.
- sprites, once tables are built (at least one table), we can create sprites, which are composed of tiles. the sprites's size are a multiple of the tile's size in width and eight.
- frames: These sprites can contain several frames. Frames are a set of sprites (of course). The size of sprites are any size but a multiple of the tiles in width and in height. all frames must be the same size.
- maps, like sprites, once tables are created (at least one), we can create maps. The size of map are any size but a multiple of the size of tile in widht and eight.
The document will open or save all these information.
I want to build all in visual with drag'n drop stuffs for the tables, sprites and maps editors.
I hope you see the application I wish to build.
How can I handle such application in MFC?
Thanks for the suggestions and helps.
Best regards.
Fred.
There is no spoon.
|
|
|
|