|
Ok - thanks, it helped, but just a few questions:
1. I need to do the connection to the database from one function (when a user presses a certain button) and open the recordset in another function (when the user presses another button). How do I do this? make the CDatabase object global (a member variable)? Also, I want to get the strDSN string information from the user by opening a dialog box and letting him choose a data source. Again, how do I do this?
2. can I read the data from the records somehow else - not to a string?
3. does my class (in which I am doing all of this db handling) have to inherit from CRecordset?
3. what did you mean by: "I left out A LOT of defensive coding" ?
|
|
|
|
|
SWDevil wrote: ...the application crashes, and I don't understand why...
Have you stepped into the Open() call to find out why?
SWDevil wrote: Another question - after the row: rs.Open(CRecordset::snapshot, strSQL, CRecordset::readOnly); is executed, how do I read the data that was retrieved by the SQL query? is it in the recordset object?
Derive a class from CRecordset . Its member variables will hold the vales. Otherwise, using CRecordset directly will require you to use GetFieldValue() .
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
yeah - I tried stepping through the code..
But now I sometimes get an error saying that columns were not bound. do you know what that means?
About the recordset - what member variables hold the values? I looked at the MSDN help and could not see any variables that actually hold any data...
|
|
|
|
|
SWDevil wrote: About the recordset - what member variables hold the values? I looked at the MSDN help and could not see any variables that actually hold any data...
ClassWizard creates them.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Hello!
Does Visual Studio 2005 Standard[^] support MFC and ATL?
If so, can the MFC libraries be statically linked to the application in the Standard edition?
Can I still develop native MFC applications, that don't use any of the .NET stuff?
Thanks in advance and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Yes to MFC support.
Yes to ATL support.
Yes to MFC static linkage.
Yes to MFC without .NET.
"My dog worries about the economy. Alpo is up to 99 cents a can. That's almost seven dollars in dog money" - Wacky humour found in a business magazine
|
|
|
|
|
Deal All,
In my project I am processing web pages. I want to know the different components of a web page.
I know that it is possible to extract html elements (tables, divs, images ...) using the html DOM tree. But I am not sure if its possible to recognise flash animation and pop-ups (dynamic elements) within a certain web page.
Does any one know if this is feasible or not? if it is so, can you please advise me on this task.
Thank you
llp00na
|
|
|
|
|
Can you help me abuot the text rotation like the behaviour in InDesign (text and cursor rotated).
Can yuo send me an example?
If the text is rotate also the cursor will be rotated.
Thanks.
|
|
|
|
|
Where do you want rotate text (screen, control and etc.)?
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
following is the CreateFontIndirect example in msdn.
HFONT FAR PASCAL MyCreateFont( void )
{
CHOOSEFONT cf;
LOGFONT lf;
HFONT hfont;
// Initialize members of the CHOOSEFONT structure.
cf.lStructSize = sizeof(CHOOSEFONT);
cf.hwndOwner = (HWND)NULL;
cf.hDC = (HDC)NULL;
cf.lpLogFont = &lf;
cf.iPointSize = 0;
cf.Flags = CF_SCREENFONTS;
cf.rgbColors = RGB(0,0,0);
cf.lCustData = 0L;
cf.lpfnHook = (LPCFHOOKPROC)NULL;
cf.lpTemplateName = (LPSTR)NULL;
cf.hInstance = (HINSTANCE) NULL;
cf.lpszStyle = (LPSTR)NULL;
cf.nFontType = SCREEN_FONTTYPE;
cf.nSizeMin = 0;
cf.nSizeMax = 0;
cf.lfOrientation = 180; // specify angle that you want.
// Display the CHOOSEFONT common-dialog box.
ChooseFont(&cf);
// Create a logical font based on the user's
// selection and return a handle identifying
// that font.
hfont = CreateFontIndirect(cf.lpLogFont);
return (hfont);
}
Enjoy
Anderson Sheen (exteide@gmail.com)
The Extension IDE: http://www.exteide.com
|
|
|
|
|
Try this:
cf.lfEscapement = cf.lfOrientation = 180;
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
|
Or to rotate basically anything at all (not just text):
CPaintDC dc(this);
int OldGMode = SetGraphicsMode(dc.m_hDC, GM_ADVANCED);
static const double pi = 4*atan(1.0);
static const double a = 30*(pi/180);
XFORM xf = {cos(a), sin(a), -sin(a), cos(a), 0, 0};
SetWorldTransform(dc.m_hDC, &xf);
int OldBkMode = dc.SetBkMode(TRANSPARENT);
dc.TextOut(0, 0, _T("This text is rotated."));
dc.SetBkMode(OldBkMode);
dc.Rectangle(100, 100, 200, 200);
SetGraphicsMode(dc.m_hDC, OldGMode);</code>
NOTE: Doesn't work in 95/98/ME
Steve
|
|
|
|
|
This is a generic query although I am right now looking for a tiny web proxy for windows and therefore seeing if I can port tinyproxy[^] to windows.
1. What are the typical challenges in porting a linux applicaiton to windows?
2. How does one go about identifying those challenges in the linux applicaiton?
thanks!
|
|
|
|
|
Can I get a property page title specified in Dialog resource editor without creating a page?
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
If the page has not been created then you can not call GetWindowText() on it, but you can get the caption from the tab control (CPropertySheet::GetTabCtrl() then CTabCtrl::GetItem() with TCIF_TEXT flag).
If you want it even before the sheet is created then there might be a way using FindResource(), LoadResource(), etc.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thank you. My choice is a FindResource(), LoadResource(), etc..
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
Hello,
I'm sick of gray dialogs and windows. I'd like to skin my applications. However, I'm just a student and I can't afford buying professional skin system.
I'm looking for a free yet powerful and flexible skin system.
Can someone give me a link?
Thanks,
Allad
----
Navigator - Your best alternative to Windows Explorer
|
|
|
|
|
|
Hi there. I have a question that has been unanswered for too long. Suppose I have an application that uses a DLL, and within that application, I need to pass a STL string to a class within the DLL. Have you tried that?? It blows up. Now, how can I get over this. This thing works until it leaves the function, making me believe that it is something to do with the release of the memory used by the string itself. Now, I know I could pass a pointer, or whatever, but this is just an example. Right now, I'm trying to get a class within the DLL ask the main app for a STL map, and the app fills up the map correctly, but just when the dll function exits, it blows up again. and again, error deallocating the memory. I've built two mini-projects with VS .NET 2003 for you to check it out. They're very simple and show this error. Can you give me a hint here? Thanks
the link to the projects is here
|
|
|
|
|
Almost certainly you are experiencing the classic mixed allocator problem. That's when you allocate memory on one heap and free it in another - This is bad - A crash is the best cash scenario as often it results in heap corruption and "blows up" some time later in some other part of the code leaving you scratching your head. The general way around this is to follow this rule:
- If you allocate memory in one module free it in the same module. You may have to export a free function from the module to achieve this.
Another approach is that used by COM - All the modules agree to use the same allocator (CoTaskMemAlloc and friends. You could implement this for STL strings by writting a custom allocator (the allocator can be passed as a template parameter).
Steve
|
|
|
|
|
Make sure that you link all modules with the dll version of C++ runtime library.
|
|
|
|
|
I print 2 base lines:
1) from (0,0) to (300,0) - horz base line
2) from (0,0) to (0,300) - vert base line
but they are not at topmost and leftmost of printed page - there are margins at top and left.
do you know how to adjust the base lines from C++ or hardware (printer etc) settings to delete the margins to let the 2 base lines at topmost and leftmost of printed page?
---------------------------
followins are MFC code, please do a testing for me: if your printers have margins also?
---------------------------
CPrintDialog cp(0);
if(cp.DoModal()!=IDOK) return;
HDC hDC=0;
hDC=cp.CreatePrinterDC();
if(hDC==0) return;
CDC*pDC=CDC::FromHandle(hDC);
int iMapMode=pDC->SetMapMode(MM_LOENGLISH);
DOCINFO docInf;
memset(&docInf,0,sizeof(DOCINFO));
docInf.cbSize=sizeof(DOCINFO);
pDC->StartDoc(&docInf);
pDC->StartPage();
pDC->MoveTo(0,0);
pDC->LineTo(300,0);
pDC->MoveTo(0,0);
pDC->LineTo(0,-300);
pDC->EndPage();
pDC->EndDoc();
pDC->SetMapMode(iMapMode);
-------------------------
thx
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Most printers can't print on the entire page. Lasers typically have a 'border' from 0.1 to 0.3 inches around the edge where they won't print. Ink jets are similar.
Software Zen: delete this;
|
|
|
|
|
I have a problem with this code, if anyone could please help me out, I would greatly appreciate it! I'm trying to make a program that has a certain number of 'char arrays.' When the program starts, it's supposed to randomly concatentate any of the two strings. My program has a problem in four lines of code, and I don't understand how to do it any different. Thank you for your time and help! (P.S., though this snippet of code only shows 4 different strings, my actual program will have at least 25);
//Test program. The object of this program is to
//have different strings randomly concatenate
#include <iostream>
#include <windows.h>
using namespace std; //or #include <stdio.h>, depending on the compiler
#include <string.h>
int main()
{
srand(GetTickCount());
char word[4][128]; //I want to store different strings into word[0], word[1], word[2], and word[3]
word[0][128] = "word1"; //This is set of four lines is where the problem is
word[1][128] = "word2";
word[2][128] = "word3";
word[3][128] = "word4"; //----end of the problem
int firstword;
int secondword;
firstword = rand() % 4;
secondword = rand() % 4;
strcat(word[firstword], word[secondword]);
cout << ""<< word[firstword] <<"";
cin.ignore();
return 0;
}
|
|
|
|