|
|
Thank you SO much. I REALLY appreciate your reply.
You don't know how much of a weight you lifted off these shoulders.
Thanks,
Lilian
|
|
|
|
|
I'm sure glad this fourm exists..
Im trying to parse a string for "11" and put the value into a int.. here what I have so far..
CString strPDT;
strPDT = "<p>At the tone, the time will be... < b>Wednesday, Jul 11, 2001 07:57:09 PDT< /b>";
int nIndex, nFirstIndex, nSecondIndex;
nIndex = strPDT.Find(_T("tone"));
nFirstIndex = strPDT.Find("< b>", nMyIndex);
nSecondIndex = strPDT.Find(",", nFirstIndex+1);
strPDTDays = strPDT.Mid(nFirstIndex+1, nSecondIndex-FirstIndexPDT-1);
int iPDTDays = atoi(strPDTDays);
int iPDTD = iPDTDays;
I know this code isn't correct but it gives you a idea of what I'm trying to do... can someone post some code that would find "11".
Thanks again,
Rob Jones
|
|
|
|
|
For Claryfy.
You need to get the day number in the string: At the tone....?
The string has the same structure?
For example: At the tone, the time will be... + date + time
Carlos Antollini.
|
|
|
|
|
Yes I need to pull "11" from the string and at the tone.. will always stay the same.. sorry about the terrible looking post, that string that I posted has html values in it and when posted the forum didnt display the html it used the html and made the post bold.. I'll try to fix how it looks. (I Fixed how it looks)
thanks
|
|
|
|
|
Do you like this?
strPdt = "At the tone, the time will be... < b>Wednesday, Jul 11, 2001 07:57:09 PDT< /b>";
CString strTemp = strPdt.Mid(strlen("At the tone, the time will be... < b>"))
//Now you have the date and time in strTemp.
int nfirst = strTemp.Find(",");
int nSecond = strTemp.Find(",", nFirst + 1);
int iPDTDays = atoi(strTemp.Mid(nSecond - 2, 2)); //if the number is < 10 you will have " 9".
Note. I wrote the code here, check if all is OK.
Good Luck
Carlos Antollini.
|
|
|
|
|
THANKS! works great
|
|
|
|
|
You're probably already using the strtok solution that Carlos gave you, but I submitted an article here that deals specifically with parsing strings. You may want to check it out.
http://www.codetools.com/useritems/cstringparser.asp
|
|
|
|
|
I am trying to create a Hyper object which has several Hyper objects as members. I then want to add the container object to the view and have all the contained objects added automatically. I want to be able to move the contained objects in unison with the main object. I don't know if this is possible but I would prefer using this method as opposed to using groups. If what I want is not possible, is there a way to access properties of individual objects by right-clicking on the object without ungrouping the group?
|
|
|
|
|
I have just upgraded my operating system to Windows 2000 and when I try to compile any programs that compiled and ran before I get a compile error 1001. I have even created a new empty program and this doesn't even compile. Obviously I need to change some sort of settings to make it compatible because these programs work on my colleague's version of 2000 so its just my machine.
Thanks for any help
Nick
|
|
|
|
|
Hi all,
In MFC, ON_MESSAGE() macro can be used to map userdefined messages. In ATL, what is the alternative macro for handling user defined messages?
Regards,
Rejeesh
|
|
|
|
|
MESSAGE_HANDLER(WM_MYMESSAGE, OnMyMessage )
and the function prototype is
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
|
MESSAGE_HANDLER(WM_MYMESSAGE, OnMyMessage )
and the function prototype is
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
|
MESSAGE_HANDLER(WM_MYMESSAGE, OnMyMessage )
and the function prototype is
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
|
|
Hi All,
My problem is about casting between these types.
the scenario is below.
getdocument -> getactiveelement ->
"it's a frame" I need a way of casting this IHTMLElement to IHTMLElement2 or to IHTMLWindow2
/*
IHTMLElement* pa_el;
...get_activeelement(&pa_el);
CComQIPtr<ihtmlelement2,&iid_ihtmlelement2> pa_el2(pa_el);
I have a dispatch here in pa_el2 but it seems as something is wrong because when I call doScroll, I get errors... if I cast to IHTMLWindow2... it simply returns NULL... (myframe == null)
CComQIPtr<ihtmlwindow2,&iid_ihtmlwindow2> myframe(pa_el);
How can I access to a frame object if I have it as an IHTMLElement?
Please Help...
|
|
|
|
|
If you need IHTMLElement2 just ask for it. IHTMLElment2 inherits from IHTMLElement
IHTMLElement2* pElement;
get_ActiveElement(&pElement);
|
|
|
|
|
I tried it already... but I get this error...
error C2664: 'get_activeElement' : cannot convert parameter 1 from 'struct IHTMLElement2 ** ' to 'struct IHTMLElement ** '
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
|
|
|
|
|
Gurus
I have been trying unsuccessfully to use CFileFind to search a directory for files, I have successfully used this in the past but currently have hit the proverbial brick wall. The following code
CFileFind find;
find.FindFile(m_strDir);
while (find.FindNextFile())
{
if (!find.IsDots() &&
!find.IsDirectory())
{
CString strMsg = find.GetFilePath();
strMsg += " found.";
AfxMessageBox(strMsg, MB_OK | MB_APPLMODAL | MB_ICONSTOP);
}
}
find.Close();
should return all files that aren't current directory (.), parent directory (..) or a directory. All I get returned is . and ..
Any idea what I have screwed up?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
you need to call FindFile() first before you call FindNextFile()
i.e)
if ( ff.FindFile() )
{
while(ff.FindNextFile() )
{
do something
}
do something
this handles the last
file found case
}
|
|
|
|
|
If you have a look at the second line of code you will see that I have called FindFile(), I just didn't rap it up with an if statement.
Anyone else got any suggestions?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
From MSDN Library:
Return Value
Nonzero if there are more files; zero if this is the last file,
and the previous call to either FindFile or FindNextFile returned nonzero.
Not if no file was available
|
|
|
|
|
Hello,
I created (_mkdir) a directory from application 1.
When I try to remove it (_rmdir) from application 2, I have an error (EACCES).
I only can remove it from process 2 after process 1 is closed.
I guess process 1 is holding a reference on the opened directories.
Is there any mean to "free" all references to directories from one application ?
Thanks in advance.
PS: 1- The directory I am trying to delete is empty and the current directory is
the parent directory.
2 - I tried _rmdir, DeleteDirectory, ShFileOperation
Where there is a WISH, there is a WILL.
|
|
|
|
|
My application consists of two components: front end gui-manager and the server.
I have a bug that causes the server to crash very infrequently every other day.
Naturally I would like to find the bug, but as interim solution I want to restart the
server when it crashes. The code to do this is simple but unfortunately every time
the server crashes I get the modal pop up boxes so until a user clicks ok on the box
the gui doesn't get a "server exited" event and therefore can't restart the server.
Is there any way to disable this modal box for the specific application? Or may be there
is another way around?
Thanks,
Gregory.
|
|
|
|
|
I want to restart the server when it crashes.
If your server is a service running on W2K, you have the config option doing exactly that. You can also use SetUnhandledExceptionFilter function to disable msgbox.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|