|
My pleasure if I may help. And welcome on CP
Ohé Partisans, Ouvriers et Paysans
C'est l'alarme!
Le Chant des Partisans
|
|
|
|
|
Hi,
I have written this to repaint the slider channel:
NMCUSTOMDRAW the_struct;
the_struct.hdr.hwndFrom =m_ProgressSlider.m_hWnd;
the_struct.hdr.idFrom = IDC_PROGRESSSLIDER;
the_struct.hdr.code=NM_CUSTOMDRAW;
the_struct.dwDrawStage = CDDS_ITEMPREPAINT;
the_struct.dwItemSpec =TBCD_CHANNEL;
the_struct.hdc =this->GetDC()->m_hDC;
m_ProgressSlider.GetChannelRect(&the_struct.rc);
SendMessage(WM_NOTIFY ,(WPARAM)IDC_PROGRESSSLIDER,(LPARAM)&the_struct);
But slider is not repainted.Can anyone help me..
Regards
|
|
|
|
|
|
i don´t know, if i understand you right, because my english is not so good.
if you have a listCtrl in MFC, for example: m_ctrlListBox, then you can add a string to the listbox: m_ctrlListBox.AddString("Hi");
if want to to select this entry you can do something like this:
<br />
m_ctrlList.AddString("Hi");<br />
m_ctrlList.SetCurSel(0);<br />
int place=m_ctrlList.GetCurSel();<br />
CString buffer;<br />
m_ctrlList.GetText(place, buffer);<br />
now the buffer includes the first entry of the listbox.
hope i could help you.
mfc
|
|
|
|
|
i want to enter my edit box text into a list box. how it can be done? can anyone help..
himanshu
|
|
|
|
|
Are you using MFC?
CString sString = "";<br />
<br />
m_edit.GetWindowText(sString);<br />
<br />
m_listbox.AddString(sString);
Michael
Fat bottomed girls
You make the rockin' world go round -- Queen
|
|
|
|
|
Try this:
<br />
CListBox a;<br />
CString b = "";<br />
<br />
yourEditBox.GetWindowText(&b);<br />
a.AddString(b);<br />
Of course you can change the CString and the GetWindowText(...) for a CString variable linked to your editbox... if you want to do it in this way you must call UpdateData();
hope this helps...
|
|
|
|
|
thanks a lot..
|
|
|
|
|
Hi,
i've a problem converting data from a format to another. the function
VARIANT SaveToMemory(const VARIANT& Format, const VARIANT& CurSelection);
returns a byte array (text data) casted like a VARIANT. I need to put this array in a CString variable. So I've used this:
COleVariant varBuffer;
COleVariant mode, cur;
mode = (long)5;
cur = (short)TRUE;
varBuffer = m_txctrl.SaveToMemory(mode, cur);
CString m_text = ((CByteArray &)(varBuffer.pbVal)).GetData();
But this will return an empty string. using CString m_text = (varBuffer.pbVal); return me a single byte.
It's wrong my code?
|
|
|
|
|
Gian wrote:
returns a byte array (text data) casted like a VARIANT
Where exactly is that byte array? It can't be pbVal because this one is about one single byte... (check MSDN)
rechi
|
|
|
|
|
i've solved calculating the dimension of the OleVariant and using memcpy to copy data in a CByteArray. now works
|
|
|
|
|
hello,
i have an mfc program and an access database. i connected them with odbc.
how can i make the following sql statement in my mfc programm?
select distinct xy from mytable
i want to read out 'xy' from a table 'mytable' and put these CString into a ComboBox:
Now i tried this:
<br />
CMyDatabase db;<br />
db.Open( CRecordset::dynaset,<br />
_T( "Select distinct xy from mytable" ) );<br />
<br />
db.MoveFirst();<br />
while(!db.IsEOF())<br />
{<br />
m_ctrlCombo.AddString(db.m_xy);<br />
db.MoveNext();<br />
}<br />
db.Close();<br />
UpdateData(false);<br />
i get the error, when i want to use this funktion. the error:
error with the call of a data record
what´s wrong?????
thanks
mfc
|
|
|
|
|
You need to follow these steps:
1. Open the database (using most likely a DSN, or a connection string).
2. Create a CRecordset object that uses the above open datastring.
3. Open the CRecordse t object with a SQL query ("SELECT disintct...")
4. Once the recordset is open, iterate through recordset via MoveNext, MoveFirst etc.
Also, is wise to include everything in a try/catch block and you will most likely catch a pointer to CDBException object.
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
thanks for reply.
i tried your idea:
<br />
CMyDatabase db;<br />
db.Open();<br />
CRecordset rs (&db);<br />
but i get an error. must i include something (i included
#include "afxdb.h"
)?
thanks
mfc
|
|
|
|
|
afxdb is a standard header, so you should use angle brackets:
#include <afxdb.h>
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
yes, i use angle brackets (< >).....but it does not work.
why? can you help me????
the error is here
<br />
CRecordset rs(&db);<br />
the program has problems with &db
why?
mfc
|
|
|
|
|
Please tell us what your error is. Apparently afxdb is enough standard to include.
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
okay...first the code:
<br />
CMyDatabase db;<br />
db.Open();<br />
CRecordset rs (&db);<br />
the error:
'CRecordset::CRecordset':Conversion parameter 1 from 'class CMyDatabase *' in 'class CDatabase *' not possible.
what´s wrong?
thanks
mfc
|
|
|
|
|
Here's what's going on:
1. It has nothing to do with any header file.
2. Why do you use a CMyDatabase object? Are you overriding some functionality of the CDatabase class?
3. If you are using a custom database object (CMyDatabase) make sure it is derived from CDatabase.
Voila!
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
i understand. my database object is derived from CRecordset .
isn´t there a possiblity to make the sql statement:
select distinct xy from mytable
with a database object from CRecordset ?
Because i ever use CRecordset ....
thank you very much
mfc
|
|
|
|
|
No.
You are making a fundamental confustion. A database consists of tables and when you retrieve a record you read data from one/or more table(s) from the database.
MFC ODBC classes are: CDatabase that wrapps around a database and CRecordset the wrapps around a table (or more tables).
If you want to make a SELECT DISTINCT xy FROM MyTable you have to create a database object that opens the database MyTable table is in, then you create a CRecordset object that takes a pointer to a CDatabase and you pass the SQL statement to that CRecordset (or CRecordset-derived) object. Then you can navigate via MoveNext, MoveLast etc. through the database.
You can, however, execut SQL commands to the database objects. These are generally DELETE or INSERT statements (but not SELECT):
CDatabase db;
db.Open (...);
CString MyDelStr = _T ("DELETE FROM MyTable");
db.ExecuteSQL (MyDelStr);
CString MyInsertStr = _T ("INSERT INTO MyTable Values.....");
db.ExecuteSQL (MyInsertStr);
I hope I've been helpful!
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
thank you very very much.....
i tried your idea....
<br />
CDatabase db;<br />
db.Open(_T( "Datenbank" ), FALSE,FALSE, _T( "ODBC"));<br />
CRecordset rs(&db);<br />
rs.Open(CRecordset::forwardOnly ,"Select distinct xy from Mytable");<br />
i connectet access and vc++ with ODBC. the ODBC driver from my database i namend: 'Datenbank'.
in my database i have different tables and one is called xy.
in my code (above) must be a mistake....it doesnt work...why?
how can i get the strings which i read out of my database table?
thank you.
mfc
|
|
|
|
|
Let me also suggest CODBCRecordset. This class encapsulates CRecordset and makes things much more accesiable. IMO that is.
Cheers
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
Dear girls and guys of TheCodeProject
I need to know how can I draw some geometric shapes (GDI or Direct3D) on top of a DirectShow managed, running or paused, multimedia video (AVIs and BMPs), using DirectX 8.1.
Could I get a IDirectDrawVideo and then IDirectDraw (but DirectDraw is deprecated)?
It could be the solution to use overlay filters (although they are more focused on DVD solutions) as IOverlay?
Must I migrate to XP (my platform is W2K) and then use the VMR system?
Thanks in advance.
|
|
|
|
|
Hi,
I'm sending multiple overlapped I/O requests to a USB device, which it handles dutifully - unless there's an error.
How should I detect that?
I guess I could just send the requests, and then WaitForMultipleObjects to wait for the I/O's to complete. However, I'm not sure what happens when one of the transfers fails - do I have to wait until the remaining transfers time out, etc..
Are there "known good" solution to this scenario?
If I could find a souvenir / just to prove the world was here [sighist]
|
|
|
|