|
Hi. I've been working on these examples even after I unfortunately lost, my CD with source code provided with Petzold's book "Programming Windows" (version about 98 and NT). But now I'm stuck, and I desperately need the source code, to compare it with mine.
So, does anyone know where can I download it (for this version of book, not for Windows 1.0 or Windows 95), or if can someone send me only the source code (without executables), or even only, source code for 21th chapter.
Thanks.
|
|
|
|
|
http://jztele.com/~coldice/program/win-prog-src.tgz
|
|
|
|
|
Thanks for effort, but this is not what I need (since this is not what I need, and I noticed Jeffrey Ritchie in the commnet, I assume that this is not even from the book, which rource code I need).
Again, Im desperatly need this source code, can anyone help me with this??
|
|
|
|
|
THe dictionary doesnt give a technical definition, and its not clear to me what a token is from MSDN, in strtok . Say I have a string
abc_defg_hi, and I want to break it up into abc, defg, hi etc. THe delimiter is '_', and if do strtok on this string one time, what do I get back?
Sorry if this sounds too simple, but I am really not sure what exactly the token is, in this case.
Thanks,
ns
|
|
|
|
|
ns wrote:
THe delimiter is '_', and if do strtok on this string one time, what do I get back?
pointer to "abc" first time, pointer to "defg" next time, then pointer to "hi" and NULL the last time.
Token is a part of the string delimitted by the delimitter in this context.
Pavel
Sonork 100.15206
|
|
|
|
|
That explains it clearly. Appreciate it. BTW have you any light to shed on my postmessage/sendmessage problem (an earlier thread from yesterday? Its puzzling me tremendously.)
Thanks,
ns
|
|
|
|
|
Sorry, My first reply eas incorrect, was fixed
Pavel
Sonork 100.15206
|
|
|
|
|
I cant find the value of WM_COMMAND anywhere. WHat is it and where is it defined?
Thanks,
ns
|
|
|
|
|
0x0111. It's defined in WINUSER.H.
Pavel
Sonork 100.15206
|
|
|
|
|
I searched the MFC directory for files with text WM_COMMAND , and winuser.h never came up. I guess it doesnt exist in the MFC directory.
Thanks,
ns
|
|
|
|
|
I've created ActiveX Document Server and i want to insert my documents to Word documents. So i need to make my toolbar on MS Word to insert my object or to do something else with Word document similar to Adobe PDF toolbar. How can i do this?
|
|
|
|
|
I wonder what is an elegant way to do this? I just need to split everything that's after an optional \r (no matter if there is more text behind it). Thanks!
|
|
|
|
|
<br />
CString string, result;<br />
char* temp;<br />
char* token;<br />
strcpy(temp, string);<br />
token = strtok(temp, "\r");<br />
result = token;<br />
Probably not the most elegant way to do it but it works. Later.
Brad Jennings
|
|
|
|
|
string.TrimRight("\r\n");
|
|
|
|
|
Well. You will have to walk through the CString object and split the sections. Use the Find() and Mid() function for the CString object.
Kuphryn
|
|
|
|
|
isn't Trimright more efficient?
|
|
|
|
|
The Trim() functions are useful, however, they will remove all the ends off. Thus using TrimRight() will work for for the first occurance of "/r/n," but then you will lose all texts after it.
Kuphryn
|
|
|
|
|
exactly what was asked for. also TrimRight will not need to run a copy ctor, it changes length of the CString IMHO.
|
|
|
|
|
I know how to implement a UI handler for a toolbar button in my CView class, e.g.:
//////////////////////////////////////////
void CFooView::OnUpdateToolbarFooUI(CCmdUI* pCmdUI)
{
if (blah-de-blah)
pCmdUI->Enable(TRUE);
else
pCmdUI->Enable(FALSE);
}
/////////////////////////////////////////
Question is, how to do I get the proper toolbar button CCmdUI pointer in calling OnUpdateToolbarFooUI()? Is there a function I can call?
Thanks so much... I've been going nutty over this problem
|
|
|
|
|
I'm kinda a beginner so this might not be right but I think you need to implement a UI update handler for each toolbar button that you want to update. So in your message map you'd have something like:
ON_UPDATE_COMMAND_UI (IDC_TOOBARBUTTON1, OnUpdateToolbarButton1) and you implement it as follows:
void CFooView::OnUpdateToolbarButton1(CCmdUI* pCmdUI)
{
if (blah-de-blah)
pCmdUI->Enable(TRUE);
else
pCmdUI->Enable(FALSE);
} or you can use an ON_UPDATE_COMMAND_UI_RANGE handler if your toolbar buttons are all numbered contiguously. It's form is as follows:
ON_UPDATE_COMMAND_UI_RANCE (idStart, idEnd, OnUpdateToolbarRange) where idStart is the first command ID in the range and idEnd is the last command ID in the range. I think the message handler should be implemented as:
void CFooView::OnUpdateToolbarRange(UINT idToUpdate, CCmdUI* pCmdUI) I'm not sure if the implementation above ^ is the correct way to define the handler so I'd double check the help.
Hope this helps.
- Monrobot13
|
|
|
|
|
I see... thanks for your help.
I actually came across a revelation: my program is actually calling CFooView::OnUpdateToolbarButton1 "automatically" when appropriate-- I don't even need to call the function.
I am guessing this is because whenever this button's state is to be enabled or disabled, I am also concurrently doing an entire window Invalidate(), which is calling the UI function. (Anyone know if this guess is correct?)
Well, problem fixed, in any case. Thanks for your help!
|
|
|
|
|
can i creat a __gc pointer and call its methods in a __nogc callback function?
r00d0034@yahoo.com
|
|
|
|
|
In my app, a dll sends a send/postmessage to the calling app. This is failing for some reason. I am sending a PBM_STEPIT message to a progressbar. What I want to check is to see if a simple sendmessage is also failing or if it works. What kind of message can I send (simplest) to my calling app just to see if sendmessage works?
Thanks,
ns
|
|
|
|
|
Are you catching the message in the calling app using a message handler, event, or switch statement (in the WinProc)?
Jason Henderson start page articles "If you are going through hell, keep going." - Sir Winston Churchill
|
|
|
|
|
I only know how to make a handler in the calling app that gets triggered by the sendmessage. I was hoping to avoid the user defined messages and maybe take advantage of a simpler one I could send to a button or something. I'm trying that now ---A WM_COMMAND.
Thanks,
ns
Well, I tried triggering the buttons handler in the calling app, but that gave me a com error as well (something goes wrong at the sendmessage call in the dll, and a messgaebox immediately after the sendmessage never gets triggered (this is in the dll). THE client manifests this as a com error at the function call:
try
{
CoInitialize(NULL);
_Class1Ptr ptr;
ptr.CreateInstance(__uuidof(Class1));
long lHwnd=(long)m_messagebutton.GetSafeHwnd();
ptr->CheckingPB(&lHwnd);
}
catch(_com_error &e)
{
bstrDesc = e.Description();
}
The dll has:
Public Function CheckingPB(PbarHandle As Long)
result = SendMessage(PbarHandle, WM_COMMAND, 0, 0)
|
|
|
|