|
So do you have code someplace that it interacting with the clipboard?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Probably. Not my code. Inherited. I try to find a repro before digging through code. I've googled all sorts of keywords and only found one non-english site with the same error message. Now here I am hoping someone who actually has written code for the clipboard knows what this means. I could try looking through code but I don't know what I'm looking for.
- Harrier
|
|
|
|
|
Here's the code I added to my CDialog
public:
virtual void OnInitialUpdate();
and
void CTargetInfo::OnInitialUpdate()
{
if(NULL != m_listTgtInfo.GetSafeHwnd())
{
(void)m_listTgtInfo.SetExtendedStyle( LVS_EX_FULLROWSELECT );
m_listTgtInfo.InsertColumn(0,"Keywords",LVCFMT_LEFT,800);
m_listTgtInfo.SetExtendedStyle(LVS_EX_CHECKBOXES);
m_listTgtInfo.InsertColumn(1,"Options",LVCFMT_LEFT,800);
}
}
It nevers enters the OnInitialUpdate
The way I am creating the dialog is
m_tgtInfo = new CTargetInfo(this);
if(!m_tgtInfo) return CDialog::OnCommand(wp, lp);
m_tgtInfo->Create(IDD_DLGTGTINFO, (CWnd*)this);
m_tgtInfo->ShowWindow(SW_SHOW);
Is there something else I need to do?
thanks,
sb
|
|
|
|
|
OnInitialUpdate() is for a view, not a dialog. Override OnInitDialog() instead.
ns wrote: The way I am creating the dialog is
m_tgtInfo = new CTargetInfo(this);
if(!m_tgtInfo) return CDialog::OnCommand(wp, lp);
m_tgtInfo->Create(IDD_DLGTGTINFO, (CWnd*)this);
m_tgtInfo->ShowWindow(SW_SHOW);
Why not create a modal dialog instead:
CTargetInfo dlg;
dlg.DoModal();
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks, David.
It needs to be modeless. Now that I made it OnINitDialog, it does go into the function but sidesteps my if safeHWnd block for the list control on that dialog:
if(NULL != m_listTgtInfo.GetSafeHwnd())
{
(void)m_listTgtInfo.SetExtendedStyle( LVS_EX_FULLROWSELECT );
m_listTgtInfo.InsertColumn(0,"Keywords",LVCFMT_LEFT,800);
m_listTgtInfo.SetExtendedStyle(LVS_EX_CHECKBOXES);
m_listTgtInfo.InsertColumn(1,"Options",LVCFMT_LEFT,800);
}
I thought my CListCtrl would have been made by the time the code gets to the OnINitDialog. So if I cant set the columns of the listbox in this function, where else can I set them?
thanks,
sb
|
|
|
|
|
ns wrote: I thought my CListCtrl would have been made by the time the code gets to the OnINitDialog.
The controls have been created, assuming you have bothered to call CDialog::OnInitDialog() first.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I hadn't bothered to call OnInitDialog first.
I did MFC a long time ago then have been with QT for ages, so I am remembering only bits and pieces. I'l try to look around a little more before I post. I've forgotten where the best places are to go look for information.
Thanks again David,
hopefully I ask better questions in the next few days
|
|
|
|
|
I would like to have access to all the pins on a serial port.
If i can get a handle to a COM port using CreateFile, does the interface allow me individual control over the 9 pins? So in other words the 9 signals some of which are DSR, RTS and DTR, can i toggle those through some class?
Thanks,
|
|
|
|
|
LCI wrote: I would like to have access to all the pins on a serial port
This is not possible given that you don't have a driver that supports it.
The standard windows driver for serial devices does not support it.
What do you really mean by "access to all pins"? Do you really need access to all of them, or is it just a few?
Some of the pins are possible to control such as DTR and RTS by the use of ::SetCommState() and the DCB struct.
Do you intend to send serial data at all or do you wish to use the serial port in a way that it's not primarily designed for?
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
I just need to be able to control the RTS, DSR and DTR bits
|
|
|
|
|
The RTS and DTR signals can be controlled manually by using ::SetCommState()[^]and DCB struct[^].
The DSR signal is an hardware monitored input signal that is used for flow control and if found inactive, the data transmission will be suspended. Hence you can neither monitor nor change its state, only inform the hardware that it should be used for flow control or not.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Great thanks... i just have one question on the flow here.
I can use CreateFile to obtain a handle to the port.
Then i can call SetCommState with the handle.. however, the other parameter is a DCB pointer which i will popluate the DSR, RTS and DTR settings how i need to..
Is there anything else i would need to do...
See i am trying to listen on the DSR for a signal to trigger off of that signal,
Then i would like to send signals on RTS and DTR
|
|
|
|
|
LCI wrote: i am trying to listen on the DSR for a signal
I suggest you set up the DCB struct for the port to make use of the DSR signal, i.e. the port suspends data transfer until the DSR line assumes active state.
Use ::WaitCommEvent() to wait for a change on the DSR line and call ::ClearCommError() to verify the state of the DSR line.
Afterwards you can use ::SetCommState() to manipulate the RTS and DTR lines.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
|
I launch a cDialog class window from my other CDilaog class.When it is closed by the user I want the parent to set its pointer to zero. How do I do this?
Also do I need to delete the pointer since I am creating with a'new' in the parent?
thanks,
sb
|
|
|
|
|
ns wrote: How do I do this?
You do it in the OnDestroy() function overriding WM_DESTROY from the CDialog class, setting the pointer to 0 with
GetParent()->m_pOnDialog = NULL;
ns wrote: Also do I need to delete the pointer since I am creating with a'new' in the parent?
You can do a
delete this; directly in the OnDestroy() function of the CDialog (which will kill itself, no need to hankde it in the parent window).
~RaGE();
|
|
|
|
|
ns wrote: I launch a cDialog...
Is it a modal or modeless dialog?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
Ok, so then why are you wanting/needing to assign NULL to the dialog pointer?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I have code like
if(!m_tgtInfo)
{
m_tgtInfo = new CTargetInfo(this);
if(!m_tgtInfo) return CDialog::OnCommand(wp, lp);
m_tgtInfo->Create(IDD_DLGTGTINFO, (CWnd*)this);
m_tgtInfo->ShowWindow(SW_SHOW);
}
so if someone does away with the m_tgtInfo window then the next time I enter this function, I want to pop up a new CTargetInfo window. If m_tgtInfo is not set to null by somebody I'll never enter the block to create a new window.
Hope this makes sense.
APpreciate your input!
sb
|
|
|
|
|
In the modeless dialog's PostNcDestroy() method, right before deleting the this pointer, send the parent a UDM indicating that the dialog is just about to be destroyed. In the parent's handler for the UDM, assign NULL to m_tgtInfo .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
Hi,
I am having this run time error message.
Run-Time Check Failure #2 - Stack around the variable 'buffer' was corrupted.
It makes sense for me, but
Anybody could give me some detail ideas about this error message?
Thanks!
Yonggoo
|
|
|
|
|
Yonggoo wrote: It makes sense for me, but
Anybody could give me some detail ideas about this error message?
If it makes sense for you, what further explanation do you require?
See here for possibilities.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
See where?
I am not the person that asked this question, but I have done many searches. I find a few questions in other sites and many in this site about this specific error message, but there is nothing that provides a diagnostic solution. In other words, nowhere is there something explaining how to diagnose this problem. It is easy to say to search for answers and I have provided that answer to to others many times before in other forums. Yet in this situation, the answer is not easy to obtain by simply searching. So did you look to see if your answer is any help? I think not. I think you were stuck in the mode of saying to search, but you don't really know the answer and did not look to see if searching has any value for this problem.
|
|
|
|