|
It took me a while, but I finally figure that out or so i thought I did, so it's good to hear someone else tell me what a list is and how it differs from an array.
I never cared to think there was a difference before, but now I know there is a crucial difference...
Thanx for clearing that up for me CG...
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
you can't have an array of "void"'s.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
I have developed a chat server. In that I want to detect system idle time, if idle time is greater than 10 min then the server should disconnect the client application automatically. For this purpose I am using Idle Time tracker suggested by Sidney, this code I got from codeproject, but its not working fine its disconnecting the client even if the user is using the system.
What could be the problem....I am not getting it. Can anybody help me ?
Prateeti
|
|
|
|
|
Hello,
I'm building an image viewer that would like to use plug-in architecture to extend the functionality of the image format it supports and tools. I also would like to able to provide some basic image manipulation functions to plug-in writers. Anyone can give me some idea how to do it?
Thanks!
|
|
|
|
|
|
hey, how do i add controls like treeview and listview for example, or a richedit to a CDhtmlDialog without having to place it on the dialog resource instead of the HTML... i was thinking of putting some <OBJECT> or some type of code into the HTML to create a control but i don't know how to do that
any ideas?
<div style="width: 100%; background-color: #efefef; border: 1px solid #999999; padding: 2px; margin: 5px; filter: progid:DXImageTransform.Microsoft.Shadow(color=#808080,direction=135,strength=3); text-align: center;">- <b style="font-variant:small-caps">Roman</b> -</div>
|
|
|
|
|
Roman Nurik wrote:
any ideas?
I don't know if this will work.
But if you use the IHTMLDocument Interface you should be create Frames in the View and put your control into that.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining.
Said by Roger Wright about me.
|
|
|
|
|
Hi,
I have an MDI application. Suppose the user starts searching for something on one view. Then he/she switches over to another view. Obisouly, since the find dialog was launched with the other view, it won't be associated with the new one. But what if I wanted this to be the case? how do I make a find dialog launched in one view, to be associated with another view whenever the second view becomes active?
thanks
|
|
|
|
|
The dialog communicates with the application using Windows Messages. Define the message handlers on the level of views, then the messages from the search dialog will be received by the current top view.
Sonork 100.15206;PavelK
|
|
|
|
|
I am trying to add records using INSERT INTO
pCommand->CommandText="INSERT INTO tblTest (Color, Texture) VALUES ('navy blue', 'rusty') ";
_RecordsetPtr pRecordset;
hr = pRecordset.CreateInstance (__uuidof (Recordset));
if (FAILED (hr))
{
AfxMessageBox ("Can't create an instance of Recordset");
return;
}
AfxMessageBox("LLL");
pRecordset->CursorLocation = adUseClient;
pRecordset->Open ((IDispatch *) pCommand, vtMissing, adOpenDynamic, adLockBatchOptimistic, adCmdTable);
i get an exception at the Open statement so theres something it doesnt like about the SQL i guess.
ANy ideas wil be appreciated!
Thanks,
ns
|
|
|
|
|
Just out of curosity, since this is an insert, why would you use a recordset for? Try using ExecuteSQL on the connection object.
Also, make sure that pRecordset is not 0 when you are calling the open.
|
|
|
|
|
Heres what I tried: stil exception on execute
LPCTSTR lpstrExec ="INSERT INTO tblTest VALUES ('navy blue', 'rusty','aa,'aa,'aa,'aa') ";
m_pConn->CursorLocation = adUseClient;
m_pConn->Execute(_bstr_t(lpstrExec), NULL, adExecuteNoRecords);
Of course I'm justguessing...new at this stuff.
Thank you so much for replying,
ns
|
|
|
|
|
Your latest SQL statement is incorrect btw...the first one was ok.in this one you're missing your column names..You either have to go insert into x(yy,yyy,yyy) values ('','','') or insert into x select x,x,x
This usually works for me as far as inserts go. Remember that you are dealing with COM, so everything is _bstr_t..so you can't just use strings...
Here m_pConnection and varQuery are defined as
const std::string & varQuery
static _Connection * m_pConnection;
then here is my functin which receives the varQuery...BTW, for USES_CONVERSION, you need to include atlconv.h file!
BOOL CDBClass::ExecuteQuery(const std::string & szQuery)
{
USES_CONVERSION;
BOOL bRet = TRUE;
HRESULT hRes = 0;
_variant_t varQuery;
varQuery = A2W(szQuery.c_str());
if(m_pConnection == 0)
CreateConnection();
if(m_pConnection != 0)
{
try {
hRes = m_pConnection->Execute(varQuery.bstrVal, NULL, NULL, NULL);
}
catch (...)
{
bRet = FALSE;
}
if(hRes != 0)
GetError();
hRes == 0 ? bRet = 1 : bRet = 0;
}
return bRet;
}
|
|
|
|
|
Also tried:(exception again)
pCommand->CommandText="INSERT INTO tblTest VALUES ('navy blue', 'rusty','aa,'aa,'aa,'aa') m_pConn->CursorLocation = adUseClient;
m_pCmd->ActiveConnection = mpdb;
m_pCmd->CommandText = _bstr_t(m_strQuery);
m_pCmd->CommandType = adCmdStoredProc;
m_pConnection->CursorLocation = adUseClient;
_RecordsetPtr pRecordset;
hr = pRecordset.CreateInstance (__uuidof (Recordset));
if (FAILED (hr))
{
AfxMessageBox ("Can't create an instance of Recordset");
return;
}
pRecordset= m_pCmd->Execute(NULL, NULL, adCmdText);
|
|
|
|
|
Hi,
I'm almost done with a card game I'm writting, when all of a sudden my program wont exit. I learned (by accident) that everytime I click the 'x' (exit button), it is calling a function I wrote. I never told it to do this!
I'm not sure why its doing this, but is there a way to override the 'x' menu exiting and add my own OnOK() code? Or is this a normal, simple (easy to fix) problem?
Thanks in advance,
~ Selevercin
If you have a problem with my spelling, just remember that's not my fault. I [as well as everyone
else who learned to spell after 1976] blame it on
Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
|
No, I'm not overriding WM_CLOSE, altough I just tried it. I was able to confirm that when I attempt to close the program, it is being called, yet it is not closing my app.
Any suggestions?
If you have a problem with my spelling, just remember that's not my fault. I [as well as everyone
else who learned to spell after 1976] blame it on
Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
For a recordset, GetAbsolutePosition works and gives you back the posn of the record. If I want to place myself at record # 3 say, then there doesnt seem to be a corresponding SetAbsolutePosition....?
What can I use?
Thanks,
ns
|
|
|
|
|
A CP class thats not flexible enough for me had the tip in it though. Its weird how one can force an integer to be
pRecordset->PutAbsolutePosition((PositionEnum)3);
even though in msado15.tlh it says:
enum PositionEnum
{
adPosUnknown = -1,
adPosBOF = -2,
adPosEOF = -3
};
I didnt think you could force any old value to belong to the enum when its not even defined in it.
Very puzzled:
|
|
|
|
|
It maybe because of the enum. Well, its positioning me at records that are not anywhere near what I think they should be. INcrementing by one jumps me by several records. Helllppp!
I need to position myself in the set of records referenced by a local index (if 5 were returned, then 0-4 or something...)
Thanks,
ns
|
|
|
|
|
I tried the following which obviously has a flaw:
{
_CommandPtr pCommand;
HRESULT hr = pCommand.CreateInstance (__uuidof (Command));
if (FAILED (hr))
{
AfxMessageBox ("Can't create an instance of Command");
return;
}
pCommand->ActiveConnection = m_pConn;
pCommand->CommandText="SELECT * FROM tblTest ";
_RecordsetPtr pRecordset;
hr = pRecordset.CreateInstance (__uuidof (Recordset));
if (FAILED (hr))
{
AfxMessageBox ("Can't create an instance of Recordset");
return;
}
pRecordset->CursorLocation = adUseClient;
pRecordset->Open ((IDispatch *) pCommand, vtMissing, adOpenStatic,
adLockBatchOptimistic, adCmdUnknown);
CString strContent;
CString numRec;
long num =pRecordset->RecordCount;
numRec.Format("number of records is %d ",num);
AfxMessageBox(numRec);
pRecordset->AddNew();
pRecordset->Fields->GetItem("Color")->Value = "orange";
pRecordset->Fields->GetItem("Texture")->Value = "fuzzy";
pRecordset->UpdateBatch (adAffectAll);
pRecordset->Close ();
}
I feel I'm not telling it where to add. Besides a lot of fields for the record I want to add are not included, just color and texture. ANy clues as to what I need to do to get AddNew to work?
Thanks,
ns
|
|
|
|
|
ns wrote:
pRecordset->UpdateBatch (adAffectAll);
?
Have you tried pRecordset->UpdateBatch (adAffectCurrent);
And which record are you at ?
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining.
Said by Roger Wright about me.
|
|
|
|
|
The literature I read said it appends at the end of the rs so you dont have to PutAbsolutePosition(index) to place it at the end. I tried putting it at adEOF but still no results.
Thanks and I will try your suggestion,
ns
|
|
|
|
|
Hey Guys
How do i get global variables available in all files of project. For instance i declare a global variable in a header and then include that header in everything that i want to acces the global variable but that doesn't work so how exactly do i go about doing it so i can have a program wide global accesable from any cpp file.
Peter
|
|
|
|
|
Define the variables above the main () in your main.cpp source. Declare the variables as "extern" in your other header files. Done.
|
|
|
|