|
can body tell the simple code for executing a process in vc++?
r00d0034@yahoo.com
|
|
|
|
|
|
Hello,
You now that we can register a tool with a ToolTip control by using TTM_ADDTOOL.
Now how can we remove the registered tooltips?
I know about using TTM_DELTOOL but I'm looking for another ways.
Thank you in advance.
BOOL CMyToolTip::AddRectTool(CWnd *pWnd,LPCTSTR pszText,LPCRECT pRect,UINT nIDTool)<br />
{<br />
TOOLINFO ti;<br />
ti.cbSize = sizeof (TOOLINFO);<br />
ti.uFlags = TTF_SUBCLASS;<br />
ti.hwnd = pWnd->GetSafeHwnd();<br />
ti.uId = nIDTool;<br />
ti.hinst = AfxGetInstanceHandle();<br />
ti.lpszText = (LPTSTR) pszText;<br />
::CopyRect (&ti.rect, pRect);<br />
<br />
return (BOOL)SendMessage(TTM_ADDTOOL, 0, (LPARAM) &ti);<br />
}
|
|
|
|
|
how to i make an ocx it plays a swf file using flash player ocx?
Thanks.
|
|
|
|
|
the following situation:
In Win CE.
Dialog based App.
Dialog resource has 1 control, a Tab Control
when selecting a tab-page all controls for that page are created dynamically (parent = tabcntrl).
So the message handling functions for the controls and the corresponding code in messagemap are added manually. the ID's are matching. The code syntax seems to be correct.
problem:
The control are showed but the message handlers aren't called.
Did I forget something ?
|
|
|
|
|
how can one prevent a visual c++ programm from being run more than once on same PC
|
|
|
|
|
There are a number of ways to do this, a named mutex is the most common. The name for this is a singleton, if you search this site or google for the word 'singleton' I reckon you'll find heaps of examples.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
|
Can someone tell me why I can't edit my message? I'm logged in, but the board wants a password in order to delete/modify the message. However, it says that the password is incorrect, and it doesn't get sent by mail if I click on "I forgot my password"
Help
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have developed a MFC application for some equipment. The interface between my application and equipment is through serial COM port. Now problem is like this, whenever I starts the application and one dialog box appears to choose the COM port(there are two ports in one PC). If I clicks on the caption bar of that dialog box by mouse, than it displays a message box showing illegal operation and I have to close the application. Suggest me what can be the problem with my application ?
Otherwise my application is working fine.
Thanks.
Arun
|
|
|
|
|
Build a debug version, enter the debugger when it crashes, and you'll see where the problem is.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I am running the debug version already......
But there is no Retry or Debug button onth illigal message box.
|
|
|
|
|
Show us the source code of the dialog where you choose the serial port ...
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Although this problem is not consistent.
the cpp file is :
// ProtComPortDlg.cpp : implementation file
//
#include "stdafx.h"
#include "FasGui.h"
#include "ProtComPortDlg.h"
#include "MainFrm.h"
#include "Music.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
bool CProtComPortDlg::bFasBmpFlag;
/////////////////////////////////////////////////////////////////////////////
// CProtComPortDlg dialog
CProtComPortDlg::CProtComPortDlg(CWnd* pParent /*=NULL*/)
: CDialog(CProtComPortDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CProtComPortDlg)
m_nComPort1 = 1;
m_strPortSystemName = _T("Fas");
//}}AFX_DATA_INIT
}
void CProtComPortDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProtComPortDlg)
DDX_Radio(pDX, IDC_PORTCOM1, m_nComPort1);
DDX_Text(pDX, IDC_PORTSYSTEMNAME, m_strPortSystemName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CProtComPortDlg, CDialog)
//{{AFX_MSG_MAP(CProtComPortDlg)
ON_WM_SETCURSOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProtComPortDlg message handlers
BOOL CProtComPortDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetIcon(AfxGetApp()->LoadIcon(IDR_MAIN),FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CProtComPortDlg::OnCancel()
{
// TODO: Add extra cleanup here
CMusic MusicObj;
strSong = "Utopia.wav";
MusicObj.PlayMusic();
if(AfxMessageBox("This will terminate the application\nContinue with termination...",MB_YESNO|MB_ICONQUESTION) == IDYES)
{
PostQuitMessage(NULL);
}
//CDialog::OnCancel();
}
BOOL CProtComPortDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
::SetCursor(::LoadCursor(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDC_CDOT)));
return TRUE;
// return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
I am calling the DoModal() of this class in MainFrm.cpp as:
if(ProtComPortDlgObj.DoModal()==IDOK)
{
//some processing
}
bye
|
|
|
|
|
Maybe the line ::SetCursor(::LoadCursor(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDC_CDOT))); in the function BOOL CProtComPortDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) function produce the error ?!?!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
I have a moduless dialog which has WS_CHILD property in a dll and used as an child in a view. when the dialog has focus ,it look the accelerator key massage as a dialog message and does not pass to it's parent(the view),while my purpose is that it should route the msg to the view and the dispatch to any it's child.Please tell me how to achieve this.
some presetive code goes:
In the view class:
<br />
BOOL CTestAccelView::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if(TranslateAccelerator(m_hWnd,m_hAccelTest,pMsg))<br />
return TRUE;<br />
if(m_pTestDlgWnd && m_pTestDlgWnd->GetSafeHwnd() )<br />
if(m_pTestDlgWnd->PreTranslateMessage(pMsg))<br />
return TRUE;<br />
if(m_pTestDlgWnd2 && m_pTestDlgWnd2->GetSafeHwnd())<br />
if(m_pTestDlgWnd2->PreTranslateMessage(pMsg))<br />
return TRUE;<br />
return CView::PreTranslateMessage(pMsg);<br />
}<br />
In the Dialog class:
<br />
BOOL CTestDlg::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if(TranslateAccelerator(m_hWnd,m_hAccelTest,pMsg))<br />
{<br />
return TRUE;<br />
}<br />
if(IsDialogMessage(pMsg))<br />
{<br />
return TRUE;<br />
}<br />
return CWnd::PreTranslateMessage(pMsg);<br />
}<br />
Scratch
|
|
|
|
|
hello @all,
i posted this message yesterday in this forum and i got much assistance, however give it another and easier way, without THEADS.!!
i have a dialogbased program.
there a two buttons (eg. button1 and button2).
if i press button1 first i get a new dialog (ID_DIALOG_COMBO) with a combobox (m_ctrlComboBox ).
if i press the button2 a CString (CString mystring ) should be enterd into the combobox from the ID_DIALOG_COMBO.
how can i do this????
thank you very much
this is only an example, to explain the real background would be take to much time
sunny
|
|
|
|
|
The dialog needs to be modeless, end of story. Someone said that to you yesterday and it's all you need. Once you have a modeless dialog, then you can still press the second button while the dialog is up, and you can create a method on the modeless dialog which takes your string and enters it into your combo box. Call that method when button two is pressed, and you're done.
People suggested you need *threads* to do this ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
thanks for reply.
Christian Graus wrote:
The dialog needs to be modeless
i have modeless dialogs!!!
Christian Graus wrote:
you can create a method on the modeless dialog which takes your string and enters it into your combo box
that is, what i mean! how can i do this? how should the method look like?
thanks
sunny
|
|
|
|
|
public:
void PassText(CString s);
void MyModelessDialog::PassText(CString s)
{
MyComboBox.SetWindowText(s);
}
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
i´m sorry, i do not understand this code example! can i use it in mfc???
thank you very much
sunny
|
|
|
|
|
I'm sorry, but I think you probably need to go back to C++ without MFC, or Windows of any kind, if you do not understand this. That is a friendly suggestion, not an insult.
To put text into the edit area of a combobox, you call it's SetWindowText method. That is an MFC method, and it requires that you've created a variable of type CComboBox in your modeless dialog box. The rest of the function is basic C++, I showed the declaration ( the bit in the .h file ) to show it needs to not be private ( that is not actually true, but it's the simplest way ), and the definition, where all we do is take the string and shove it into the combo box. You then call that method on the combo box in the method the class wizard defines for you for when you push button 2.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
I'm sorry, but I think you probably need to go back to C++ without MFC, or Windows of any kind, if you do not understand this. That is a friendly suggestion, not an insult.
that or i should go to bed earlier. i believes my brain is still sleeping.
first, i will try to go to bed more earlier. ;);)
thanks for your reply! i think your idea is perfekt and i will try it.
sunny
|
|
|
|
|
Sunnygirl wrote:
that or i should go to bed earlier.
Well, that is always an option, I have days like that myself.
Sunnygirl wrote:
i think your idea is perfekt and i will try it.
Good luck - if you get stuck, just ask some more.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
hi all
can i know how do i set the date of my programme so that it can take the date directly from the computer without we ned to set everytime we use the programme.Do i need to ue timer to do that.
pls reply asap
Thank alot!!!!!
diana
|
|
|
|