|
Litu Sahoo wrote: Thank you for the reply, but the code is crashing in the below line.
David Crow wrote: items = serial_items.get_child("Items");
Did you debug your code? What is the value of
serial_items
before the "crash"?
|
|
|
|
|
hi
m_data is showing blank and m_children is showing an address.
|
|
|
|
|
Hi
I modified the program but still not able to get the whole array of data Under Items. Below is the sample code. Please let me know where it is wrong.
namespace pt=boost::property_tree;
pt::ptree root;
pt::ptree items;
pt::ptree obsrvtns;
pt::ptree obsrvtns1;
pt::read_json(filepath,root);
obsrvtns=root.get_child("Header");
cout<<"Header size is "<<obsrvtns.size()<<"\n";
for="" (boost::property_tree::ptree::iterator="" itprop="obsrvtns.begin();" !="obsrvtns.end();" ++itprop)
="" {
="" cout<<itprop-="">first<<": "<<itprop->second.get_value<string>()<<"\n";
}
items=root.get_child("Serial");
cout<<"Series Size is "<<items.size()<<"\n";
for(boost::property_tree::ptree::iterator="" it="items.begin();it!=items.end();++it)
" {
="" cout<<"second="" size="" is="" "<<it-="">second.size()<<"\n";
for(boost::property_tree::ptree::iterator it1=it->second.begin();it1!=it->second.end();++it1)
{
cout<<it1->first<<": "<<it1->second.get_value<string>()<<"\n";
if(it1->first=="Item")
{
/*obsrvtns1=it1->second.get_child("Items");
cout<<"check \n";*/
//BOOST_FOREACH(boost::property_tree::ptree::value_type &v,root.get_child("Header.Serial.Item"))
BOOST_FOREACH(boost::property_tree::ptree::value_type &v,root.get_child("Item"))
{
cout<
|
|
|
|
|
Can someone help to give some tips? Why I compiled the program without error, yet it cannot open the notepad to see my text file : testedit.txt in the file folder c:\AHome. Thanks.
#include <stdio.h>
#include <stdlib.h>
void main()
{
system("cd C:\\Windows\\System32\notepad.exe c:\\AHome\testedit.txt ");
return 0;
}
|
|
|
|
|
Try:
system("C:\\Windows\\System32\\notepad.exe c:\\AHome\\testedit.txt ");
Mircea
|
|
|
|
|
Thanks for your reply ...
I have try ...
system("C:\\Windows\\System32\notepad.exe c:\\AHome\testedit.text ");
The error massage is :
'C:\Windows\System32' is not recognized as Internal or External Command, Operable Program or Batch file.
|
|
|
|
|
You missed a backslash just before notepad.exe. You don't even really need the entire path to Notepad.
This will work just fine:
system("notepad C:\\AHome\\testedit.text");
|
|
|
|
|
Make sure you're not doing that from an elevated process.
It's not quite DLL hijacking, but if an attacker could write a rogue notepad.exe into the %PATH% somewhere, they could then get your process to launch it with elevated privileges.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
True
|
|
|
|
|
Could you help me to understand what do you mean by " elevated process "?
|
|
|
|
|
|
Goh Kak Ng wrote: system("C:\Windows\System32\notepad.exe c:\AHome\testedit.text ");
You missed one backslash in the path. It must be:
system("C:\\Windows\\System32\\notepad.exe c:\\AHome\\testedit.text ");
|
|
|
|
|
Yes. You are right!
Try this work ...
system("C:\\Windows\\System32\\notepad.exe c:\\AHome\\testedit ");
Note that the test file name must be " testedit " and not " testedit.txt ". Otherwise, this file will not be found.
Thanks!
|
|
|
|
|
Goh Kak Ng wrote: ...yet it cannot open the notepad to see my text file : Aside from a few missing backslashes in the string literal, what's the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
He also seems to have a spurious "cd..." at the start of his string. I'd guess that's what's causing his grief but my crystal ball is foggy
Mircea
|
|
|
|
|
Thanks for your reply ...
cd is " change of directory " to C:\Windows\System32 where notepad.exe is located.
|
|
|
|
|
Quote: cd is " change of directory "
I know, and it shouldn't be there.
Mircea
|
|
|
|
|
Yes. you are right. cd should not be there.
This is the right one ...
system("C:\\Windows\\System32\\notepad.exe c:\\A Home\\testedit ");
Thanks.
|
|
|
|
|
Hi all,
I have the following code which works for zooming in and out
BOOL CChildView::OnMouseWheel(UINT nFlags, short zDelta, CPoint point)
{
if (theApp.pBitmap)
{
//Caution! point is in screen coordinate!
CPoint pClient = point;
ScreenToClient(&pClient);
if (crDest.PtInRect(pClient))
{
m_bMouseWheel = TRUE;
if (zDelta == 120)
{
OnZoomPlus(pClient);
}
else if (zDelta == -120)
{
OnZoomMinus(pClient);
}
m_bMouseWheel = FALSE;
}
else
PlaySound(MAKEINTRESOURCE(IDR_WAV_SPRING), GetModuleHandle(NULL), SND_RESOURCE);
}
return TRUE;
}
Normally in SetCursor, the BOOL m_bMouseWheel would change the cursor
BOOL CChildView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (m_bMouseDown || m_bMouseWheel)//Todo::Doesnot work for m_bMouseWheel
{
::SetCursor(LoadCursor(NULL, IDC_SIZEALL));
return TRUE;
}
if (theApp.m_hLenseCursor && theApp.bTrackLenseMode)
{
::SetCursor(theApp.m_hLenseCursor);
return TRUE;
}
else
{
::SetCursor(::LoadCursor(NULL, IDC_ARROW));
}
return CWnd::OnSetCursor(pWnd, nHitTest, message);
}
but actually nothing happens.
Any suggestion?
Pierre
|
|
|
|
|
Member 13251588 wrote: Any suggestion? Use the debugger to step through the code and see what is actually happening, especially when the code enters one of the zoom functions.
|
|
|
|
|
Under debugger m_bMouseWheel (which is global to the class) is always true.
The problem is maybe that OnSetCursor is not triggered during that time (one mousewheel).
The doc say that "The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window" which is not the case when mousewheeling.
So I am thinking on SendMessage(WM_SETCURSOR, some "params") before entering Zoom function.
But actually I do not know what to use as "params".
Is it a good track?
Pierre
|
|
|
|
|
Sorry, I am not sure what that has to do with your original question. If you want to zoom an image based on the mouse wheel then you just need to capture the mouse movement and call your zoom function with suitable parameter values.
|
|
|
|
|
Actually SendMessage(WM_SETCURSOR, 0, 0 or use default) before zooming does the trick.
|
|
|
|
|
Hi Everybody
I have a SDI project. I have created some dynamics ComboBoxes in my toolbar by ".Create" in my CMainFrame Class. My ComboBoxes are working properly in CMainFrame but I want to set some of my variables in CMyView class by void CMainFrame::OnSelchange_My_Dynamics_Combo_1(). I did my best but I was not successful to send/set data to/at CMyView class.
I am beginner in MFC, Please guide me.
Best Regards
|
|
|
|
|
Member 15033704 wrote: ...I was not successful to send/set data to/at CMyView class. What exactly is this supposed to mean?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|