|
Thanks David, that article is where I got the idea to create this class. But unfortunatly, CMsg is derived from CString and can only be used with functions expecting a CString object. His class would be perfect, but it requires the use of MFC and it doesn't cache loaded strings.
|
|
|
|
|
waldermort wrote: But unfortunatly, CMsg is derived from CString...His class would be perfect, but it requires the use of MFC...
I knew you were looking for a non-MFC solution. How much work would be involved in changing all CString references to std::string instead?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I'm new to MFC and so this is probably a simple question - but I can't seem to find an answer after much looking. The background to the problem is:
1) I create a standard SDI application (using the wizard in Visual Studio).
2) In the View class (header) I create a combo box member varaible "CComboBox m_Com1; ".
3) I then call the Create function of "m_Com1 " from the "OnInitialUpdate " function of the view ("m_Com1.Create(WS_VISIBLE | CBS_DROPDOWNLIST , CRect(400,100,500,200) , this, 9); ").
This compiles fine but when I run the program and try and start a new file (or open a new file) from the main menu, I hit an assertion failure. This derives from "ASSERT(pWnd->m_hWnd == NULL); // only do once ", within "void AFXAPI AfxHookWindowCreate(CWnd* pWnd) ".
Could anyone tell me why this is happening?
Many thanks,
b_e_n_82
b_e_n_82
|
|
|
|
|
It is telling you that the window has already been created, and this is the second time you are calling Create() .
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
You can use of if before create combobox
|
|
|
|
|
Remeber that SDI applications reuse their view when you open a new document.
|
|
|
|
|
b_e_n_82 wrote: 3) I then call the Create function of "m_Com1" from the "OnInitialUpdate" function of the view...
Create the control in the view's OnCreate() method instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hey every one!
i was wondering is there any way that i can be able to change the text on a message box? what i mean is, in the funtion MessageBox(NULL,"text1","text2",MB_OK); is there any way that i can change the "text1" depending on what happends in the code?
thanx, jt
|
|
|
|
|
just pass a pointer to text instead.
<br />
char *foo = "Hello";<br />
char *bar = "World";<br />
char *txt = foo;<br />
MessageBox(NULL,txt,bar,MB_OK);<br />
txt = bar;<br />
MessageBox(NULL,txt,bar,MB_OK);<br />
You can then send in any string you like just by setting up a pointer.
|
|
|
|
|
hhhmm.. ya i tryed that it works great! thanx alot now i ave a good basis i can go on.
ok quick question what about this piece of code
#include <windows.h><br />
#include <stdio.h><br />
char *foo;<br />
char *fo="yo";<br />
char *txt=foo;<br />
int main(){<br />
char input;<br />
gets(input);<br />
<br />
input=foo;<br />
<br />
MessageBox(NULL,foo,fo,MB_OK);<br />
<br />
<br />
}
this dosnt seem to work for me can u shed some light?
thanx, jt
|
|
|
|
|
the line "input=foo" overwrites the text you input with an undefined string.
I think what you meant was "foo=input"
|
|
|
|
|
benjymous wrote: I think what you meant was "foo=input"
foo = &input perhaps.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Can you more explain change text on a MessageBox do you need to change text on parameters?
|
|
|
|
|
yea kinda like that.
but i wanna be able to change parameter 2 in the message box. depending on if a certin thing happends or not. ya see?
|
|
|
|
|
Why waldermort answer doesnt work for you
|
|
|
|
|
jqt wrote: is there any way that i can change the "text1" depending on what happends in the code?
Yes, just use a variable instead of a string literal.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hhhmmm.. ok i will try that.
thanx all for your help! (and time)
|
|
|
|
|
Hello everyone!
First of all, no, I'm not going to make a sequel to my previous program, it's for a "well-hearted" project.
But how do you get the stored login info for MSN Messenger? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
I heard somewhere that later versions of VC++ are able to support a variable number of arguments, but I can no longer find the article. I have a function declared as:
void SetLastError( LPCTSTR szFile, LPCTSTR szFunc, int szLine, LPCTSTR szError, ... )
and a macro as:
#define SETERROR(error) SetLastError(__FILE__,__FUNCTION__,__LINE__,error)
How is am I able to edit this to accept a variable number of arguments?
|
|
|
|
|
Why is it, you spend hours looking, decide to post, then 5 minutes later you find the answer?
#define SETERROR(error,...) SetLastError(__FILE__,__FUNCTION__,__LINE__,error,__VA_ARGS__)
Works like a charm.
Now, does anybody know how to add the "__VA_ARGS__" keyword to Visual Assist?
|
|
|
|
|
waldermort wrote: Now, does anybody know how to add the "__VA_ARGS__" keyword to Visual Assist?
Who came up with the term variadic anyhow?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
is there any tutorial out on the internet or maybe on codeproject (yes, i used the search dealing with the topic of waveOut incoming udp-packets (raw PCM audio data).
Thanks in advance
Regards,
kk3003
P.S.:
I am using Visual C++ 6 / MFC.
|
|
|
|
|
You'll need to buffer the incoming PCM samples somehow (try writing the samples immediately as
they arrive and you'll hear why ).
You'll need to correct for jitter (from packets arriving late, out of order, etc).
If the samples are from a live stream, you will also need to correct for clock drift.
There's lots of info out there about jitter buffers and clock drift.
Good luck!
Mark
|
|
|
|
|
Hi,
yes, I already tried that --> sounds funny. :=)
I just wondered whether I am the first person having this problem. So there could any code snippet out on the internet???
I am trying to implement a multiple buffer solution cos i think 2 buffers are not enought to play audio gaplessly.
Thanks for any help in advance...
regards,
kk3003
-- modified at 18:39 Wednesday 4th October, 2006
|
|
|
|
|
Code snippets can be hard to find VoIP is big business!
It can be done!
|
|
|
|