"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.
mbue
Posts
-
890918 - keystroke seems not to generate the desired command -
renaming filesvoid 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
-
Tab key in WTL ProperySheetPage sounds bell?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.
-
crash related to CString acces violating1.) 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.
-
save image after setting transparencynice: but the doing man builds his own moon. and the wise man learns how others change the world (by me).
-
890918 - keystroke seems not to generate the desired command1.) create an accelerator resource. 2.) load them: _haccel = LoadAccelerator(0,MAKEINTRESOURCE()) 3.) translate them by calling TranslateAccelerator() have a nice day.
-
Save image from picturebox use MFC1.) 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 Casting Problemnormally 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.
-
Application crashes only in release mode (possible heap/stack corruption)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.
-
Methods within methodsvoid 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); }
-
DDX_Control and DDX_TextSubclassing 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.
-
Sir,Can any Help me ,I want to Know For What Generic Reason Will Applications Developed in VC++ Will Crash?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.
-
using bitmap as logo in diaglog-based appyou 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'. -
Can code be given exclusive CPU access in XP?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.
-
DDX_Control and DDX_TextUse your SDK manual. I think DDX_Control subclasses the given control and DDX_Text exchanges the text.
-
using bitmap as logo in diaglog-based appThe 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); }
-
Focusless window - how to make that?No I have no other idea. You can try to disable the window to prevent it from getting focus (
EnableWindow(hwnd,0);
). -
Remove dependency of MSVCP80 and MSVCR80Your denglish is unoverseebar. Try to reencode what they do! But dont be sad - it's easier to do that than understand M$-code.
-
libsIt'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.
-
How to delete a COM objectThis 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.