|
if you really want to be nasty, you have to recast the pS pointer as a char**.
char** p = reinterpret_cast<char**>(pS) Now p[0] points to text1, p[1] to text2, etc.
However, this may be totally nonportable. If this is to work, you have to be sure that text1 is aligned with the beginning of the struct. Also, if sizeof(char*) is not the same size as the member alignment "distance", you will run into trouble.
May I suggest a totally different structure? How about using std::vector<std::string> or are you not in control of the layout of this structure and associated functions? Messing with raw pointers like that is highly error prone and will most likely give rise to late debugging session...
--
Seraphim Shock. Gold for your ears.
|
|
|
|
|
i think i have gotten it to work now, thanx (and yes i needed something nasty)
|
|
|
|
|
Overload the [] operator?
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
[Anders] wrote:
i dont want to get the items like this:char* text=pS->text2;
There's bound to be a reason why you don't want to use this syntax. Any other way would be hard to read and maintain, and probably wouldn't be portable.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
hello, I'm looking for math libs for calculations with very big integer numbers(more than 64 bits) and high-precision floating-points(let's say numbers with 1,000 or more digits after the comma).
some links would be nice....
thx
Don't try it, just do it!
|
|
|
|
|
Hello,
I was writing a little application and I wanted to save some informations in a CSV format file. I expected to use ODBC to interface my file. I wrote some INSERT and SELECT statements and it worked fine. But when I wanted to use the UPDATE, I got an error message saying that "my command had a bad format" ... They could have said "ODBC doesn't support UPDATE or DELETE" !!!!
Because, after having searched a while what could be wrong in my format , I came on the web and found a note on microsoft site saying that ODBC doesn't support UPDATE or DELETE ...
Nevertheless, is there really no way to make it work?
Should I write some code that will delete the line from the file and use an INSERT after ?
Is there any way to retrieve the path I set in ODBC to access my file ?
Thanks in advance for help
DD
|
|
|
|
|
Qadddd wrote:
Because, after having searched a while what could be wrong in my format , I came on the web and found a note on microsoft site saying that ODBC doesn't support UPDATE or DELETE ...
You must've interpreted it wrong because I use Update() and Delete() all the time with ODBC. It works fine.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Hello,
I was talking of this limitation only for ODBC used to access CSV files (and maybe others)!
But fortunately, it works fine with MySQL and SQL Server (for those I already used) and probably Oracle and a lot of more DB's, else it would have a very reduced interest to use ODBC.
Because if we do SELECT to extract our data and INSERT to add them, we are obliged to UPDATE and also DELETE them ...
Look at http://support.microsoft.com/?kbid=281759
Nevertheless, I have 2 remarks for Microsoft :
1) I find to easy to say "We don't support UPDATE nor DELETE for ODBC on CSV file"
2) I would have prefered a clear message as "This SQL statement is nor supported by this ODBC driver" instead of "Bad request format" ! The 1st msg indicates clearly that it works (not) as designed, while the 2nd msg can mean that you are stupid and don't how to write a SQL UPDATE statement ...
I am lucky, my files will become soon a table under MySQL and, as they are not so big, I have been writing some dirty code to rapidly do the UDDATE.
Regards,
DD
|
|
|
|
|
Qadddd wrote:
I am lucky, my files will become soon a table under MySQL and, as they are not so big, I have been writing some dirty code to rapidly do the UDDATE.
You're on your way then. I was going to suggest importing the file into an Access table, making the modifications, then exporting the data back to a CSV file. It would have taken a few more seconds, but would have solved the problem.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Anyone who's tried using MFC's CHtmlView in VC7 has problably noticed that implementing "OnEraseBkgnd" and simply returning "TRUE" doesn't fix the "flicker" problem, as it did in the past, - (and still does with "normal" CView derived views):
<br />
BOOL CMyHtmlView::OnEraseBkgnd(CDC* pDC)<br />
{<br />
return TRUE;<br />
}<br />
You may have also noticed that your derived CHtmlView class doesn't recieve WM_ERASEBKGND messages, which is why implementing OnEraseBkgnd doesn't work.
After a few hours of trying more complicated solutions, I seem to have found a simple fix for the problem. CHtmlView implements PreCreateWindow like this:
<br />
BOOL CHtmlView::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
cs.style |= WS_CLIPCHILDREN;<br />
return CFormView::PreCreateWindow(cs);<br />
}<br />
To fix the flicker problem, I provided my own implementation of PreCreateWindow, changing one line of code:
<br />
BOOL CMyHtmlView::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
cs.style &= ~WS_CLIPCHILDREN;<br />
return CFormView::PreCreateWindow(cs);<br />
}<br />
After making sure the WS_CLIPCHILDREN bit wasn't set, my derived CHtmlView object started receiving WM_ERASEBKGND messages. Now, returning "TRUE" from OnEraseBkgnd works as expected in the first place.
Hope this helps someone besides me....
|
|
|
|
|
--------------------------------------
ANALOG DEVICES
AD1812js SOUNDPORT 9617 BA1226.1-1.2
MODEL AA1812
MADE IN CHINA
FCC ID: LX9UN-1812
--------------------------------------
I very wanna get the above sound card drivers for Windows 2000.
Where to get it???
Please help me!
Thank you in advance!
Rap off for you,for me,for our human.
|
|
|
|
|
Usally drivers are found at the soundcard makers website,
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
this is the wrong forum!
Don't try it, just do it!
|
|
|
|
|
hi all,
i do not get a meaning of this saying "subclass a window", but it's used quite often when i deal with wtl, or any other "tricky stuff"...
what does this mean???
alex
debug - is my life style
|
|
|
|
|
Basically, it means replacing the window's existing window procedure with another one (typically one you've written). This allows you to change certain aspects of the window's behaviour, while passing other events onto the original window procedure.
You might do this if, say, you wanted to trap certain keypresses in an edit control, or draw a button differently, but reuse the general behaviour of the control.
|
|
|
|
|
Hello,
I was wondering if anyone knows any site for information on using XML in Visual C++ application, e.g., I want to be able to user xml interfaces for the program layout.
Thanks in advance!
|
|
|
|
|
|
Well, thanks for the reply, but I still can't find any examples on using XML as for interface and other purposes in Visual C++ Application. Any exact URL's?
Thanks!
|
|
|
|
|
|
Thanks a lot
|
|
|
|
|
How do Isave to bitmap the DC bits?
I want to save to file the bitmap loaded to DC + the lines and text I drawed on it (on the DC).
thanks
|
|
|
|
|
Use CDC::SaveDC() for saving the context use CDC::RestoreDC() for restoring it.
Cheers!!
Siddharth
|
|
|
|
|
Thanks, but the point is I want to save it (a part of it where a bitmap was displayed and written on) as a bitmap!!
|
|
|
|
|
hi,
i am drawing a image on dialog. i tried 2 methods but seems not work.
i do sth like this at OnPaint()
void CRlscoreDlg::OnPaint()
{
if (IsIconic())
{
}
else
{
// method 1
CPaintDC pdc(this);
Graphics graphics(pdc);
int showWidth = 240;
int showHeight = 180;
Bitmap b(L"c:\\335\\image.bmp");
Image *img = b.GetThumbnailImage(showWidth,showHeight, NULL,NULL);
graphics.DrawImage(img,10,10,showWidth,showHeight);
/*
// method 2
HWND hwndStill = NULL;
// IDC_STILL is the picture box
this->GetDlgItem( IDC_STILL, &hwndStill );
RECT rc;
::GetWindowRect( hwndStill, &rc );
long lStillWidth = rc.right - rc.left;
long lStillHeight = rc.bottom - rc.top;
HDC hdcStill = ::GetDC( hwndStill );
Graphics g(hdcStill);
g.DrawImage(bb,0,0,b.GetWidth(),b.GetHeight());
*/
CDialog::OnPaint();
}
}
in method 1, the image cant be shown on startup sometimes. but, after minimize and restore it, the image appear!
in method 2, the image just cant display!
any help? ah! i am using gdi+ but i dont think it the problem.
thanks,
jim
|
|
|
|
|
In a MFC,Dialog_Based project ,I want to Know how can I get the position
(coordinate) which the user clicked on the dialog.
I don't Knw how the associated functions .I've seen the Msdn library but
There were not any example. please guide me .
THANK
|
|
|
|
|