Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
T

tuxyboy

@tuxyboy
About
Posts
20
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • memory leak in CADORecordset?
    T tuxyboy

    Well, I'm using the _variant_t class to have a general solution for getting the values from the recordsetfields, but yes most of the times they are strings, but at that point of the execution I didn't converted them to CString. I also tried without using _variant_t, using VARIANT and BSTR and _bstr_t. Though the place changes I still have memory leaks somewhere. I also have issues with CString Allocbuffer. I'm close to pulling my hair one by one. Have been playing with this for weeks now. These functions are called on a separate thread, I'm using a jobmanager class I wrote. What I was thinking about lately it might by due to threading issues. Or is it general, but others haven't noticed yet? I should build a single threaded test program.

    C / C++ / MFC csharp c++ visual-studio linux performance

  • memory leak in CADORecordset?
    T tuxyboy

    thanks for the reply. I tried that already. Nothing changes. BOOL CADORecordset::GetFieldValue(LPCTSTR lpFieldName, _variant_t& vtValue) { try { vtValue.Clear(); vtValue = m_pRecordset->Fields->GetItem(lpFieldName)->Value; return TRUE; } catch(_com_error &e) { dump_com_error(e); return FALSE; } } I also tried clearing the vtValue in the calling function before GetFieldValue, same thing.

    C / C++ / MFC csharp c++ visual-studio linux performance

  • memory leak in CADORecordset?
    T tuxyboy

    Leakfinder shows memory leak in ADORecordset::Getfieldvalue function the function is called in a loop on a separate thread. BOOL CADORecordset::GetFieldValue(LPCTSTR lpFieldName, _variant_t& vtValue) { try { vtValue = m_pRecordset->Fields->GetItem(lpFieldName)->Value; <-leak return TRUE; } catch(_com_error &e) { dump_com_error(e); return FALSE; } } c:\My Projects\PCSRecord_Plus\Code\Shell\LeakFinder.cpp (903): CMallocSpy::PostAlloc 77573015 (ole32): (filename not available): void * __stdcall CSpyMalloc_Alloc(struct IMalloc *,unsigned long) 77114B52 (OLEAUT32): (filename not available): public: void * __thiscall APP_DATA::AllocCachedMem(unsigned long) 77114C7F (OLEAUT32): (filename not available): _SysAllocStringByteLen@8 77114CF0 (OLEAUT32): (filename not available): _ErrStringCopyNoNull@8 7713D325 (OLEAUT32): (filename not available): _VariantCopy@8 c:\program files\microsoft visual studio\vc98\include\comutil.h (1295): _variant_t::operator= c:\My Projects\PCSRecord_Plus\Code\Client\ADORecordset.cpp (968): CADORecordset::GetFieldValue what do you think?

    C / C++ / MFC csharp c++ visual-studio linux performance

  • Popup menu on cgridctrl
    T tuxyboy

    Thanks, but the submenus work just fine, the main menu doesn't show up. I have a popup menu item as the main menu, which shows up as a blank item, but if I position the mouse over it the submenu show up as it should. Better idea?

    C / C++ / MFC css debugging question

  • Popup menu on cgridctrl
    T tuxyboy

    I need to have a popup menu on the grid, but it doesn't look like it should. The main menu's text isn't shown, only a small blank menu, on the other hand the submenus show up and work properly if I position the cursor above the blank menu. Any idea? WinXP, VC 6.00 SP6 void CGridCtrlDemoDlg::OnGridRClick(NMHDR *pNotifyStruct, LRESULT* /*pResult*/) { NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct; Trace(_T("Right button click on row %d, col %d\n"), pItem->iRow, pItem->iColumn); // To test popup menu CPoint mypoint; GetCursorPos(&mypoint); pM = new CMenu(); pM->LoadMenu(IDR_POPUP); pM->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, mypoint.x,mypoint.y, AfxGetMainWnd()); }

    C / C++ / MFC css debugging question

  • Maximum number of items in listbox
    T tuxyboy

    The first sentence is from MSDN. I use XP, so thought it should work, but it gives incorrect result. getcountex? with listbox? that function doesn't seem to exist on vc++ ...

    C / C++ / MFC question

  • Maximum number of items in listbox
    T tuxyboy

    Windows 95 only: The nItems parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 So above W95 is it supposed to work with let's say app. 60 000 items? Because on XP it doesn't seem to be working correctly. It displays the items, but I also use itemdata pointers. The getcount() doesn't return the correct number of items... Anybody dealt with something similar?

    C / C++ / MFC question

  • Setting Connection TimeOut in ODBC 3.x
    T tuxyboy

    Platform SDK 2003 february has a sample codeat SQLConnect() function, take a look at that!

    C / C++ / MFC help c++ database question

  • Test registered dll
    T tuxyboy

    The case is as follows. The dll's are installed and registered during the app's first install or when a new version is available. BUT when it's not I don't want to call registerserver. I don't know how but it happens sometimes that the already installed files (registered dll's) became unregistered somehow and stop working even if the updater app doesn't touch them, cause there is no new version available. The files are there but unregistered. So I want a method that every time the updatecheck runs it tests all the dll's needed to be registered even if it's not an updatable file, just to be on the safe side.

    C / C++ / MFC windows-admin question announcement lounge

  • Test registered dll
    T tuxyboy

    Is there a way to test if a dll which needs to be registered (either way) is registered correctly on that particular PC? If I don't know the classes, functions it's supposed to expose? I need a general solution for an automatic update feature. I'm thinking about something like getting the dll's classID(s) than search for it in the registry? Anybody ever done something like this?

    C / C++ / MFC windows-admin question announcement lounge

  • MFC Messages
    T tuxyboy

    The event goes to the elemenet that has the focus. Check differences between onchar and onkeydown events....

    C / C++ / MFC c++ debugging question

  • Crystal Reports 9 deployment
    T tuxyboy

    Anybody with experiences in deploying CR9 with an application developed in VC 6.0 please help! I'm pulling my hair out one by one! App should be installed on win98 machines! I'm using CR9 Crystal Report Viewer Control implemented in my app, with printing, exporting functions as well. I build my setup package with Inno. I used all the crystal docs could find in the topic of figuring dependencies. I already have a bunch of files installed. I know the issue with unicows.dll, atl.dll, registering, not registering, etc. When I'm about to show the report in the app, it dies without errormessage. I already have all the files installed that Dependency Walker shows, same mdac, but still doesn't work. I developed the app under XP, but since than I installed the VC 6.0 to a win98 machine as well to check dependencies. Is anybody out there who has something similar working on win98? Might be possible to check file versions... thanks

    C / C++ / MFC help c++ sysadmin question workspace

  • Template specialization with static data member
    T tuxyboy

    I get LNK2005 errors with the static CRuntimeClass datamember of the specialized template Why? I simplified the classes to highlight the problem. TXBase contains special algorithms and also the CRuntimeClass functions and static classTXBase to make RUNTIME_CLASS things work. //////////////////////////////////////////////////////////// // TXView template //////////////////////////////////////////////////////////// #undef CLASS_NAME #define CLASS_NAME classTXView_##BASE template < class BASE > class TXView : public TXBase < BASE > { public: TXView(UINT nIDTemplate = 0); virtual CRuntimeClass* GetRuntimeClass(); static const CRuntimeClass CLASS_NAME; }; template < class BASE > TXView< BASE >::TXView(UINT nIDTemplate /*= 0*/) : TXBase< BASE >::TXBase(nIDTemplate) { } template < class BASE > const CRuntimeClass TXView::CLASS_NAME = { "TXView", sizeof(class TXView), 0xFFFF, TXView::CreateObject, TXView::_GetBaseClass, 0 }; template < class BASE > CRuntimeClass* TXView::GetRuntimeClass() { return (CRuntimeClass*)&TXView::CLASS_NAME; } ///////////////////////////////////////////////////////////////// // Specialized template for FormView ///////////////////////////////////////////////////////////////// #undef CLASS_NAME #define CLASS_NAME classTXView_##CFormView template <> class TXView < CFormView > : public TXBase < CFormView > { public: inline TXView(UINT nIDTemplate = 0); inline virtual CRuntimeClass* GetRuntimeClass(); static const CRuntimeClass CLASS_NAME; }; template <> inline TXView< CFormView >::TXView(UINT nIDTemplate /*= 0*/) : TXBase< CFormView >(nIDTemplate) { } template <> const CRuntimeClass TXView::CLASS_NAME = { "TXView", sizeof(TXView), 0xFFFF, TXView::CreateObject, &TXView::_GetBaseClass, 0 }; template <> inline CRuntimeClass* TXView::GetRuntimeClass() { return (CRuntimeClass*)&TXView::CLASS_NAME; } Thanks if you can help!

    C / C++ / MFC help question

  • Template argument dependent compilation
    T tuxyboy

    I already figured but thanks, anyway. Anybody dealing with the same issue should know to have all the specialized functions inline in the header file if want to get rid of LNK2006 errors..

    C / C++ / MFC help tutorial learning

  • Template argument dependent compilation
    T tuxyboy

    I'm putting together code for a template that implements some special tasks that I need and I want it to use with different CWnd based classes as template argument and ancestor at the same time like this: template < class BASE > class CLASS : public BASE { . . . }; If I want to use it with CFormView and CDialog in the same project I need template argument dependent compiling, 'cause for example if I need to implement OnInitDialog() for CDialog, I must ignore it with CFormView, otherwise I get an error that this function is not the member of the base class. I thought of doing string comparison of the BASE argument at the right places, but I'm not too familiar with macros. #define STR_COMP(_base, _class) \ (strcmp(#_base, _class)==0) and use it as #if STR_COMP(BASE, "CDialog") ..... #else if ... .... #else ... #endif Of course it doesn't work....

    C / C++ / MFC help tutorial learning

  • ERROR_INSUFFICIENT_BUFFER when calling HttpOpenRequest on separate thread
    T tuxyboy

    This code works perfect without exceptions when calling it from the main appthread, but when called on a working thread (AfxBeginThread) httpOpenRequest gives a valid handle and the function works but a bunch of exception occures during the call and afterwards GetLastError returns ERROR_INSUFFICIENT_BUFFER. I know I shouldn't be worried if I get a valid handle but anyway.... Any ideas? code: CONST TCHAR *szAcceptType = TEXT(HTTP_ACCEPT_TYPE); HINTERNET hHTTPRequest = NULL; CHECK_BOOL(NULL != (hHTTPRequest=::httpOpenRequest(hSession, // HTTP session handle HTTP_VERB_HEAD, // HTTP Verb szURI, // Object Name HTTP_VERSION, // Version NULL, // Reference &szAcceptType, // Accept Type INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_KEEP_CONNECTION, NULL))); // context call-back point CHECK_BOOL(hHTTPRequest != INVALID_HANDLE_VALUE); // REPLACE HEADER CHECK_BOOL(::HttpAddRequestHeaders( hHTTPRequest, HTTP_ACCEPT, _tcslen(HTTP_ACCEPT), HTTP_ADDREQ_FLAG_REPLACE)); // SEND REQUEST CHECK_BOOL(::HttpSendRequest( hHTTPRequest, // handle by returned HttpOpenRequest NULL, // additional HTTP header 0, // additional HTTP header length NULL, // additional data in HTTP Post or HTTP Put 0)); // additional data length return hHTTPRequest; CLEANUP: m_dwError=::GetLastError(); #ifdef _DEBUG LPVOID lpMsgBuffer; DWORD dwRet=FormatMessage( FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, GetModuleHandle("wininet.dll"), m_dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast(&lpMsgBuffer), 0, NULL); // Display the string. MessageBox( NULL, (LPCTSTR)lpMsgBuffer, "Error", MB_OK | MB_ICONINFORMATION ); LocalFree(lpMsgBuffer); #endif if (hHTTPRequest) InternetCloseHandle(hHTTPRequest); hHTTPRequest = NULL; return hHTTPRequest;

    C / C++ / MFC help question announcement

  • dsn confusion
    T tuxyboy

    http://support.microsoft.com/kb/q165866/

    Database database help csharp asp-net sql-server

  • ADO 'Background Fetch Size' property VC++
    T tuxyboy

    There is one thing I can't figure out with VC 6.0 & ADO. How can I change the 'Background Fetch Size' (DBPROP_ASYNCFETCHSIZE) property of the recordset running asynchron? It's the number of records retrieved between two fetchprogress events. It's default is 15. It's easy to do it in VB, but in VC++ before opening the recordset, I don't have any dynamic properties available, after executing the SQL the property is read only. I suppose if it's possible in VB it must be possible in VC++ 6.00 as well. I've hard times finding any docs about it even in SDK. As far as I know this OLEDB property is supported by the Cursor Service, which is initilaized when changing cursor to adUseClient. Any idea?

    Database question c++ database

  • Link error
    T tuxyboy

    #include "Libr.cpp" is wrong. Include Libr.h in your Doc.h & include Doc.h in your Doc.cpp

    C / C++ / MFC help c++ question

  • ADO 'Background Fetch Size'
    T tuxyboy

    There is one thing I can't figure out with VC 6.0 & ADO. How can I change the 'Background Fetch Size' (DBPROP_ASYNCFETCHSIZE) property of the recordset running asynchron? It's the number of records retrieved between two fetchprogress events. It's default is 15. It's easy to do it in VB, but in VC++ before opening the recordset, I don't have any dynamic properties available, after executing the SQL the property is read only. I suppose if it's possible in VB it must be possible in VC++ 6.00 as well. I've hard times finding any docs about it even in SDK. As far as I know this OLEDB property is supported by the Cursor Service, which is initilaized when changing cursor to adUseClient. Any idea?

    C / C++ / MFC question c++ database
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups