-
Gave Reputation to Moschops in how overload != and == operators?
I would advise you that what you've done there with the `!=` operator is very counter-intuitive. The `!=` operator is usually used to test if object1 is the same as … -
Replied To a Post in how overload != and == operators?
i think: if(inst->imgtest != NULL) more easy ;) because test if imgtest have 1 image or not, of course that i can use haveimage() function ;) bool haveimage() { if(btBitmap==NULL) … -
Replied To a Post in how overload != and == operators?
now it's fixed: bool operator != ( nullptr_t ) const { return btBitmap != nullptr; } i must add these function to my class image and now works fine. thanks … -
Replied To a Post in how overload != and == operators?
my objective is testing if the imgtest.btBitmap(is the image HBITMAP) have any image with != operator, just using my image object name. -
Replied To a Post in how overload != and == operators?
if i do these works fine: if((HBITMAP)inst->imgtest!=NULL) but i want avoid the casting... -
Replied To a Post in how overload != and == operators?
Moschops: image.... my own class. see mike post ;) i'm failling with these operator. inst is the control object pointer. so the important thing is the imgtest image object. -
Replied To a Post in how overload != and == operators?
i continue with errors, when i do: if(inst->imgtest!=NULL) i get errors: - "ambiguous overload for 'operator!=' (operand types are 'image' and 'int')" -
Created how overload != and == operators?
i'm trying overload the != and == operators, but i'm getting several errors :( bool operator==(const image &other) const { if(other.btBitmap==*this->btBitmap) return true; else return false; } bool operator!=(const image … -
Began Watching how overload != and == operators?
i'm trying overload the != and == operators, but i'm getting several errors :( bool operator==(const image &other) const { if(other.btBitmap==*this->btBitmap) return true; else return false; } bool operator!=(const image … -
Replied To a Post in [win32] - how can i do the control Autosize?
sorry i don't use MFC. i found some problems with debugging: RECT textrect{0}; int a=DrawText (test->hDC,inst->strCaption.c_str(),-1,&textrect,DT_CALCRECT); int intwidth=0; int intheight=0; if (a==0) MessageBox(NULL,"error","erro", MB_OK); if(textrect.bottom<inst->imgtest.height()) intheight=inst->imgtest.height(); else intheight=textrect.bottom; if(textrect.right>inst->imgtest.width()) intwidth=inst->imgtest.width(); … -
Edited [win32] - how can i do the control Autosize?
how can i do the control autosize? i think in these way: 1 - get the text rect: RECT textrect; int a=DrawText (test->hDC,inst->strCaption.c_str(),-1,&textrect,DT_CALCRECT); (the a isn't zero) 2 - testing … -
Created [win32] - how can i do the control Autosize?
how can i do the control autosize? i think in these way: 1 - get the text rect: RECT textrect; int a=DrawText (test->hDC,inst->strCaption.c_str(),-1,&textrect,DT_CALCRECT); (the a isn't zero) 2 - testing … -
Began Watching [win32] - how can i do the control Autosize?
how can i do the control autosize? i think in these way: 1 - get the text rect: RECT textrect; int a=DrawText (test->hDC,inst->strCaption.c_str(),-1,&textrect,DT_CALCRECT); (the a isn't zero) 2 - testing … -
Replied To a Post in [win32 -GDI] - owner draw controls
anotherthing: why, from DrawThemeIcon(), i only get a black rectangle? -
Gave Reputation to triumphost in [win32 -GDI] - owner draw controls
If you are seeing weird characters, it's most likely because of: `(LPCWSTR) inst->strCaption.c_str()` Seeing this makes me believe that your strCaption is an `std::string` and NOT `std::wstring`. This cast is … -
Created [win32 -GDI] - owner draw controls
i'm owner draw some controls. here what i use for a button: case WM_DRAWITEM: { DRAWITEMSTRUCT *test=(DRAWITEMSTRUCT*) lParam; HIMAGELIST imlIcon=ImageList_Create(inst->imgtest.width(),inst->imgtest.height(),ILC_COLOR,1,1); ImageList_Add(imlIcon,inst->imgtest,NULL); HTHEME hTheme = OpenThemeData(inst->hwnd, L"BUTTON"); //fill the background with … -
Began Watching [win32 -GDI] - owner draw controls
i'm owner draw some controls. here what i use for a button: case WM_DRAWITEM: { DRAWITEMSTRUCT *test=(DRAWITEMSTRUCT*) lParam; HIMAGELIST imlIcon=ImageList_Create(inst->imgtest.width(),inst->imgtest.height(),ILC_COLOR,1,1); ImageList_Add(imlIcon,inst->imgtest,NULL); HTHEME hTheme = OpenThemeData(inst->hwnd, L"BUTTON"); //fill the background with … -
Marked Solved Status for [win32] - SetTimer(): why the windows lost focus stops the timer?
i have 1 class Timer. the class works fine, but when the windows loses the focus, the timer stops... why these happens? -
Replied To a Post in [win32] - SetTimer(): why the windows lost focus stops the timer?
i did a global variable that i change what form have the focus. so i change the GetFeregroundWindow() to that form, and now works fine ;) -
Replied To a Post in [win32] - SetTimer(): why the windows lost focus stops the timer?
i found the problem: is my message loop :( WPARAM MessageLoop() { MSG msgEvents; while(GetMessage(&msgEvents, NULL, 0, 0) > 0) { //if(IsChild(WindowMain,msgEvents.hwnd)==TRUE || WindowMain==msgEvents.hwnd) { if (!IsDialogMessage(GetForegroundWindow(), &msgEvents)) { TranslateMessage(&msgEvents); … -
Replied To a Post in [win32] - SetTimer(): why the windows lost focus stops the timer?
heres how i create the window: oid setParent(HWND parent=GetDesktopWindow()) { if (hwnd==NULL) { WNDCLASSEX FormClass; char classname[20]="Form"; sprintf(classname,"%s",strCaption.c_str()); HINSTANCE mod = (HINSTANCE)GetModuleHandle(NULL); FormClass.cbSize = sizeof(WNDCLASSEX); FormClass.style = CS_VREDRAW | CS_HREDRAW; … -
Edited [win32] - SetTimer(): why the windows lost focus stops the timer?
i have 1 class Timer. the class works fine, but when the windows loses the focus, the timer stops... why these happens? -
Edited [win32] - SetTimer(): why the windows lost focus stops the timer?
i have 1 class Timer. the class works fine, but when the windows loses the focus, the timer stops... why these happens? -
Created [win32] - SetTimer(): why the windows lost focus stops the timer?
i have 1 class Timer. the class works fine, but when the windows loses the focus, the timer stops... why these happens? -
Began Watching [win32] - SetTimer(): why the windows lost focus stops the timer?
i have 1 class Timer. the class works fine, but when the windows loses the focus, the timer stops... why these happens? -
Marked Solved Status for [win32 - notification area] - how can i show a balloon tip?
i can show an icon on notify area: NOTIFYICONDATA NID; //on main NID.cbSize = NOTIFYICONDATA_V2_SIZE; //if i use the NOTIFYICONDATA_V3_SIZE //the compiler enters on conflits NID.hIcon = test2; NID.uCallbackMessage = … -
Gave Reputation to triumphost in [win32 - notification area] - how can i show a balloon tip?
[Notifications and the Notifications Area](https://msdn.microsoft.com/en-us/library/windows/desktop/ee330740(v=vs.85).aspx#notification) It also contains a Sample near the end that you can download and run. -
Replied To a Post in [win32 - notification area] - how can i show a balloon tip?
the szInfo is the key: if is empty the balloon isn't showed. strcpy(NID.szInfo , "hello beaury"); if hBalloonIcon class member give us an error about not be a class member, … -
Replied To a Post in [win32 - notification area] - how can i show a balloon tip?
i'm sorry.... i continue with problems. i don't understand how can i show the balloon :( -
Created [win32 - notification area] - how can i show a balloon tip?
i can show an icon on notify area: NOTIFYICONDATA NID; //on main NID.cbSize = NOTIFYICONDATA_V2_SIZE; //if i use the NOTIFYICONDATA_V3_SIZE //the compiler enters on conflits NID.hIcon = test2; NID.uCallbackMessage = … -
Began Watching [win32 - notification area] - how can i show a balloon tip?
i can show an icon on notify area: NOTIFYICONDATA NID; //on main NID.cbSize = NOTIFYICONDATA_V2_SIZE; //if i use the NOTIFYICONDATA_V3_SIZE //the compiler enters on conflits NID.hIcon = test2; NID.uCallbackMessage = … -
Marked Solved Status for [win32] - when a menu is open(by a timer), how can i refresh the menu?
my image class can read animated gif's. using a timer i can change the menu item image. but when the menu item is showed, how can i refresh it? (i … -
Replied To a Post in [win32] - when a menu is open(by a timer), how can i refresh the menu?
when we move the moouse by items a nice rectangle is showed where is the mouse and hided on last menu item. when these happens the menu item is updated. … -
Replied To a Post in [win32] - can i change the HBITMAP structure for be transparent?
please try with menus. and with gif files(where i see the problem) -
Replied To a Post in [win32] - can i change the HBITMAP structure for be transparent?
i continue with problems. the HBITMAP isn't copyed to HDC: void bitmap(image imgImage) { DeleteObject(outbitmap); BITMAP bm; RECT f={0,0,100,100}; GetObject((HBITMAP)imgImage, sizeof(bm), &bm); HDC DC = GetDC(NULL); HDC MemDCExercising = CreateCompatibleDC(DC); … -
Replied To a Post in [win32] - can i change the HBITMAP structure for be transparent?
sorry i have several mistakes on last code -
Replied To a Post in [win32] - can i change the HBITMAP structure for be transparent?
the image is showed, but not transparent :( void bitmap(image imgImage) { DeleteObject(outbitmap); BITMAP bm; GetObject((HBITMAP)imgImage,sizeof(bm),&bm); HDC DC = GetDC(NULL); HDC MemDCExercising = CreateCompatibleDC(DC); outbitmap=CreateCompatibleBitmap(DC, bm.bmWidth, bm.bmHeight); HBITMAP oldbitmap =(HBITMAP) … -
Replied To a Post in [win32] - can i change the HBITMAP structure for be transparent?
i did i nice way for my label control and works: void DrawHBITMAPtoHDC(HBITMAP hBitmap, HDC hdc) { BITMAP bm; HDC MemDCExercising = CreateCompatibleDC(hdc); HBITMAP oldbitmap =(HBITMAP) SelectObject(MemDCExercising, hBitmap); GetObject(hBitmap,sizeof(bm),&bm); TransparentBlt(hdc, … -
Replied To a Post in [win32] - can i change the HBITMAP structure for be transparent?
sorry, in these case i don't have HDC -
Created [win32] - can i change the HBITMAP structure for be transparent?
can i change the HBITMAP structure for be transparent? because the gif's files are show me a black background color. -
Began Watching [win32] - can i change the HBITMAP structure for be transparent?
can i change the HBITMAP structure for be transparent? because the gif's files are show me a black background color. -
Marked Solved Status for [win32] - how build menu shortcuts?
ok. for use menu shorcuts i must create a table accelerator and change my message loop. but can i process the table accelerator without use the HWND? -
Marked Solved Status for [win32] - how show popup menus?
i have these code for show popupmenus: case WM_USER + 1: { if(lParam==WM_RBUTTONUP) { POINT pCursor; GetCursorPos(&pCursor); HMENU test=GetSubMenu(GetMenu(HandleWindow),0); SetForegroundWindow(HandleWindow); TrackPopupMenu(test, TPM_LEFTBUTTON | TPM_RIGHTALIGN, pCursor.x, pCursor.y, 0, HandleWindow, NULL); PostMessage(HandleWindow, … -
Replied To a Post in [win32] - how show popup menus?
my message loop is wrong: //Message Loop WPARAM MessageLoop() { MSG msgEvents; while(GetMessage(&msgEvents, NULL, 0, 0) > 0) { if(IsChild(GetForegroundWindow(),msgEvents.hwnd)==TRUE || GetForegroundWindow()==msgEvents.hwnd) { if (!IsDialogMessage(GetForegroundWindow(), &msgEvents)) { TranslateMessage(&msgEvents); DispatchMessage(&msgEvents); } … -
Created [win32] - when a menu is open(by a timer), how can i refresh the menu?
my image class can read animated gif's. using a timer i can change the menu item image. but when the menu item is showed, how can i refresh it? (i … -
Began Watching [win32] - when a menu is open(by a timer), how can i refresh the menu?
my image class can read animated gif's. using a timer i can change the menu item image. but when the menu item is showed, how can i refresh it? (i … -
Marked Solved Status for [win32] - getting HBITMAP from HDC and memory leaks
when do: operator HBITMAP() { HBITMAP hbitmap=CreateBitmap(imageweight,imageheight,1,32,NULL);//create the bitmap with icon size SelectObject(hdcimage, hbitmap);//add the bitmap to memory DC MessageBox(NULL,to_string(GetLastError()).c_str(),"error",MB_OK); return hbitmap; } the hdcimage is copyied to hbitmap, right? -
Replied To a Post in [win32] - getting HBITMAP from HDC and memory leaks
everytime we use the new keyword(on constructor) and if we need use it again, we must use the delete: class image { private: ULONG_PTR m_gdiplusToken; Gdiplus::GdiplusStartupInput gdiplusStartupInput; HDC hdcimage=CreateCompatibleDC(NULL); HGDIOBJ … -
Gave Reputation to triumphost in [win32] - getting HBITMAP from HDC and memory leaks
That's a LOT of code just for one simple task: getting an hbitmap from an hdc.. Your code leaks because.. You need lessons in memory management.. Or at least, guidance. … -
Gave Reputation to triumphost in [win32] - getting HBITMAP from HDC and memory leaks
You ARE leaking even if you think you aren't. It might be very slight but by not deleting resources you allocate, you are indeed leaking them. No matter what, you …
The End.