|
If it is a normal language array such as char lead[10] , then the compiler does not generate the code to copy for you. If you where expecting dynamic copy and or creation, then you need to use a container class like vector for that.
char a1[10] = {};
char a2[10];
memcpy(a2,a1,10);
Or with vector
std::vector<char> b1;
std::vector<char> b2;
b2 = b1;
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I have created a IP address control dynamically.
How to add a event handler for those controls.
How to use event handlers with dynamically created control.
|
|
|
|
|
Generally, three things to be done;
*) decide which exact command to handle
*) prepare the handler function [whose prtototype is influenced by the cammand to be handled]
*) map the command to the handler
As for ip control, I guess you are trying to handle the IPN_FIELDCHANGED notifycation. So you would have a handler like this;
void CMyDialog::OnFieldChangedIpAddress(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMIPADDRESS pIPAddr = reinterpret_cast<LPNMIPADDRESS>(pNMHDR);
*pResult = 0;
}
And map it to the notifycation inside BEGIN_MESSAGE_MAP/END_MESSAGE_MAP pair like so;
ON_NOTIFY(IPN_FIELDCHANGED, IDC_MYIPADDRESS, OnFieldChangedIpAddress)
--
=====
Arman
|
|
|
|
|
ON_NOTIFY(IPN_FIELDCHANGED, IDC_MYIPADDRESS, OnFieldChangedIpAddress)
I cant use the control id directly because i created control dynamically.
How to add On_notify for dynamically created one
|
|
|
|
|
You can and hou have to. The last parameter of CIPAddressCtrl::Create takes the id of the newly creating control. So define an id inside resource.h file and pass it to the Create method.
PS. To define an id, go to menu option Edit\Resource Synbols... and then choose New... .
--
=====
Arman
|
|
|
|
|
how to use this id to call notify event
|
|
|
|
|
You should not bother about calling notify events. This is done by the system. So your job is to handle the notifyfication only. See my first post; it describes what you need to do.
--
=====
Arman
|
|
|
|
|
prathuraj wrote: I cant use the control id
How do you make IP address control ? CIPAddressCtrl::Create(....,UINT nID); or CIPAddressCtrl::CreateEx(...,UINT nID);
|
|
|
|
|
CIPAddressCtrl* pIPAdd = new CIPAddressCtrl;
pIPAdd->Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER|ES_AUTOHSCROLL,
CRect(x,y,x+sz.cx,y+sz.cy),this,nID);
|
|
|
|
|
You used of nID whats problem?
|
|
|
|
|
how to call on_notify for OnFieldchangedIpaddress1 using this id
|
|
|
|
|
Did you try with Arman Z. Sahakyan's answer anyway see this[^] thread.
|
|
|
|
|
hi, what files should be included?
thanks!
Nathan
|
|
|
|
|
in Visual Studio using unmanaged C++
|
|
|
|
|
What is XMLReader? Are you in search of an XMLReader or is that a specific class you've got picked out and want to use?
MSXML is reasonable if your still looking for a parser to use.
|
|
|
|
|
|
I'm guessing your after the unmanaged C++ version of the .Net XmlReader Class
you might find these of interest,
Microsoft's new XMLLite for C++[^] I havent used this or even taken a proper look but you might find it of interest.
This is an interesting looking project here on CP
FlexibleParser by Michael Chourdakis[^] from the looks of it its his own parser for XML and is platform independent.
Otherwise
MSXML6 Download[^]
cant really say what to include as there are a number of options open for you.
MSXML is nice and easy supports XPath so is very quick, its the one i go for.
documentation has samples in etc.
hope that helps
|
|
|
|
|
Does anyone know how to determine how many units are scrolled in a window derived from CWnd with scrollbars uses for OnVScroll and SB_LINEDOWN/SB_LINEUP.
Specifically, I'm struggling to find how many "units" it moves when the user presses the up/down buttons.
I'm looking for a way to get the value without actually moving the bar.
|
|
|
|
|
bob16972 wrote: how many "units" it moves when the user presses the up/down buttons.
How far it scrolls is up to you. The window will receive the WM_HSCROLL/WM_VSCROLL messages
with the SB_LINEUP/SB_LINEDOWN codes. In response, you can scroll however you need to.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I guess I mucked my question up. I meant to say derived from CScrollView. Right after being created with the wizard the scrolling is handled by something and it scrolls when the up/down buttons are pushed (assuming I set the scroll sizes in OnInitialUpdate to something reasonable)
I apologize for saying CWnd. I posted right before I was leaving work and had my mind in the clouds.
CScrollView is determining how many units to use when scrolling one line and I am in search of how to calculate this or how to obtain what it is using programmatically.
I'm trying to allow the user to continue scrolling like VC++ 6.0 does when at the bottom and the user presses the scroll down button to add more logical space to the view. The transition from CScrollView's automatic handling and my extending it in the OnVScroll method is a bit clunky because I'm not matching the units CScrollView was using on the way down.
I wasn't sure if that value is available and it's right under my nose and I'm failing to see it.
|
|
|
|
|
Found m_lineDev in CScrollView which led me to CScrollView::GetDeviceScrollSizes().
I swear I've looked at this stuff about a half dozen times and it was right under my nose.
Sorry about the post and thanks for the guidance.
|
|
|
|
|
bob16972 wrote: Found m_lineDev in CScrollView which led me to CScrollView::GetDeviceScrollSizes().
Cool!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
More info I didn't link to
About Scroll Bars[^]
Particularly, the "Scroll Box Position and Scrolling Range" and "Scroll Bar Requests"
sections.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
I am writing a C++ program and am trying to send an array of integers to a text file, however, when I open the text file, it looks like this: ⰸⰶⰰⰹⰲⰰⰰⰰⰰⰰⰰⰲⰴⰶ
At an earlier part in the program, I sent an array of integers, but the file came out like I intended it to. I don't know why it doesn't come out correctly for the other piece of code.
This is the code that doesn't work correctly:
ofstream game(name.c_str());<br />
if(game.is_open())<br />
{<br />
for(int i = 0; i < 81; i++)<br />
{<br />
game << g_ivalues[i] << ",";<br />
}<br />
game.close();<br />
} Please note that all the variable listed are declared.
This piece of code does work correctly for me though:
ofstream profiles(name.c_str(), ios::out);<br />
if(profiles.is_open())<br />
{<br />
for(int i = 0; i < 100; i++)<br />
{<br />
profiles << g_ipuzplayed[i] << ",";<br />
}<br />
}<br />
profiles.close(); Any thoughts on why they don't work the same?
Thanks in advance!
Chris
|
|
|
|
|
CS925 wrote: game << g_ivalues[i] << ",";
What is g_ivalues ?
Does the following work?
for(int i = 0; i < 81; i++)
{
cout << g_ivalues[i] << ",";
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|