I am using a virtual list control, in the message LVN_GETDISPINFO i am setting the text but how can i set the ItemData. ON_NOTIFY(LVN_GETDISPINFO, ID_LIST, GetDispInfo) void CWndEx::GetDispInfo(NMHDR* pNMHDR, LRESULT* pResult) { LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR; LV_ITEM* pItem= &(pDispInfo)->item; if (pItem->mask & LVIF_TEXT) { //Comes here } if(pItem->mask & LVIF_PARAM) { //NEVER COMES } } When i call m_ListCtrl.GetItemData(nRow) it allways returns 0 and never comes to the GetDisplayInfo function. Do you set the ItemData some other way or just handle getting the ItemData in your own function? Any Ideas?
Gilfrog
Posts
-
ItemData in a virtual list control -
binary data in XMLhow can i put a binary data chunk in to XML node using MSXML I've seen some suggestions of converting it to a hex representation. Any suggestions or examples
-
Convert Screen Rect to Printer Rectok i have the pixals per inch, what do i do with them to convert the rect?
-
Convert Screen Rect to Printer RectI have a Rect say (0, 16, 0, 154) and i want to print it out with that same rect on a printer. on the printer dc i say int nOldMapMode = dc.SetMapMode(MM_HIENGLISH); dc.DPtoLP(rect); it converts it to (0, -27, 0, 257) wich is way to small for the printer. How do i convert this rect to the same rect for a printer? Scott
-
Writing to a file with CInternetSessionI am currently downloading a file from the web and checking info from it. CStdioFile *remotefile; CInternetSession mysession; remotefile = mysession.OpenURL (csUrl,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD); if(!remotefile) return 0; My question is can i write to the file that i just opened and save it back on the web server. If this doesn't work is there another method if i want to write to a file over the web? Scott
-
Printing a custom controlWhat should the desiredDPI be? I tried 96 and it seems to work pretty good but it prints everything a little smaller than it should be. I can play around with desiredDPI and get it to print almost exactly like it is on the screen but there's got to be a way to figure what this value should be? Scott
-
Printing a custom controlI have a custom control that i do all the drawing on. If i want to print the control can i just replace the DC with a DC i get from CPrintDialog? This works but it prints reeeally small. How can i get it to print so it is the same size as on the screen? Scott
-
CButton Killfocusthat works, thanks Scott
-
CButton KillfocusHow do you get the killfocus for a CButton. There is a ON_BN_KILLFOCUS but that never comes. In the class wizard there is no option for killfocus. scott
-
CDataGridIs there any way not to save the data at once. I would like to have a Ok and a Cancel button and not save the data till they hit ok. Is there a way of doing this with a CDataGrid in VC++ 6.0. thanks Scott
-
Sending Paste MessageI can send the keydown for v but my main question now is How to set the state of the control key to be pressed when i send the keydown message? Scott
-
Sending Paste MessageI am having trouble sending a paste message to windows in visual studio, word and excel. Sending the wm_paste message seems to work on normal edit controls and rich edit controls but not these others. I get the window with focus and send it a wm_paste message. Are these different type of window's, should i send them a ctrl-v message? If so how do i send that message, Send a wm_keydown for v, but how do i say the ctrl is pressed. Thanks Scott
-
reading and writing raw data to an access database from c++What is the correct way to read and write raw data to and from an access database from c++. The field is a Ole Object in the database. The table has two fields in it 1) type -- long 2) data -- Ole Variant CDaoDatabase db; CDaoRecordset recset(&db); db.Open("data.mdb"); recset.Open(AFX_DAO_USE_DEFAULT_TYPE, "SELECT * FROM Main" ,NULL); recset.AddNew(); recset.SetFieldValue("Type", (long)1); BYTE* pInfo; pInfo = new BYTE [30]; for(int i = 0; i < 30; i++) pInfo[i] = i; recset.Update(); recset.Close(); db.Close(); How do i get the data from pInfo into the the field "data" in the database? this data could be anything from a bitmap to text. thanks
-
having a color show through another colorCOLORREF CList::Transform2SelColor(COLORREF clr) { return RGB( abs( ((DWORD)clr&0xFF) - (255 - ((DWORD)m_clrSelection&0xFF)) ), abs( (((DWORD)clr>>8)&0xFF) - (255 -(((DWORD)m_clrSelection>>8)&0xFF)) ), abs( (((DWORD)clr>>16)&0xFF) - (255 - (((DWORD)m_clrSelection>>16)&0xFF)) )); } where clr is the slection color take the absolute value of (R value of the selection color - the inverse of the background color)
-
having a color show through another colorI have a grid that you can set a color for each cell. When multiple selection is on and i select cells with a background color in it the selection color over rides the original cell background color. I would like to blend these 2 colors to show that it is selected and show the original cell background color. when drawing i have the 2 COLORREF values. Is there a function to blend these or something along those lines. Similar to how excel handles selection and background colors. thanks
-
Storing 2 longs in a single variablethanks, that works for me.
-
Storing 2 longs in a single variableHow do i get the two longs back out of the unsigned__int64?
-
Storing 2 longs in a single variableI don't think that will work because that stores it in a structure. I need it to be in one variable.
-
Storing 2 longs in a single variableHow can i store 2 longs in a single variable. Similare to storing 2 shorts in a long with the MAKELONG macro. Can i do this with Long64? Thanks
-
Adding a Node to a XML fileHeres the code String strPathName; strPathName = "C:\\My Documents\\C_Projects\\XML\\books.xml"; CString csString; HRESULT hr; hr = CoInitialize(NULL); if (FAILED(hr)) { return; } hr = CoCreateInstance(MSXML::CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, MSXML::IID_IXMLDOMDocument, (LPVOID*)&document); if (!document) { return; } BSTR bstr = NULL; document->put_async(VARIANT_FALSE); bstr = strPathName.AllocSysString(); VARIANT_BOOL varOkay = document->load(bstr); SysFreeString(bstr); BSTR nodeName; if (varOkay) { hr = document->get_documentElement(&element); if (FAILED(hr) || element == NULL) { MessageBox(_T("Empty document!"), _T("Error Loading XML"), MB_ICONWARNING); return ; } element->get_nodeName(&nodeName); m_List.AddString(CString(nodeName)); if(element->hasChildNodes()) { MSXML::IXMLDOMNode* firstChild = NULL; HRESULT hr; hr = element->get_firstChild(&firstChild); if (SUCCEEDED(hr) && firstChild != NULL) { ((MSXML::IXMLDOMElement*)firstChild)->get_nodeName(&nodeName); m_List.AddString(CString(nodeName)); } } MSXML::IXMLDOMElementPtr node; node = document->createElement("Test"); document->appendChild(node); } else { long line, linePos; BSTR reason = NULL; document->get_parseError(&parseError); parseError->get_errorCode(&hr); parseError->get_line(&line); parseError->get_linepos(&linePos); parseError->get_reason(&reason); CString strMsg; strMsg.Format(_T("Error 0x%.8X on line %d, position %d\r\nReason: %s"), hr, line, linePos, CString(reason)); MessageBox(strMsg, _T("Error Loading XML"), MB_ICONWARNING); SysFreeString(reason); return; } on the line -- document->appendChild(node); is gives the error Unhandled exception in XML.exe(kernal32.dll); 0xEO6D7363; Microsoft C++ Exception Scott