|
|
You need to set the mask member of the HDITEM struct before calling GetItem() , so the control knows what info you're asking for. As it is, mask is random data and who knows what the control is putting in the struct.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
|
Hello,
I've to add large strings with very different styles to richedit.
how can i add them all to rich edit and then show all in a second ??!
Because it makes filickers when i add each string to richedit !
Regards,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
In my old project I added a class CsortListCtrl derived from CListCtrl, and when I #included it (I think thats all I did) when I put a listctrl on the dialog and used the CW to make a variable for it, it gave me two choices for the type of the control: SO I could either make it CListCTrl or CSortListCtrl. In this new project I've put the control on the form, #included it, but the CW is only offering me one choice i.e. it can only be of type CListCtrl. WHat to do? I need
CSortLIstCTrl mySortCTrl;
|
|
|
|
|
Hiya getting a message saying "Database error - There were no columns specified to retrive." when using these 2 lines:
SqlString = "DELETE * from Branches WHERE Branch_No LIKE '4%' ";
OR
SqlString = "INSERT INTO Branches (Branch_No,Branch_Name) VALUES ('6','Derry') ";
But Branch_No is the first column and Branch_Name is the second..
Am I using the statements wrong??
Thanks,
grahamoj.
|
|
|
|
|
grahamoj wrote:
SqlString = "DELETE * from Branches WHERE Branch_No LIKE '4%' ";
It should be DELETE FROM <table_name> WHERE <condition>
Vini
|
|
|
|
|
grahamoj wrote:
SqlString = "INSERT INTO Branches (Branch_No,Branch_Name) VALUES ('6','Derry') ";
1. What is the error message
2. Does the row exists, if so the statement will fail
3. Is Branch_No declared as INT it so try 6 not '6', although I don't think this will make any diference.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
// Open the database
database.Open(NULL,false,false,sDsn);
// Allocate the recordset
CRecordset recset( &database );
// Build the SQL statement
SqlString = "DELETE FROM Branches WHERE Branch_No LIKE '4%'";
//SqlString = "INSERT INTO Branches (Branch_No,Branch_Name) VALUES ('6','Derry') ";
// Execute the query
recset.Open( CRecordset::forwardOnly,SqlString,CRecordset::readOnly );
I now know it is the last line, so changed it to:
recset.Open( AFX_DB_USE_DEFAULT_TYPE,SqlString,CRecordset::none );
but this still does not delete the line. The error message I am getting is:
"Database Error: Attempt to open a table failed - there were no columns to retrive were specified".
But my table is called Branches and is specified!!
Any ideas.
grahamoj
|
|
|
|
|
What I always do is use "Query Analyzer" to check out my SQL statement, I tried the following on a scratch table
use teds<br />
INSERT INTO winrasdialit (col001, col002, col003) VALUES('hello', getdate(), 5)
It works OK, so if your SQL statement works in "Query Analyzer" you have at least eliminated one possible error. It does look like you do not have the database open for read only as delete seems to work?
I don't use CRecordset so I can't comment on your synatx
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Since the DELETE and INSERT commands don't return a recordset you shouldn't use the CDaoRecordset (or CRecordset) class to execute them. Just use the Execute method in the CDaoDatabase (or CDatabase) class.
Kelly Herald
Software Developer
MPC formerly Micronpc
|
|
|
|
|
Hi! I'm just curious how you manage to execute those insert and delete queries? I get rt error when doing it like this:
CDaoDatabase* m_pDB;
CDaoRecordset* m_pRS;
m_pDB = new CDaoDatabase;
m_pRS = new CDaoRecordset(m_pDB);
try {
m_pDB->Open("c:\\accessdb\\db1.mdb");
// CString strQuery = _T("SELECT * FROM Table1"); //Works just fine...
CString strQuery = _T("INSERT INTO Table1 VALUES ('3', 'Olga')"); //Doesn't work
m_pRS->Open(dbOpenDynaset, strQuery);
} catch (CDaoException* e) {
AfxMessageBox(e->m_pErrorInfo->m_strDescription);
e->Delete();
}
Can you tell me how to do it?
|
|
|
|
|
Hi, I just started getting into C++/MFC and I've hit my first snag. I'm making a simple program that downloads the contents of a webpage and then sorts out href's. The problem comes into play in the OnReceive event handler. I'm getting 'The instruction at 0x77f475cc referenced by 0x0000000. The memory could not be "written"' right after I get the first packet. I suppose I'm doing something wrong with a pointer? Null maybe? It ONLY does this when I compile for release, it works perfectly when I compile for debug. After changing around some compiler options (turning off optimizations) it still does the same thing. I've done step by step debugging and the last thing I'm seeing is 'Receiving HTML'. I've looked over it for a long time and even showed it to a few friends, they couldn't figure it out either. My guess is it's the pBuf pointer but I don't see why, if anybody could give me some tips I would appreciate it! Here's my code..
void CReconDlg::OnReceive()<br />
{<br />
char *pBuf = new char[1024];<br />
CString strRecvd, strConlen = "Content-Length:", actualLen;<br />
char *pConlen;<br />
int wholePacket, int result, int lenLen, int endPos, int iBufSize = 1024, int iRcvd, int packetStart;<br />
<br />
iRcvd = m_sConSocket.Receive(pBuf, iBufSize);<br />
pBuf[iRcvd] = NULL;<br />
<br />
if (iRcvd == SOCKET_ERROR){<br />
MessageBox("Error on receiving socket");<br />
}else{<br />
m_sStat = "Receiving HTML..";<br />
strRecvd += pBuf;<br />
}<br />
<br />
pConlen = strstr(strRecvd, strConlen);<br />
<br />
if (pConlen != NULL){<br />
result = (int)(pConlen - strRecvd + 1) + 15;<br />
endPos = strRecvd.Find("\n", result) - 1;<br />
lenLen = (endPos - result);<br />
actualLen = strRecvd.Left(endPos);<br />
realLen = actualLen.Right(lenLen);<br />
packetStart = strRecvd.Find("\r\n\r\n", result);<br />
int packetLen1 = (strlen(strRecvd) - packetStart);<br />
m_strIn += strRecvd.Right(packetLen1);<br />
}else{<br />
m_strIn += strRecvd;<br />
}<br />
wholePacket = strlen(m_strIn) - 4;<br />
CString display ;<br />
display.Format("%d", wholePacket);<br />
<br />
if (realLen == display){<br />
m_sStat = "Received entire packet, parsing..";<br />
ParseString(m_strIn);<br />
m_sConSocket.Close();<br />
m_strIn = "";<br />
realLen = "";<br />
<br />
}<br />
<br />
UpdateData(FALSE);<br />
<br />
}
|
|
|
|
|
First thing I noticed is that this:
pBuf[iRcvd] = NULL;
is a buffer overrun. What happens if iRcvd is 1024? You write a 0 to one byte past the end of the array, overwriting whatever is on the stack at that point.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
hi,
when i attempt to use odbc to retrieve data from ms access database, i get an error "error: field data truncated during data fetch" right after executing odbc's Open().. odbc crashed at retrieve data from a field, datatype: memo.. i did a couple test and found out if the field contain more than 255 characters the my program crashes.. is there anyway to fix the problem? thanx in advance..
|
|
|
|
|
which the best book to learn vc SDK?
ive heard of petzold as one.
-We are born naked, wet and hungry. Then things get worse.
|
|
|
|
|
You mean Windows API? Well, Petzold is still the best IMHO
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
i need to find out the size of the
Tab control....
"how to get size of any control"
|
|
|
|
|
Hi all
I have to download that files(from internet sites,DLL or exe anything)to store in some temporary area like C:Pgmfiles\temp
To do that how to write coding in VC++?
Thanks for viewing this.Please help me.
|
|
|
|
|
Look at the MSDN example:-
TEAR: "Tearing" HTML Pages Off the Internet
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
|
iam running notepad called notepad.exe
what api i should use to kill the process ex.notepad.exe
i just pass exe name.It should kill the process
|
|
|
|
|
use CreateProcess() to run the exe, then call TerminateProcess(handle).
handle is inside one of params of CreateProcess().
includeh10
|
|
|
|
|
I wrote a small console application in vc++.I just print hello world.But the exe size in release mode comes around 36 KB.How to reduce the memory size.I want to reduce to 10 KB.What are the things i can remove to reduce the exe size.
|
|
|
|
|
How about the following 640 bytes compiled and linked Hello World? Sure, you can get it up to 10KB if you want, but...
<br />
<br />
<br />
<br />
<br />
#pragma optimize("gsa-y", on)<br />
#pragma comment(lib, "kernel32")<br />
#pragma comment(linker, "/merge:.rdata=.text")<br />
#pragma comment(linker, "/entry:mymain")<br />
#pragma comment(linker, "/subsystem:console")<br />
#pragma comment(linker, "/align:16")<br />
#pragma comment(linker, "/filealign:16")<br />
<br />
#define WIN32_LEAN_AND_MEAN<br />
#include <windows.h><br />
<br />
#pragma data_seg(".text")<br />
<br />
void mymain()<br />
{<br />
DWORD dwDum;<br />
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "Hello world!\n", 13, &dwDum, 0);<br />
}<br />
|
|
|
|