|
how can i get com port device's ip address.
|
|
|
|
|
hai friends
i have a problem on event handling. i create some buttons at runtime, by using the CButton *pbtn; pbtn->create(caption,WS_CHILD|WS_VISIBLE,CRect(0,23,50,70),this,0x302);
and i am adding the buttons to the windows, but i don't no how to handle the envent of the created buttons... So, if any one have idea, plz help me.
for example , if i click mouse left button on aan indexed button the appropriate event should fire..
thanks in advance .
Surya prakash.
|
|
|
|
|
I think ,you can find answer in your problem,
if you generating button ,you muct have a Unique ID for Each Button.
Let i=1 (Minimun Unique ID) and j = 100 (maximum Unique ID)
then you can use this macro to catch Button Click
ON_CONTROL_RANGE( wNotifyCode, id1, id2, memberFxn )
check for BN_CLICKED message in wNotifyCode
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
I made a program that comes up on the first day of every month to remind me to scan for viruses. I made it in MFC. How would I set the OK button to open my antivirus program? Any help is appreciated.
----------------------------------------
I HATE Resource Compiler Error RC2104!! It won't go away >:@
|
|
|
|
|
There are Many api to accomplish that
- WinExec
- ShellExecute
- CreateProcess
I you Case Most Suited is ShellExecute
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
Try using
ShellExecute(NULL, NULL, [PATH TO THE ANTIVIRUS EXECUTABLE], NULL, NULL, SW_RESTORE);
..RR..
|
|
|
|
|
I tried that and it doesn't do anything. Does the exe have to be in the same directory? Earlier, I almost got it to work yesterday using system(mcagent.exe);. mcagent is the name of the executable. Well, I'll work on that a while, maybe I can get it. HAPPY NEW YEAR!
----------------------------------------
I HATE Resource Compiler Error RC2104!! It won't go away >:@
|
|
|
|
|
|
--------------------------------------------------------------------------------
Now i am using C++ try to create a Thread class, and used by main function.
in the main function i will create 2 threads and 1 critical section and 1 com port handle, i want the 2 threads share the same handle and critical section.
in the construction of thread, i pass the address of handle and critical section in.
In the function of thread i will try to enter the critical section and do something.
But now the condition i met is that neither of the 2 threads can enter the critical section.
If i don't care about the critical section, neither of them can use the send thing to com port handle.
So is there anyone met this condition before? what's the problem?
Thanks a lot for your help in advance...
|
|
|
|
|
(
Who can help me?
#include "stdafx.h"
template<class T>
struct S
{
int qqq;
friend bool operator< (const S<T>&t1,const S<T>&t2);
};
template <class T>
bool operator< (const S<T>&t1,const S<T>&t2)
{
return true;
}
int _tmain(int argc, _TCHAR* argv[])
{
S<int>s;
S<int>s2;
bool uintb = s2<s;
return 0;
}
compler tell me
TestSTL.obj : error LNK2019: 无法解析的外部符号 "bool __cdecl operator<(struct S<int> const &,struct S<int> const &)" (??M@YA_NABU?$S@H@@0@Z) ,该符号在函数 _main 中被引用
Debug/TestSTL.exe : fatal error LNK1120: 1 个无法解析的外部命令
~_~
|
|
|
|
|
|
o sorry ,i am a Chinese,so the words is Chinese.
|
|
|
|
|
im new to c++, currently doing project with vc++ .net is there any tutorials, for beginners on guis' and event driven programming??????
thanks!!!
|
|
|
|
|
Hi,
Why are you guys search outsides? Try to learn from MSDN itself. In MSDN lot of tutorials, articles and other staffs are there.
Regards,
Selvam
|
|
|
|
|
Hi, I have some debugging code, one of these functions writes a message to a file, but i also wan't to know from where the message was sent, so my prototype looks like this:
Debug(const unsigned int Line,const char* File,const char* Function,const char* Message,...);
The problem with this is that it'll need a lot of parameters, Line will always be __LINE__, File will always be __FILE__ and Function will always be __FUNCTION__, so i thought i could just define a macro(#define) which take Message and ..., but the problem is that ... can't be taken as a parameter for a macro and there is no way to send the "..." to the real debug function. So do anyone got any idea how i can do this. I want to call the function something like this:
Debug("Int with the value of 42: %i, and in hex: %x",42,42);
And then in the file it'll look something like this:
...
Car.cpp[Line: 52] (Called from: StartEngine()):
Int with the value of 42: 42, and in hex: 2A
...
|
|
|
|
|
I know I've seen an article on this subject in the Debug section here on CP, but in short you make a class that has an operator() overload which resolves to a call to your Debug() function. Debug() then takes a va_args parameter instead of ... , and uses vsprintf() or FormatV() if you're using CString .
The end result is something like (this is rough and untested, but should be enough to get you started):
#define DEBUGMSG CLogWrapper(__LINE__,__FILE__,__FUNCTION___)
class CLogWrapper
{
public:
CLogWrapper(unsigned uLine, LPCTSTR szFile, LPCTSTR szFunction) :
m_uLine(uLine), m_szFile(szFile), m_szFunction(szFunction)
{ }
void operator()(LPCTSTR szMessage, ...)
{
va_args va;
va_start(va, szMessage)
Debug(m_uLine, m_szFile, m_szFunction, szMessage, va);
va_end(va);
}
protected:
unsigned m_uLine;
LPCTSTR m_szFile, m_szFunction;
}; Then call it like:
int main()
{
DEBUGMSG("Int value: %d", 42);
}
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
|
|
|
|
|
Thanks, will look into that tommorrow if I get some time, but now I'll go to bed(2:50AM here).
|
|
|
|
|
Well, you have asked your question more than 2 years before from today. Hence I believe any solution might be of little use to u now. However, it might be useful for a person just browsing through the discussions(the way I saw your question).
The required info about alterative to ellipses can be found at:
ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_vccrt/html/a700dbbd-bfe5-4077-87b6-3a07af74a907.htm
|
|
|
|
|
Hi, I am having a diffcult time understanding how to print/preview multiple pages. I set up the max number of pages in OnPreparePrinting() and go about print/preview in OnPrint(). However, it always print/preview only the page that is shown in my SDI window.
Does anyone know what I need to do to get the other pages to work? Thanks in advance!
|
|
|
|
|
|
Hi,
I'm interessted in building some docking windows that can contain CView derived classes by myself.
The problem is that I have no clue how to do it.
I've been trying, in vain, to customize a CControlBar...
Any clue or hint would be vaulable!
__________________
"There is an empty room full of people who think you are creative"
|
|
|
|
|
|
Hey all,
I've got to create 5 similar dialogs for a new app I'm writing. All 5 dialogs have the same 3 controls on them (a couple of CStatics and a CEdit control) in addition to a few controls that will be unique for each of the 5 dialogs.
Is there any way to accomplish the following?
- Create a base dialog (CBaseDialog), derive it from CDialog, add those 3 common controls to it.
- Use that new CBaseDialog class as the base class for my 5 similar dialogs so that I don't have to copy/paste the 3 controls onto each of the 5 dialogs?
I'm thinking that since the controls are created from the resource file, I might run into a problem with something like that...
Thanks.
-Mike
-Mike Zinni
"Don't take life too seriously, you'll never make it out alive"
- Van Wilder
|
|
|
|
|
Why not just host a modeless dialog box inside your main CBaseDialog?
<br />
CBaseDialog _base ;<br />
CCustomDialog _custom ;<br />
_base.SetChild( &_custom ) ;<br />
<br />
_base.DoModal() ;<br />
...
<br />
BOOL CBaseDialog::OnInitDialog() <br />
{<br />
BOOL bReturn = TRUE ;<br />
CDialog::OnInitDialog();<br />
m_pDialog->Create( this ) ;
<br />
CRect rFrame ; <br />
CWnd * pFrame = GetDlgItem(IDC_STATIC_FRAME) ; <br />
pFrame->GetWindowRect( rFrame ) ;<br />
ScreenToClient( rFrame ) ;<br />
m_pDialog->MoveWindow(rFrame, FALSE) ;<br />
<br />
return bReturn ;<br />
}<br />
There is more to do such as chaining the child's DoDataExchange() in the CBaseDialog::DoDataExchange() and maintaining the dialog position in OnMouseMove() but that is a fairly trivial.
|
|
|
|
|
Yes, it is possible. Just make sure the common controls all have the same IDs.
http://www.codeproject.com/dialog/dialogsubclass.asp[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|