|
Life is simple, you just complicate things...
Well, I have used forwardOnly in my example just as an example and it's not intended to be copy/pasted.
Put what you wish instead. Is that a problem?
Although 400 records are not so much in real programming world, if you want a little bit more speed, use ADO instead of MFC database classes.
And if you really really need much more speed use the database native C APIs (if any available).
HERE[^] is an example of MFC wrapper classes built around MySQL C APIs. Very very speedy...
If you are using another database than MySQL, sorry but I have nothing available for the moment. You have to dig yourself for the sake of speed.
BTW. Are you really, really need "bi-directional scrolling" for your recordset?
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
yes i kinda need it very much... so i could easily navigate through my database... thanks my question is answered
----------------------------------Life is simple, you just complicate things----------------------------------
|
|
|
|
|
(continued)
When dealing with databases, one of the issues that can increase queries speed in a way you have never dreamt is to optimize the database structure itself, as for example creating indexes where necessary.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
can someone please tell me how to tie a CRect to a listctrl?
|
|
|
|
|
Did not get the question
Jubin Chawda
braindrain1@rediffmail.com
-----------------------------
Come online at:-
fitiyal@yahoo.com
|
|
|
|
|
Take a look help docs on CListCtrl::GetViewRect() and CListCtrl::GetItemRect() . If you are using a view derived from a CListCtrl you can access the member functions using GetListCtrl(). If you are accessing a control, do it through a member variable. For example:
m_cMyListCtrl.GetItemRect(0, rect, LVIR_LABEL);
Since a CListCtrl is a member of CWnd you can also access the entire controls client or window rectangle using GetClientRect() or GetWindowRect() .
There is an very good article here on using list controls[^]
Mark
|
|
|
|
|
what im trying to do is give my listctrl a gradient background so it blend in with the dialog but i dont seem to be getting anywhere.
|
|
|
|
|
How to send and receive data use the same port?
alantop
|
|
|
|
|
what type of xfer and client or server??
|
|
|
|
|
and are you talking about send files or just communcating...?
|
|
|
|
|
//basic send and recieve is...
#include <string>
#include <winsock2>
#pragma comment(lib,"ws2_32")
WSAData wsaData;
WORD wVersionRequested;
wVersionRequested=MAKEWORD(2, 2);
WSAStartup( wVersionRequested, &wsaData );
std::string rawcmd;
SOCKET communcationsock;
SOCKET ListenSocket;
SOCKADDR_IN service;
ListenSocket = socket(AF_INET, SOCK_STREAM, 0);
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(21);
if (bind( ListenSocket, (SOCKADDR*) &service, sizeof(service)) == SOCKET_ERROR) {
printf("bind() failed.\n");
}
listen( ListenSocket, 1 );
communcationsock=SOCKET_ERROR;
while(communcationsock == SOCKET_ERROR) {
communcationsock = accept( ListenSocket, NULL, NULL);
}
bytesRecv = recv( communcationsock, CMD, 128, 0 );
rawcmd.assign(CMD, bytesRecv);
if(rawcmd=="..."){
char onconn[128]="Can You Hear Me\r\n";
send( communcationsock, onconn, strlen(onconn), 0 );
}
//Basicallly you have to open up a socket for communication.. then you can open up //another sock separately and send files using the same principal.
-- modified at 0:02 Saturday 1st July, 2006
|
|
|
|
|
Hey,
I'm trying to make a move from VB.NET over to C++ (Visual Studio 2003). I'm not new to programming, just programming in C++. I've read through about 10 tutorials over the last week or so and none of them explain how to do graphic stuff. I need to essentially recreate the GUI from my VB.NET application where it colors in defined regions and has drag and drop that knows when you drag something onto that specified region.
Is this possible? (obviously it's possible, but if it takes writing like 100 different function and classes and libraries, it's not really possible).
If anyone can suggest a starting point, I'd be very greatful.
Thanks all!
Mike
Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
|
|
|
|
|
spelltwister wrote: I need to essentially recreate the GUI from my VB.NET application
I am curious, why do you "need to" do that?
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Umm... I'm moving the game from vb.net to c++ so I need an interface I suppose. It has to be drag & drop and has to be able to have colored in regions because that's how the game is played. I'm not sure what you're getting at? /
Mike
Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
|
|
|
|
|
spelltwister wrote: I'm not sure what you're getting at?
No, I am not sure what you are getting at. In your first post you said you "need to" I wondered why you needed to port the application to C++ from VB.NET.
The C++ environment supports .NET development so the port from VB.NET to C++.NET should be a 1 to 1 port. The .NET class library is exactly the same in VC++.NET as in VB.NET.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
I know the number of lines that I have in my document, but the number of pages will depend on the font size, spacing, margins, etc. Is there an easy way to determine the number of pages? A quick comment or code summary with a reference to relavent sample code would be greatly appreciated. Thank you.
newby
|
|
|
|
|
You should be able to calculate the number of pages inside OnBeginPrinting(). Call pDC->GetDeviceCaps(VERTSIZE) to find the vertical height of the paper in mm. You should then be able to calculate the number of pages from the number of lines, the font size and the page size. Here is what I do...
void CActionManView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
m_nHeight = 32; Font size
m_normalFont.CreateFont(m_nHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, 0, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE,"Ariel");
pDC->SetMapMode(MM_LOMETRIC); // 0.1mm units
int height = pDC->GetDeviceCaps(VERTSIZE) * 10; // Get size of page in mm and scal to 0.1mm units
m_nItemsPerPage = height / m_nHeight; // Calculate items per page
m_nItemsPerPage -= 10; // Allow for header/footer
unsigned int nNumPages = (GetPrintableTaskCount() /m_nItemsPerPage)+ 1;
pInfo->SetMaxPage(nNumPages);
m_nPrintItemIndex = 0;
}
Hope this helps.
Tony
|
|
|
|
|
hi,
How to convert CString ...string to long value..do we have any c function..
Thanks in before..
James
-- modified at 13:05 Friday 30th June, 2006
|
|
|
|
|
|
i have used it..but compiler is giving error..i have taken CStringArray..i am getting element from the array..and trying to convert to long..using atol function...
thanks in before
james
-- modified at 13:14 Friday 30th June, 2006
|
|
|
|
|
|
cannot convert parameter 1 from 'class CString' to 'const char *'
|
|
|
|
|
use ttol.
CString str = _T("12345");
long l = ttol(str);
When UNICODE is defined, TCHAR (which is what CString uses) is defined as wchar_t (which is typedef'd as unsigned short). When it is not defined, TCHAR is defined as char. Make sure you use the t-methods when dealing with strings and UNICODE builds.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
If you are using CString, make sure you use the _ttol method. If you are building with UNICODE turned on, atol/atoi will give you conversion errors.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thanks for reply..yeah i have checked,when i build in debug mode i did not get that error,when i build in UNICODE,i got the error...
One more Error...
error C2664:'CollateNoCase' : cannot convert parameter 1 from 'char [5]' to 'const unsigned short *'
how to over come this error pls
thanks in before
james
|
|
|
|