|
surely i dont wish for someone to write the code for me...........its just that can somebody tell me any functions or classes that might help me............like how to access internet explorer with c++ and how to get access to file menu etc..............not CODE...only some guiging material.................thanks
|
|
|
|
|
Someone please tell me how to use lineMonitorTones(.
I want to detect ringback and dialtone.
Thank you
|
|
|
|
|
Hi,
I want to use the string in switch case statement. Can you please help me.
Thanks
|
|
|
|
|
I can only guess and believe you might want to do something like this:
<br />
switch (myString) {<br />
case "Blue":<br />
...<br />
break;<br />
case "Red":<br />
...<br />
break;<br />
...<br />
}<br />
Trouble is, the C or C++ languages don't do that. C# does. Thus, one solution is to use C#. If you want to use C/C++, you must use nested if/else clauses to emulate the same effect, something like so:
<br />
if (_tcsicmp(myString, _T("blue")) == 0) {<br />
...<br />
} else if (_tcsicmp(myString, _T("red")) == 0) {<br />
...<br />
...<br />
}<br />
Doesn't look as nice, but, compared to the above fictivious switch statement, gives you control over the comparison algorithm (e.g. use _tcsicmp for case-insensitive comparison, or _tcscmp for case-sensitive comparison), etc.
|
|
|
|
|
You cannot use a string in switch cases - the cases have to be constant numberic values.
If the strings are not known at compile time, then you have to use if...else if...else
statements.
If they are known at compile time, then you can precompute hashes of the case strings,
and switch on a hash of the string you want to switch on. Um, that wasn't very clear,
was it?
void DoSomethingDependingOnString (LPCTSTR szSwitchable)
{
switch (ComputeHash(szSwitchable))
{
case 0x4wfe:
DoFirstThing ();
break;
case 0xfg13:
DoSecondThing ();
break;
default:
DoDefaultThing ();
break;
}
}
I hope that was little clearer.
Iain.
|
|
|
|
|
I would recommend not to use the hash approach, for at least these:
i) it is hard to maintain - always think a couple of years and several generations of fellow programmers ahead. Who's going to remember how to create the keys, why and when?
ii) it is doomed to fail - hash keys are not unique, so there is a chance that two different strings produce the same key.
|
|
|
|
|
berndg wrote:
ii) it is doomed to fail - hash keys are not unique, so there is a chance that two different strings produce the same key.
If you have a finite set of possible strings known at the program development time, you can create a "perfect" hash function[^] that doesn't cause collisions.
|
|
|
|
|
|
The actions include save as , print, local copy, copy on the net and so on.
My english is very poor!
|
|
|
|
|
Your English is fine, but your explanation is a bit weak. Exactly what is it that you want to do?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I want to monitor the operations to a file which like save as, print, local copy, network copy, attach to a mail and so on.
Have I explain my request clearly?Please help me,thanks!
|
|
|
|
|
Perhaps you are interested in ReadDirectoryChangesW() or FindFirstChangeNotification() . If not, the items you have mentioned are typically found on the menu of an application. What that application does when a particular menu option is selected is indeterminate. Monitoring that would be a chore at best.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
let me tel u in a simpler way,
my application waits for an event from a server. if the request is timed out, the application should terminate but shldn't freeze waiting for the event from the server.
//i tried to use a worker thread which will monitor the value of the
variable "eventDelay"
//so before requesting the event from the server, i'd do like this
int eventDelay=0;
CWinThread *ct=AfxBeginThread(threadtimeout,this);
getEventFromServer(&....,&....&....);
ct->SuspendThread();
//in the thread,(threadtimeout)
void threadtimeout()
{
do
{
Sleep(1000);
eventDelay++;
if (eventDelay>10)
exit(0);
}while(true);
}
but still the application gets hanged up if the server's not sending the event.. . why..? how to timeout and exit?
regards,
Rookie
|
|
|
|
|
With the information you've provided it seems that you don't need a thread for that. You could use a simple timer (SetTimer) that terminates the app when fires up (OnTimer).
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
can u give me a smal example?
regards,
Rookie
|
|
|
|
|
sorry for the bad naming convention... the function threadtimeout is not to timeout the thread.. its for timing out getEventFromServer() function... please help
regards,
Rookie
|
|
|
|
|
Is it a dialog based application?
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
ya... MFC dialog..
regards,
Rookie
|
|
|
|
|
Whenever you want to start the count in your dialog, insert:
....
SetTimer(0, 1000, NULL); // 2nd param is the miliseconds until WM_TIMER will be sent, in this case: 1 second.
....
When WM_TIMER is received, it fires up the ON_WM_TIMER event (usally mapped as OnTimer): you could use the VStudio Class Wizard - Message Maps Tab to make it easier.
void CYourDlg::OnTimer(UINT nIDEvent)
{
SendMessage(WM_CLOSE); //exit your app
}
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Rookieee wrote:
exit(0);
Remove this. In no way should exit() be used to exit a Windows application, let alone one with multiple threads. See here for the proper way to terminate a thread.
Rookieee wrote:
Sleep(1000);
Why is this here? Using a gratuitous Sleep() like this indicates a bad threading model and adds no value. Reconsider why you think you need it.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
hello all,
i am new to the group.i wanted to know how to parse a xml file using c++ where if the path of the file and the level of the node given that is the level where the element is present.then the parser has to go to the particular element and collect values of sub elements.
thanks
|
|
|
|
|
Visual C++?? You'll need to download MSXML[^]
and read MSXML info[^]
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
MSXML provide ways to navigate through the nodes. Use IXMLDOMDocument, IXMLDOMElement, IXMLDOMNode, IXMLDOMNodeList objects and its methods loadXml, get_documentElement, get_childNodes, get_item, nextNode, ...
So, depending on the integer that you receive you'll know how many iteration you need to do.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
hi, all
a problem trouble me for a long time.
and i have been looking for the answer for a long time.
but i still can't solve it,i hope somebody can give me a
little suggestion. thanks in advance.
my dev platform: MFC 7 & Windows Server 2003
my question:
i want to subclass my checkbox on a dialogbar, and load my bitmap
to the checkbox's face.
all of my checkbox were set to push like style here
owner-draw mode was set to true .
in headfile MyDialogBar.h
====================================================
CBitmapButton m_btnCheck;<br />
BOOL InitButtons();
====================================================
in cppfile MyDialogBar.cpp
====================================================
BOOL CMyDialogBar::InitButtons()<br />
{<br />
<pre> m_btnCheck.SubclassDlgItem(IDC_TOOLBTN_SELECT, this);<br />
m_btnCheck.LoadBitmaps(IDB_BITMAP_ICON_SELECT);</pre><br />
}
====================================================
in headfile MainFrm.h
====================================================
CMyDialogBar m_myDlgbar;
====================================================
in cppfile MainFrm.cpp
====================================================
int CMainFrm::OnCreate(...)<br />
{<br />
<pre> if(!m_myDlgbar.Create(...))<br />
{<br />
TRACE0("sorry >_< ");<br />
return -1;<br />
}; <br />
m_myDlgbar.InitButtons();</pre><br />
}
====================================================
Notes:
IDB_BITMAP_ICON_SELECT is a ID of bitmap resource file created by resource editor , i want this bitmap loaded on the checkbox button.
IDC_TOOLBTN_SELECT is the ID of the CheckBox
the checkbox can works fine, but i just cannot put my bitmap on it. why??
i used to subclass my checkbox and load a bitmap on its face for many times
in common dialog application , there is no problems. why i use it in dialogbar, it doesn't work, and no error occured , the checkbox button works
fine.
i found something seems to be useful on MS KB, i rewrite my code , and it still does not work,
http://support.microsoft.com/kb/185672
anybody here met this problems before?
can you get me out of this swamp ? can anybody post some related sample code or links here ? thank you very much
any suggestion should be appreciated!
sincerely,
nickong
Today is a gift, that's why we call it present
|
|
|
|
|
any help?
Today is a gift, that's why we call it present
|
|
|
|