|
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)
|
|
|
|
|
ns wrote:
SendMessage(PbarHandle, WM_COMMAND, 0, 0)
The 3rd arg to SendMessage is the wParam (i.e. the command id). You probably don't want to it to be zero.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have to use the SendMessage API in the VB dll, which takes the handle of the receiving window. Are you perhaps talking about the CWnd::SendMessage?
|
|
|
|
|
ns wrote:
Are you perhaps talking about the CWnd::SendMessage?
Yes. Are you saying that the SendMessage args following WM_COMMAND are different between MFC and VB?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
SendMessage, the raw API is not the same as CWnd::SendMessage in terms of argument lists.
Thanks,
ns
|
|
|
|