|
How bout playing an mp3? U must need a dll I guess, but where do u get it from and how do u make it work? Does anyone know a site that teaches u this? Thanks anyway!
Serban
|
|
|
|
|
There is an article on CodeProject on skinnable apps that includes C code to play an MP3. It's only drawback is that it isn't C++, it uses globals and therefore cannot be used to play more than one at a time ( I want to find code that does so I can use MP3's in my game sound engine ).
There are a few libraries about, but I don't like not having the source code, and I didn't like the licencing that came with the two libraries I found ( one required payment for any commercial product using the library, which is fair enough but there is no way my employer would pay for something like that, the other was free but reserved the right to become retrospectively expensive, which IMHO is too big a risk to play with at all ).
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Can anyone please provide sample code to bring up a property sheet using WTL?
|
|
|
|
|
Hi,
ok how do I access contents of a structure from inside asm code?
For example I have a structure (with which I will make a list)
typedef struct _LIST{
DWORD value;
struct _LIST *next;
}list;
then I have a pointer of this structure
list *my_list;
After having input the data in this list, how can I traverse the list from inside __asm to read the variable "value" for each of the structures?
i.e. How do I read my_list->value and my_list->next from inside __asm block?
Thanks
|
|
|
|
|
Ok. Here's a quick example. You should be able to figure out the rest.
list *my_list;
my_list = new list;
my_list->value = 1234;
my_list->next = new list;
my_list->next->value = 5678;
__asm
{
mov eax, my_list // eax = my_list;
mov ebx, dword ptr [eax] // ebx = my_list->value
mov ecx, dword ptr [eax+4] // ecx = my_list->next
mov edx, dword ptr [ecx] // edx = ecx->value
}
|
|
|
|
|
Hi,
I like to know what is the general way of serializing a class....
I just like be able to save and open bmp files..
thanks
Ehsan
Ehsan Behboudi
|
|
|
|
|
The BMP format has had a gazillion wrapper classes written for saving and loading it, including some here on the CodeProject.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Hi,
just for the first part of your question. General way serializing a class.
Have a look on CObject. Generaly you have to derive your class from CObject - and overwrite the
serialise method in your own class.
(DO not forget the macros implement_dyncreate, declare_dyncreate in your class .h/.cpp file)
Have also a look into the document class of your app . There you will find also a serialize method.
When you have a member in your document from your own class, you simply call :
...
m_abc.serialise;
...
in the document serialize class to load or store your class in a file (as binary file).
|
|
|
|
|
If I set window extensions in a CStatic control why allow draw outside of this window extensions. What's the way to fix a limit of draw in a window?
Thanx
Carles
|
|
|
|
|
I have a droplist combobox in a modal dlg called from mainfrm in an SDI.
The combobox must obtain its initial selection ( a CString ) from the selected text in a listcontrol in a dlgbar, also in mainfrm.
How do I accomplish this?
|
|
|
|
|
You should be able to get a pointer to the ComboBox (use .GetDlgItem(ID_OF_COMBO)).
Then with that pointer you should be able to access the members and functions of the
ComboBox (comboBox->...).
Here's an example:
CDialog dlgModal; //initialize the dialog you are about to show.
CComboBox* pCBox = dlgModal.GetDlgItem(ID_OF_COMBO); //get pointer to the ComboBox.
int nDx = pCBox->FindString(-1, "string to find"); //get index of the item you want selected
//the -1 tells it to search from the beginning
...and whatever else you need to do.
...
dlgModal.DoModal(); //display the dialog
I've not done anything quite like what you are attempting, but you should be able to
get a pointer to any control on the form and use that pointer to access its members and functions.
I hope that helps. David.
|
|
|
|
|
Hello, the codegurus around the world.;)
The easiest way to satisfy your requirement is to put public member value like
m_sCurSelectedString in CMyMainFrame.
CMyMainFrame is the parent window of the dialog, dialog bar with ListBox.
I guess that ListBox is the same child level of the dialog bar since ListBox is declared
at CMyMainFrame class?
m_sCurSelectedString is always updated if the user updates the selection of ListBox.
So, when the dialog is opened, m_sCurSelectedString compares the string in ComboBox
in OnInitDialog().
So, how do we access m_sCurSelectedString from Dialog Box?
1) Pass the parent's CWnd of dialog constructor arguement. or
2) Use CWnd::GetParent() or
3) Use AfxGetMainWnd() and cast the pointer of CMyMainFrame.
And, how do we update m_sCurSelectedString of ListBox.
I think that we can use MessageMap of ListBox in CMyMainFrame.
The other way is that we can pass CWnd of ListBox on Dialog Bar
to the consturctor arguemnt of CMyDialog.
At this case, we can direclty access the currnet selected item of ListBox.:cool:
I think that there are several other ways to do this.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
In the app class header file, after the app class definition, add the folowing line:
extern CMyApp theApp;
Add these declarations to your app class:
private:
CMainFrame* m_pMainFrame;
public:
CMainFrame* GetMainFramePtr() { return m_pMainFrame);
In the OnInitInstance function of your app class, do this AFTER the main window is created:
m_pMainFrame = pMainFrame;
In the CMainFrame class, put a function that accepts a CComboBox* like so:
int CMainFrame::FillComboBox(CComboBox* pCombo)
{
return pCombo->GetCount();
}
From within the OnInitDialog() function in the dialog box class, call your function like so:
theApp.GetMainFrame()->FillComboBox(&m_ctrlComboBox);
I'm assuming that your dialog box class already has #include "MyApp.h" in it.
|
|
|
|
|
hi there,
following problem:
char g_szOutputFile[_MAX_PATH];
CString pathname;
now i want to copy pathname into g_szOutputFile and i call
strcpy(g_szOutputFile,pathname);
but this doesn't look like it is working, are there any other functions i can call to convert a CString into a char?
thank's in advance,
patrick
|
|
|
|
|
Strange, it's alwayse working perfectly (and doing so now!)
But try to use LPTSTR GetBuffer( int nMinBufLength );
char *c;
CString S;
c = S.Getbuffer(10)
|
|
|
|
|
I'm pretty new to C++, but it seems to me that you can just cast
the CString. I believe you need an LPTCSTR type for the strcpy function,
so I think you can do a simple cast from CString to the LPTCSTR type:
...(LPTCSTR)pathname...
You may need to cast it again such as:
...(LPTSTR)(LPTCSTR)pathname...
David.
|
|
|
|
|
You can try it as such:
char szFileName[MAX_LENGTH];
CString pathname = "c:\temp";
strcpy(szFileName, (const char*)pathname);
|
|
|
|
|
thank's a lot guys, you helped me a lot
patrick
|
|
|
|
|
I Think strncpy should be used for "safer" strcpy
#define STRCPY(d,s)
strncpy( (d), (s), sizeof( (s) ) - 1 );\
(d)[ sizeof((d)) - 1 ] = NULL;\
STRCPY( g_szOutputFile, pathname );
|
|
|
|
|
you can use one of these:
strcpy(g_szOutputFile, (const char*)pathname);
strcpy(g_szOutputFile, (LPCTSTR)pathname);
strcpy(g_szOutputFile, (LPSTR)pathname);
strcpy(g_szOutputFile, pathname.GetBuffer(pathname..GetLength())); pathname.ReleaseBuffer();
|
|
|
|
|
I want to add the capability to my dialog based application so when I start it, it looks to see if any other instances of the application are running. If there is one already running, that instance will be killed and the new instance will be started. How can I do this, I know I have seen it on here before but cannot find the solution. Any help?
Roger Printy
Software Engineer
TeraNex
Orlando, FL
|
|
|
|
|
So what's exactly is the problem? Determining if another instance is running, or terminating it cleanly?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Both really. Like I said, I have done it before just cannot find the source code I used.
Roger Printy
Software Engineer
TeraNex
Orlando, FL
|
|
|
|
|
The following article by PJ Naughter deals with "single-instancing":
http://www.codeproject.com/cpp/csingleinst.asp
However, the code you'll find there closes the second instance (not the original one). To close the original instance, you can send a message to its main window. WM_CLOSE could work here, depending on the actions your program performs on closing. If any msgboxes are displayed (prompt for save, etc.), you can choose to use some private application message.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Works like a dream, it really did not matter which one was closed, probably better to have the new instance stopped rather than the last instance. Thanks!
Roger Printy
Software Engineer
TeraNex
Orlando, FL
|
|
|
|