|
It can be more than a problem, but i guess it has to do with your MAPMODE and ScrollPosition in every moment.
Lets say... you make a line with a click in X=5, Y=5 to X=50, Y = 50. If you scroll the window but you are not taking in consideration the scroll position, the line will just stay in the same relative place without scrolling, but the real coordinates will be i.e. (5,25) and (50, 70) because the top-left corner of your view has another value after scrolling. This is because you are not using the GetScrollPosition to translate the coordinates of the points when you do the mouseclick or the OnDraw.
Other possibility is you make the line down in the window and when you try to scroll down the view... the line should go up, but it really goes down disappearing from the scope. This is because you are not matching the MAPMODE with the addition/substraction of the Scroll Position when drwaing the View.
And the third possibility, you make the start clik in (5,5), then you go to the scrollbar and take the window down, after scrolling you release the click in the window, but the line doesn't appear as it should. The problem here s just a mix of both upper cases.
Post some relevant code, as where you use SetScrollSize (to see MAPMODE), the OnMouseClick (to take the coordinates of the line) and your some lines of your OnDraw (where you try to make the line)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi all,
I have create database connection in my application and use it in several locations. That mean I'm using more that one tables with same connection. What I have done is execute separate queries with same connection.
But now I have a question. One of my table have large number of columns. So i write separate query as follows, actually a database function.
<br />
public bool DataToDB(int GroupID, int SessionID, int PartID, int DestinationList, int MemberID, int DataMessage, int ServiceID, int ActivityID, int Bio_Size, image Bio_Data)<br />
{<br />
<br />
string sqlCommand =<br />
"INSERT INTO RecordData (GroupId, SessionID, PartID, DestinationList, MemberID, DataMessage, ServiceID, ActivityID, Bio_Size, Bio_Data) <br />
VALUES (@GroupId, @SessionID, @PartID, @DestinationList, @MemberID, @DataMessage, @ServiceID, @ActivityID, @Bio_Size, @Bio_Data)";<br />
Database db = DatabaseFactory.CreateDatabase();<br />
db.AddInParameter(dbCommand, "GroupId", DbType.Int32, GroupId);<br />
db.AddInParameter(dbCommand, "SessionID", DbType.Int32, SessionID);<br />
db.AddInParameter(dbCommand, "PartID", DbType.Int32, PartID);<br />
db.AddInParameter(dbCommand, "DestinationList", DbType.Int32, DestinationList);<br />
db.AddInParameter(dbCommand, "MemberID", DbType.Int32, MemberID);<br />
db.AddInParameter(dbCommand, "DataMessage", DbType.Int32, DataMessage);<br />
db.AddInParameter(dbCommand, "ServiceID", DbType.Int32, ServiceID);<br />
db.AddInParameter(dbCommand, "ActivityID", DbType.Int32, ActivityID);<br />
db.AddInParameter(dbCommand, "Bio_Size", DbType.Int32, Bio_Size);<br />
db.AddInParameter(dbCommand, "Bio_Data", DbType.image, Bio_Data);<br />
db.ExecuteNonQuery(dbCommand);<br />
<br />
}<br />
If you want I'll put my code/function related to this function on another post. My question is that how to use this on my C++ application. Any easy way to do it.
|
|
|
|
|
Your question is an easy way to do query, isn't it?
If yes, I think you can use, a class of ADO database set. There is a few class that provide it, in codeproject. By using this class you can used "Con.execute" like in VB.
|
|
|
|
|
How about the use of Post Procedure, I can define the command object and execute the post proc in C++.
I appreciate your help all the time...
Eranga
|
|
|
|
|
If what do u mean is store proc, the answer :
Sure, u will be able to execute any query.
|
|
|
|
|
I want to access fat table( where my partition information is store) how can i access it through codding.
|
|
|
|
|
This is my there msg that i am posting.
Please give me a hint how to access my fat table
Any link will be appreciated.
Thanks
|
|
|
|
|
It's only been two hours on a site that just underwent a major upgrade. Be patient!! Someone will help if and when they want to.
|
|
|
|
|
JudyL_FL wrote: Someone will help if and when they want to.
What kind of service is that? For the price we are paying, someone should be on call 24/7. Questions must be answered in a timely manner.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yessss maassstteer <best igor accent>
modified on Tuesday, December 04, 2007 4:15:28 PM
|
|
|
|
|
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
I had problem with error LNK2019, I can't create MFC with CFormView.
error LNK2019: unresolved external symbol "public: __thiscall CFormView::CFormView(unsigned int)" (??0CFormView@@QAE@I@Z) referenced in function "protected: __thiscall CaView::CaView(void)" (??0CaView@@IAE@XZ)
Toxcct told me the problem is : missing the mfc link somewhere in your linker settings.
How to fix it?
|
|
|
|
|
Do you have this error in this project or all projects?
|
|
|
|
|
All project.
The error appear, when I create a new project using CFormView.
It will be no error if I use CView.
For more explanation, the VC2005 still able to open my last project which use CFormView.
Thanks in advance, waiting for your reply.
|
|
|
|
|
The error is complaining about not being able to find CFormView 's constructor. What does your CaView constructor look like?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I had this problem for few days, n make me upset.
At least, I fix the problem by install it from the beginning.
Do not reinstall, I had tried n it's not worked. So I uninstalled first, clean the registry, after that install again.
Thanks anyway, for Hamid and David.
|
|
|
|
|
Hello All,
I want to use png compression for my image data compression(not file).
I am capturing window from the screen and now i want to compress it with png. Is there anybody who had use libpng to compress image data?
I had also see its documentation but i am not getting anything. I had also put it on its mailing list but no one is answering.
Please Help its urgent.
Thanks in advance.
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Did you see CXImage article on the codeproject?
|
|
|
|
|
I want to change the position and size of a window. In the constructor of the Doc window of a VC++ SDI I have the following code. (I'd also like to do this in any window I make.)
CSDITESTfDoc::CSDITESTfDoc()<br />
{<br />
MoveWindow(5,5,500,500,TRUE);<br />
}
The compiler says MoveWindow does not take 5 paramaters.
The format of the command is:
void MoveWindow(int x, int y, int nWidth, int nHeght, BOOL bRepaint = TRUE)
Where am I going wrong? Thanks.
|
|
|
|
|
Your doc class does not derive from CWnd so the system will try to use the MoveWindow from the Win32 API...
BOOL MoveWindow(
HWND hWnd, // handle to window
int X, // horizontal position
int Y, // vertical position
int nWidth, // width
int nHeight, // height
BOOL bRepaint // repaint flag
);
Your view class does derive from CWnd so try that tactic but from within the view class or use a reference or pointer to a view object.
|
|
|
|
|
First parameter is handle to a window(HWND).
|
|
|
|
|
Move your window from the main frame, not the document.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
========================== headers ======================
// MyTrailer.h
#if !defined(AFX_MYTRAILER_H)
#define AFX_MYTRAILER_H
#include <string>
class CMyTrailer {
public:
// Varables
CString m_csItem;
CString m_csMFG;
CString m_csID;
CMyTrailer();
~CMyTrailer();
};
#endif
// Trailer.h
#if !defined(_TRAILER_H)
#define _TRAILER_H
#include <vector>
#include "MyTrailer.h"
class CMyTrailer;
using std::vector;
using std::copy;
using std::iterator;
using std::string;
class CTrailer {
public:
CTrailer(int nIsPage=0);
~CTrailer();
// Varables:
CMyTrailer m_MyTrailer;
// Vectors:
// Setup vectors:
std::vector<CMyTrailer> m_vTlr; // Item
// Iterators:
std::vector<CMyTrailer>::iterator m_ITTrlr;
//Functions:
};
#endif
=================== end headers ==========================
CTrailer m_Trlr2(2); // create instance
================= 7th element in vector ===================
m_Trlr2.m_MyTrailer.m_csItem = "Tire";
m_Trlr2.m_MyTrailer.m_csMFG = "Goodyear";
m_Trlr2.m_MyTrailer.m_csID = "1110109";
===========================================================
How would I find the 7th element(could be anywhere but I'm using the example that it is the 7th element) in the vector when searching by
m_Trlr2.m_MyTrailer.m_csID ?
How woulod I erase only the 7th element? and would there be a blank spot in the vector after the 7th element is erased?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Since vector s have random access iterators[^] something like this will do the trick:
m_vTlr.erase(m_vTlr.begin()+6)
Note this code assumes the vector contains at least 7 elements: you'll get undefined behaviour if it doesn't!
Steve
|
|
|
|
|
As for searching I'd:
1. Add an operator== for CMyTrailer :
class CMyTrailer
{
public:
CString m_csItem;
CString m_csMFG;
CString m_csID;
CMyTrailer();
~CMyTrailer();
};
inline bool operator==(const CMyTrailer &lhs, const CMyTrailer &rhs)
{
return lhs.m_csID==rhs.m_csID;
}
2. Now search as follows:
vector<CMyTrailer>::iterator i = std::find(m_vTlr.begin(), m_vTlr.end(), CString("FindMe"));
if (i!=m_vTlr.end())
{
}
The above code assumes you've included algorithm .
Steve
modified on Monday, December 03, 2007 10:06:57 PM
|
|
|
|
|