|
Even easier, this seems to work for me.
BSTR bstrOriginal;
char * pChars;
...
pChars = (char *) (_bstr_t) bstrOriginal;
This code casts the BSTR to a _bstr_t wrapper class. _bstr_t class has a (char *) conversion method. This returns a converted copy of the string. It is NOT a cast.
Thanks for the help,
Bill
|
|
|
|
|
Easy, yes. The conversion macros are usually faster than wasting a bstr_t object to do the conversion, too. (Although assigning it to the CString will likely waste the time you just saved! )
But you have to be careful with them! They can cause problems if used in a loop, an exception handler, or if you are dealing with a large amount of data.
Peace!
-=- James.
|
|
|
|
|
´ve a problem with crecordset::update()!
i´ve created a user-dsn(excel 2000 derivied) and with the class-wizard a crecordset derivied.
if i call edit(); i get an error message that the datagroups are readonly, but i've used dynaset!
i need a solution!!! please
thanx
i´m german, i know the quality of my english...:
confused:
|
|
|
|
|
i've used crecordset::none in the openflags!
|
|
|
|
|
For make a Recordset updatable you need to open the table editing all Fields. Some times if you make a select that include oll the index fields, you will must have no problems, but sometimes that don't works.
Is more secure to open the table, (The sheet in your case) in the CRecordset::Open()...
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
m_clientset is a Object of CClientSet and CClientSet is class(created with the class wizard). In the Excel table there is one Database(one Sheet) which is called "Kunden". The User-DSN is named CASAK and it´s a Microsoft Excel Driver(97-2000) and is prepared for only this one file.
m_clientset.Open(CRecordset::dynaset,"Kunden",CRecordset::none);
if(!m_clientset.CanUpdate())
AfxMessageBox("no update");
if(!m_clientset.CanTransact())
AfxMessageBox("no transact");
I don't know how shall I continue.
Karsti
|
|
|
|
|
How can i create a string array from a variable amount like for example this:
<br />
int Count = 99;<br />
CString Data[Count];<br />
???
Kuniva
|
|
|
|
|
Use CStringArray, or STL vector <CString>
I vote pro drink
|
|
|
|
|
Could someone clear this up for me. Like tell me all the stuff about it.
"To wonder is to begin to understand"
|
|
|
|
|
SendMessage() sends a message to a window. This means, it places the message in the target window's message queue, waits for it to be processed, and then returns. PostMessage() simply places the message in the target's queue and returns immediately.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
uh, i dont know all about it but i believe it is just a function to send certain messages to a window like this:
<br />
SendMessage(WM_CLOSE,0,0);<br />
This for instance would send a WM_CLOSE message to your window and if that window has a handler for the message to close it, the window will be closed. There's all sorts of messages (see winuser.h). WM means its a window message, you also have messages for buttons and other objects, for instance, button messages start with "BN".
The two 0's are the wParam and the lParam, these are optional parameters, for example if a window receives a WM_COMMAND message it means someone pressed a button or did another command, then you can find what command by looking at the wParam.
Kuniva
|
|
|
|
|
I want my app to launch the standard Internet connection. That one you create to connect to internet.
I know the InternetDial function only... is there another better API or something?
The problem is I don't know one of the parameters:
lpdwConnection
Address of an unsigned long integer value containing the number associated to the connection.
How to get known of that?
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
lpdwConnection is an out parameter. You don't need to know it, it will be returned to you.
You may also want to look into InternetAutodial or InternetGoOnline
|
|
|
|
|
Maybe you should look at the RasDial() function at the MSDN library, and rate my posting if it helped you
Enjoy your life...
|
|
|
|
|
I want to write database application,I want to Edit some of
my recordsets.I used this code but I don't know how to edit
recordsets:
CDatabase aDB;
try
{
aDB.OpenEx("DSN=MyDSN");
CRecordset aRS(&aDB);
aRS.Open(CRecordset::dynaset,"SELECT *from mytable");
while(!aRS.IsEOF())
{
CString strValue;
aRS.GetFieldValue(short(5),strValue);
CString str;
if(/*something here*/)
{
???????????
aRS.Edit();
?????????????
}
aRS.MoveNext();
}
aRS.Close();
aDB.Close();
}
catch(CDBException *ex)
{
TCHAR buf[255];
ex->GetErrorMessage(buf,255);
CString str;
AfxMessageBox(str);
}
|
|
|
|
|
Is there any way to pass a CListBox control to a function so it can be used in the function and so you can use the function with the different listboxes of a dialog. Lets just say for example i want to write a function to clear a CListBox control:
<br />
void ClearListBox(CListBox list)<br />
{<br />
int count = list.GetCount();<br />
CString Data[999];<br />
<br />
for(int i=0;i<=count-1;i++)<br />
{<br />
list.DeleteString(i);<br />
}<br />
and to use it i'd do this:
<br />
ClearListBox(m_Listone);<br />
ClearListBox(m_Listtwo);<br />
...<br />
Whats the easiest way to do something like this?
Kuniva
|
|
|
|
|
list.resetcontent() ?
---
"every year we invent better idiot proof systems and every year they invent better idiots ... and the linux zealots still aren't being sterilized"
|
|
|
|
|
sorry to disappoint you, i'm not one of those idiots, it was the matter that concerned me, the problem was only hypothetically speaking...
Thanks anyways.
Kuniva
|
|
|
|
|
Change it to:
void ClearListBox(CListBox& list) Passing a reference avoids making a copy (which I assume was the problem you ran into).
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
How about:
void ClearListBox (CListBox* pListBox)
{
ASSERT (pListBox != NULL);
if (pListBox != NULL) {
pListBox->ResetContent();
}
} To use it, do:
ClearListBox (&m_ListOne);
ClearListBox (&m_ListTwo); /ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Is there any way to pass a CListBox control to a function so it can be used in the function and so you can use the function with the different listboxes of a dialog. Lets just say for example i want to write a function to clear a CListBox control:
<br />
void ClearListBox(CListBox list)<br />
{<br />
int count = list.GetCount();<br />
CString Data[999];<br />
<br />
for(int i=0;i<=count-1;i++)<br />
{<br />
list.DeleteString(i);<br />
}<br />
and to use it i'd do this:
<br />
ClearListBox(m_Listone);<br />
ClearListBox(m_Listtwo);<br />
...<br />
Whats the easiest way to do something like this?
Kuniva
:p
|
|
|
|
|
Instead of passing the whole ListBox, pass a reference to it or pointer. Like this:
void ClearListBox(CListBox &list);
or
void ClearListBox(CListBox *list);
and call it like this:
ClearListBox(m_Listone);
or
ClearListBox(&m_Listone); (in case of pointer)
Philip Patrick
"Two beer or not two beer?" <shakesbeer>
Web-site: www.saintopatrick.com
|
|
|
|
|
You were faster.
I vote pro drink
|
|
|
|
|
|
1.
void ClearListBox(CListBox* list)
2.
void ClearListBox(CListBox& list)
I vote pro drink
|
|
|
|