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
M

mbue

@mbue
About
Posts
51
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 890918 - keystroke seems not to generate the desired command
    M mbue

    "so u mean my defined accelerator is not loaded or is not translated?" yes indeed - set a breakpoint at the TranslateMessage of the base class. enshure your accelerators are loaded. it seems only the predefined accelerators will work. good luck.

    C / C++ / MFC help question

  • renaming files
    M mbue

    void txt2cpp(const TCHAR* path) { TCHAR full[_MAX_PATH+_MAX_FNAME]; TCHAR move[_MAX_PATH+_MAX_FNAME]; unsigned int flen; unsigned int mlen; HANDLE hf; WIN32_FIND_DATA fd; _tcscpy(full,path); flen = _tcslen(full); _tcscpy(full+flen,_T("\\*.txt")); hf = FindFirstFile(full); if(INVALID_HANDLE_VALUE!=hf) { do { if(!(FILE_ATTRIBUTE_DIRECTORY & fd.dwFileAttributes)) { _tcscpy(full+flen+1,fd.cFileName); _tcscpy(move,full); mlen = _tcslen(move); for(;(0

    ATL / WTL / STL c++ question

  • Tab key in WTL ProperySheetPage sounds bell?
    M mbue

    i'm not so familar with wtl - but it sounds cause the IsDialogMessage() function is callin' twice. override the TranslateAccelerator function to set the focus by your own. because windows cannot (will) set focus among nested dialogs. but i'm not shure if there isn't a possibility to do that on another way.

    ATL / WTL / STL c++ visual-studio design question

  • crash related to CString acces violating
    M mbue

    1.) c!=c++ 2.) c++ has a destructor and constructor that initializes the vtable too. 3.) c++ has not a realloc it knows only new and delete (its a immanent failure of c++) 4.) if you realloc an array of classes and they have virtual functions (ie. virtual void doanything(); ) you MUST call the constructor by yourself (and the destructor too). 5.) how to do: for(i=last_valid_element+1;istruct_X::struct_X(); 5a) remember: struct is in c++ the same as class. 6.) destructor for all elements or delete [] ptrX2 ( calls implicit (ptrX2+i)->struct_X::~struct_X(); ) so far and nice day.

    ATL / WTL / STL help tutorial question

  • save image after setting transparency
    M mbue

    nice: but the doing man builds his own moon. and the wise man learns how others change the world (by me).

    C / C++ / MFC graphics question

  • 890918 - keystroke seems not to generate the desired command
    M mbue

    1.) create an accelerator resource. 2.) load them: _haccel = LoadAccelerator(0,MAKEINTRESOURCE()) 3.) translate them by calling TranslateAccelerator() have a nice day.

    C / C++ / MFC help question

  • Save image from picturebox use MFC
    M mbue

    1.) width != byte_width! byte_width == (width*(bitsperpixel/8)+3)&~3 (4byte boundary) 2.) call GetBitmapBits to get the bitmap content before save. have a nice day.

    C / C++ / MFC help c++ graphics tutorial question

  • C Casting Problem
    M mbue

    normally c-compilers cast from left to right (implicit). if yours don't - cast yourself (explicit): positionData.msgPosLat = (int)(lat/(BEARING_SCALING * 180.0)); // (int)(double/(double*double)) AND lat = ( (double)positionData.msgPosLat * (BEARING_SCALING * 180.0)); // (double*(double*double)) // hint: don't define twice (BEARING_SCALING) have a nice day.

    C / C++ / MFC help question

  • Application crashes only in release mode (possible heap/stack corruption)
    M mbue

    1.) you can compile a release with the option 'generate debug info' too. 2.) insert beeps or log-infos to localize the buggy code position. 3.) initialize all memory allocated by zero also static and local member. 4.) enshure you don't write beyond allocated memory. 5.) the debug version: checks memory (allocating more than neccessary and fill them with special values). also debug: checks the stack integrity. 6.) use the same compiler/linker options for release same as debug. 7.) turn on multithreading option.

    C / C++ / MFC csharp visual-studio debugging c++ design

  • Methods within methods
    M mbue

    void SortUI(unsigned int* array,const unsigned int count) { typedef struct{ static int cmp(const void *a, const void *b){ return *(int*)a-*(int*)b; } }_; qsort(array,count,sizeof(unsigned int),_::cmp); } void SortSTR(TCHAR** array,const unsigned int count) { typedef struct{ static int cmp(const void *a, const void *b){ return _tcscmp(*(TCHAR**)a,*(TCHAR**)b); } }_; qsort(array,count,sizeof(TCHAR*),_::cmp); } void SortDF(double* array,const unsigned int count) { typedef struct{ static int cmp(const void *a, const void *b){ return *(double*)a<*(double*)b?-1:(*(double*)a>*(double*)b?+1:0); } }_; qsort(array,count,sizeof(double),_::cmp); }

    Clever Code css question

  • DDX_Control and DDX_Text
    M mbue

    Subclassing in this case is: to attach the control or window to a given class (for instance: CButton). This class will handle all events for that window.

    C / C++ / MFC question

  • Sir,Can any Help me ,I want to Know For What Generic Reason Will Applications Developed in VC++ Will Crash?
    M mbue

    To find the line whre your application crashes you can find out if you build your app in debug mode. At tis time your system will start your debugger at the line your code crashes. But sometimes application crashes only in release therefore you have to insert some debug messages into your code for example Beep or MessageBox. Most crash's causes of not initialized variables therefore you have to initialize all members with valid values.

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

  • using bitmap as logo in diaglog-based app
    M mbue

    you have to modify your code for using MFC: CPaintDC dc(this); HDC mdc; HGDIOBJ obmp; BITMAP bmi; if((HBITMAP)m_hbmp && ::GetObject(m_hbmp,sizeof(bmi),&bmi)) { mdc = ::CreateCompatibleDC(dc.m_hDC); obmp = ::SelectObject(mdc,m_hbmp); ::BitBlt(dc.m_hDC,offsetx,offsety,bmi.bmWidth,bmi.bmHeight,mdc,0,0,SRCCOPY); ::SelectObject(mdc,obmp); ::DeleteDC(mdc); } Please mark your code as 'code'.

    C / C++ / MFC help graphics

  • Can code be given exclusive CPU access in XP?
    M mbue

    No. Since OS's uses protected mode a program cannot use the processor exclusive (this is not a windows behavior). The function EnterCriticalSection can be used to protect code from reentering in another thread not for exclusive execution on the processor.

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

  • DDX_Control and DDX_Text
    M mbue

    Use your SDK manual. I think DDX_Control subclasses the given control and DDX_Text exchanges the text.

    C / C++ / MFC question

  • using bitmap as logo in diaglog-based app
    M mbue

    The assert comes from the previous selected bitmap in your memory DC - 'm_hBmpOld' is null. To display a bitmap you have to paint it OnPaint() not to select it to an DC (DisplayContext). HDC mdc; HGDIOBJ obmp; BITMAP bmi; if(m_hbmp && GetObject(m_hbmp,sizeof(bmi),&bmi)) { mdc = CreateCompatibleDC(hdc); obmp = SelectObject(mdc,m_hbmp); BitBlt(hdc,offsetx,offsety,bmi.biWidth,bmi.biHeight,mdc,0,0,SRCCOPY); SelectObject(mdc,obmp); DeleteDC(mdc); }

    C / C++ / MFC help graphics

  • Focusless window - how to make that?
    M mbue

    No I have no other idea. You can try to disable the window to prevent it from getting focus (EnableWindow(hwnd,0);).

    C / C++ / MFC help c++ com tutorial question

  • Remove dependency of MSVCP80 and MSVCR80
    M mbue

    Your denglish is unoverseebar. Try to reencode what they do! But dont be sad - it's easier to do that than understand M$-code.

    C / C++ / MFC question announcement

  • libs
    M mbue

    It's a very unusual question. But i can be wrong. Don't panic to link all the default .lib's. There is no more code as you use (DevStudio does so). But further you can remove all .lib's and bind only libs you want. Sample: #pragma comment ( lib, "XYZ" ) // thats what i do M$ itselves has prepared a .csv file to examine what .lib you need. You can find it at: \MSDEV\LIB\WIN32API.CSV oder \Microsoft Visual Studio\VC98\Lib\WIN32API.CSV and so on.

    C / C++ / MFC debugging question

  • How to delete a COM object
    M mbue

    This was only a basically introduction how COM works. If you use abstract classes (your class is derived from) its not necessary to implement the basic functions again (from IUnknown). If you use C# you should never do that except you need it anyway. Remember the example is reduced to the native and also don't work outside inproc environments! Sorry it's only to understand the mechanism.

    COM com testing csharp c++ beta-testing
  • Login

  • Don't have an account? Register

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