|
Excellant ! thanks for the help Chris / Jarl! !
(jarl, thanks for the followup email too)
Im going to implement these suggestions and ill update you on how it goes..
i appreciate all the tips on making my code better too, because Im not really a c++ expert (yet, im optimistic ). the current experience I do have w/C++ has been hacking together projects out of neccessity so im sure its sloppy....
|
|
|
|
|
jDawwg wrote:
appreciate all the tips on making my code better too, because Im not really a c++ expert (yet, im optimistic ).
So long as you maintain this attitude, you will end up being better than most. Good luck !!
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hello,
I want to change the caption of my Property Page at runtime.
SetWindowText does not the trick. The Caption Text specified
in the Dialog editor is always used, no change after a SetWindowText
call in OnInitDialog.
Any Idea ?
|
|
|
|
|
Wow - deja vu, I am having the EXACT SAME PROBLEM. Although my scenario is a little different - my property page is in Wizard mode.
If you know the new title when the constructor of the property page is called, you can put this in the property page constructor:
<br />
m_psp.dwFlags |= PSP_USETITLE;<br />
m_psp.pszTitle = "Some New Title";<br />
BUT... this will NOT work after the property page has already been created! If anyone knows of a way to change the property page title (especailly in a wizard-mode property page) at run-time (NOT in the constructor) that actually works, I'm all ears.
I hate property sheets.. one of these days I'll write my own custom version of them and avoid all the silly restrictions they have.
Even a broken clock is right twice a day.
|
|
|
|
|
|
Cool,
it works for me too.
Thanks
|
|
|
|
|
There is a PROPSHEETPAGE pointed to by the m_psp class member of a property. This contains a field
pszTitle which contains the the title of the property page. Yoy will need to set the PSP_USETITLE flag in the dwflags of the property sheet to use this. You might give this a try.
|
|
|
|
|
The following is my code:
CAsyncSocket socksrv;
char buff[500];
...
UINT ClientThread(LPVOID lParam)
{
CSocket* s = new CSocket;
s = (CSocket*) lParam;
while (1) {
s->Receive(buff, 500*sizeof(char), 0);
if (strlen(buff)) {
::SetFocus(NULL);
AfxMessageBox(buff);
}
}
return 0;
}
UINT ServerThread(LPVOID lParam)
{
CSocket s;
socksrv.Create(55599);
socksrv.Listen();
while (1) {
if (socksrv.Accept(s)) {
AfxBeginThread(ClientThread, (LPVOID) &s);
}
}
return 0;
}
void CServerDlg::OnStartServer()
{
AfxBeginThread(ServerThread, NULL);
}
When I execute the following, and try to connect the client, an exception occurs. Please tell me where my mistake is, and if you know what the multithreading sequence must be using CSocket or CAsyncSocket...
Thank you!
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
Vladimir Georgiev wrote:
if you know what the multithreading sequence must be using CSocket or CAsyncSocket
Never use MFC socket classes in Multithreaded environment, otherwise you'll be between the devil and the deep sea. MFC not allows you to pass CSocket/CAsync objects directly from one thread to another. You have to use references for that purpose. Have a look here[^]
|
|
|
|
|
Hi,
In my dialog-based program, I am creating a CComboBox with some
data that I read from a file. So this is a case where I cannot
use the resource editor. But now that I have it created, I am
finding nothing in the documentation (I am new to VC++) which
explains how to receive and process events when the user selects
a new item in the combo box. Can anyone explain this very basic
concept to me? A friend of a friend says I have to something
with a message map, but doesn't know precisely what. Any help
would help.
Thanks!
x66u
|
|
|
|
|
In the case of MFC, you will need to add the message map entries/function prototypes for the control manually.
If you create the control with an ID of IDC_MYCOMBO you would use for example
afx_msg void OnSelChangeMyCombo();
ON_CBN_SELCHANGE(IDC_MYCOMBO, OnSelChangeMyCombo)
void CYourClass::OnSelChangeMyCombo()
{
}
...
The other message map entries for a combo box are (from MSDN):
Combo Box Handlers
Map Entry Function Prototype
ON_CBN_CLOSEUP( <id>, <memberfxn> ) afx_msg void memberFxn( )
ON_CBN_DBLCLK( <id>, <memberfxn> ) afx_msg void memberFxn( );
ON_CBN_DROPDOWN( <id>, <memberfxn> ) afx_msg void memberFxn( );
ON_CBN_EDITCHANGE( <id>, <memberfxn> ) afx_msg void memberFxn( );
ON_CBN_EDITUPDATE( <id>, <memberfxn> ) afx_msg void memberFxn( );
ON_CBN_ERRSPACE( <id>, <memberfxn> ) afx_msg void memberFxn( );
ON_CBN_KILLFOCUS( <id>, <memberfxn> ) afx_msg void memberFxn( );
ON_CBN_SELCHANGE( <id>, <memberfxn> ) afx_msg void memberFxn( );
ON_CBN_SELENDCANCEL( <id>, <memberfxn> ) afx_msg void memberFxn( );
ON_CBN_SELENDOK( <id>, <memberfxn> ) afx_msg void memberFxn( );
ON_CBN_SETFOCUS( <id>, <memberfxn> ) afx_msg void memberFxn( );
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
Hello,
I've discovered that the lower menubar in WinCE for PocketPC
is in fact a toolbar. Fine there, but now I am wondering
how to add a popup menu to it. Can anyone point me to some
minimalist sample code that implements such a thing?
Thanks very much!
x66u
|
|
|
|
|
Hi all,
I hope this is the right forum to ask, I want to do it from C++ so I figured I could try here )
I'm trying to get an image from an html page that I have in memory. IWebBrowser2 doesn't let me do that AFAIK, it looks like I even have to actually create a window to use it. I just want to pass a string with html to some function, and have that function return a bitmap (with specifyable width & height ofcourse). I would prefer to use IE to do it, since I need to render MathML. Any thoughts? Thanks in advance.
cheers,
roel
|
|
|
|
|
I think you need to query for the interface to the DOM--
that's an IHTMLDocument2. It should allow access to the
images.
oh yeah... a link to example[^].
|
|
|
|
|
oh wait. did you want an image on the page or an image of the page.
|
|
|
|
|
Yeah I wanted an image _of_ the page... Thanks for replying anyway
|
|
|
|
|
Take a look at this msdn page[^] which lists all HTML interfaces used in Internet Explorer. Take a look at IHTMLPainter for instance. I have not tried/tested this and have no idea if this is what you are looking for but it sounds promising..
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Hmm this is indeed an interesting list... Thanks, I'm going to look through it!
|
|
|
|
|
Hi,
I've been attempting some owner draw buttons and wish to set the check state of a CButton without using the BM_SETCHECK message or the SetCheck member function. The reason i want ot do this is that if you send the BM_SETCHECK message (the SetCheck function just sends the message) then windows redraws the checkbox, however i want to Set the check state without windows redrawing the checkbox.
I was hoping that someone may know where the check state of a button is stored and how to get at it from the HWND?
Thanks,
Jon
|
|
|
|
|
One solution is to derive a class from CButton and design your own set-check mechanism.
Kuphryn
|
|
|
|
|
I need to convert vector members of form std::vector<std::string> to LPSTR. Need to convert the string to char*. Has anyone done this? Any suggestions? Thanks for any help.
|
|
|
|
|
how about:
LPCSTR p = static_cast<LPCSTR> &myvector[0];
or using a std::string instead of vector next time and do:
LPCSTR p = mystr.c_str();
|
|
|
|
|
When I use the first solution it gives me:
error C2059: syntax error : '&'
I need to use a collection class for my list of strings. Thus the use of vector.
|
|
|
|
|
Tdcu wrote:
When I use the first solution it gives me:
error C2059: syntax error : '&'
Did you enter it exactly like it was shown in his response, he didn't use the correct formatting to display. He ment to type something like this:
<code>LPCSTR p = static_cast<LPCSTR> &myvector[0];</code>
<font color="green">
<code>LPCSTR p = static_cast<LPCSTR> &myvector;</code>
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
Thanks Nick. I was leaving out the const (just using LPSTR).
|
|
|
|