|
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
|
|
|
|
|
Dear David
I meant: I have some public variables in CMyView class.These variables must be updated from INSIDE the CMyMainFrame class. How can I get access from CMyMainFrame to public variables in CMyView class?
In fact,how can I update public variables I have in CMyView class from CMyMainFrame class?
Best Regads
|
|
|
|
|
Member 15033704 wrote: How can I get access from CMyMainFrame to public variables in CMyView class? Have you tried calling GetActiveView() ?
"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
|
|
|
|
|
Yes, dear friend
I write the following code inside MyCMainFrame file :
MyCView*pView = static_cast<mycview*> (GetActiveWindow());
then when I include MyCView.h file inside MyCMainFrame file to use GetActiveView(), then I get CDocument ERROR!!!
|
|
|
|
|
Your CMyView object should be a member of the CMainFrame , so you just need to add a public method to CMyView that does what you want.
modified 1-Jan-21 6:55am.
|
|
|
|
|
Dear Friend
I did it,Because it seemed very easy, but then I get CDocument ERROR!
After adding #include "CMyView.h" into CMyMainFrame, I get CDocument ERROR!
I searched a lot on the internet, all say use GetActiveView() but it does not work!
Best Regards
|
|
|
|
|
Sorry, we cannot guess what you are doing. You need to show the code that that you are running, and explain exactly what error(s) you see and where it happens.
|
|
|
|
|
Dear friend
I write the following code inside MyCMainFrame.cpp file :
MyCView*pView = static_cast<mycview*> (GetActiveWindow());
pView->m_CMyView_Pulic_Variable;
To get access to public variables inside CMyview class.
But when I include MyCView.h file inside MyCMainFrame file to use GetActiveView(), then I get CDocument ERROR!
In fact, I just want to change a public variable inside CMyView class from MyCMainFrame.
How can I get access to CMyView class public variables, from MyCMainFrame?
Best Regards
|
|
|
|
|
Why are you using GetActiveWindow rather than GetActiveView ? And what is the exact text of the error you receive and where does it occur?
|
|
|
|
|
Dear Richard
Firstly "HAPPY NEW YEAR"
Many thanks for your help, I was engaged with the CMyDoc error, finally I found it, simply it was redefinition of CMyDoc header in 2 different classes that I never guessed such mistake.
Best Regards
|
|
|
|
|
Glad you found it. Happy New Year (as much as it can be) to you also.
|
|
|
|
|
|
|
Nobita and String | Basics of String Manipulation & Algorithms Practice Problems | HackerEarth[^]
this is the question. my code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
std::string s[t];
for(int i=0;i<=t-1;i++)
{
string st;
getline(cin,st);
int l=(int)st.length();
string s2="",s3="";
for(int i=0;i<=l;i++)
{
if(st[i]==' '||st[i]=='\0')
{
s3=s2+" "+s3;
s2.clear();
}
else
{
s2+=st[i];
}
}
s[i]=s3;
}
for(int i=0;i<=t-1;i++)
cout<<s[i]<<endl;
return 0;
}
the error message is saying " your program doesnt print anything. can anyone help me find whats wrong?
|
|
|
|
|
for(int i=0;i<=l;i++)
Try changing to
for(int i=0;i<l;i++)
You're index is going out of bounds on the st variable 'st[i]', when i is equal to l.
Also, having nested for loops with the same index variable name is tough to read.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
After the following line
cin>>t;
there are still charactes in the input buffer, hence, the next call to getline gets them.
A commont way to deal with this issue is using cin.ignore (see, for instance What is the use of cin.ignore() in C++?[^]).
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Have you tried stepping through the code using a debugger? Doing so will let you know in a hurry what is wrong.
"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
|
|
|
|