202 Posted Topics

Member Avatar for cambalinho

i'm getting flickers on windows. the windows have CW_USEDEFAULT size and i use the WS_CLIPCHILDREN. on WM_PAINT i use my image class with client rect size. it's big. but not more big than screen. the WM_PAINT: case WM_ERASEBKGND: { return (LRESULT)1;; } break; case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(inst->hwnd, &ps); …

Member Avatar for cambalinho
0
723
Member Avatar for cambalinho

i did a class for tell me what child controls the form have. and another class for tell me the last child control position(more big top and left) inclued the bottom\right. ok. i have the most big X(the last control plus it's width) and: RECT rtcParent; GetClientRect(ActivatedForm,&rtcParent); heres how i'm …

Member Avatar for cambalinho
0
182
Member Avatar for cambalinho

i know get the windows taskbar HWND: HWND GetDesktopToolBar() { return FindWindow("Shell_Traywnd", ""); } now i can do: 1 - add controls on left side(close to Start Button)... but the click messages isn't working. maybe because use the form messages procedure. can anyone correct me?; 2 - enable\visible it. but, …

Member Avatar for ipswitch
0
272
Member Avatar for cambalinho

i'm changind the standard messagebox for add more options. using the hook procedure, i can center to it's parent and the text too. and i added a checkbox(without a window procedure). my question: how can i get the checkbox state? i use SetWindowsHookEx() with WH_CBT flag. can i use with …

Member Avatar for ipswitch
0
80
Member Avatar for cambalinho

heres my function for convert to client using RECT: void ScreenToClient(HWND WindowDestination, RECT *WindowRectangle) { POINT a={WindowRectangle->right, WindowRectangle->bottom}; WindowRectangle->left=0; WindowRectangle->top=0; ::ScreenToClient(WindowDestination,&a); WindowRectangle->right=a.x; WindowRectangle->bottom=a.y; } maybe have some errors too :( void Center() { RECT frm,frmparent; GetWindowRect(GetParent(hwnd), &frmparent); ScreenToClient(GetParent(hwnd),&frmparent); GetWindowRect(hwnd, &frm); ScreenToClient(hwnd,&frm); LONG x=frmparent.right/2 - (frm.right-frm.left)/2; LONG y=100; SetWindowPos(hwnd,0,x,y,0,0, SWP_NOSIZE | …

Member Avatar for ipswitch
0
151
Member Avatar for ddanbe

i agree with Suzie999. the 'const' key word is for avoid that the variable value is changed. good for function parameters(1 time i was getting problems, until i change the parameter(on header function) to const. maybe, when you change the positive\negative values, you realy need the const. but for test …

Member Avatar for ipswitch
0
441
Member Avatar for cambalinho

heres my function for select the font: CHOOSEFONT ShowSelectFont(HWND hwnd=GetForegroundWindow()) { CHOOSEFONT cf = {sizeof(CHOOSEFONT)}; LOGFONT lf; cf.Flags = CF_EFFECTS | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; cf.hwndOwner = hwnd; cf.lpLogFont = &lf; cf.rgbColors = RGB(0,0,0); cf.lpLogFont->lfStrikeOut=FALSE; cf.lpLogFont->lfUnderline=FALSE; cf.lpLogFont->lfHeight=-MulDiv(12, GetDeviceCaps(GetDC(hwnd), LOGPIXELSY), 72);//change font size _tcscpy(cf.lpLogFont->lfFaceName, "Arial" ); //we must include tchar.h if(ChooseFont(&cf)) { …

Member Avatar for cambalinho
0
1K
Member Avatar for cambalinho

i have these function for get the string size: SIZE GetStringSize(string text, HWND hdccontrol=GetForegroundWindow()) { RECT textrect={0}; HDC txthdc=GetDC(hdccontrol); DrawText (txthdc,text.c_str(),-1,&textrect,DT_CALCRECT); ReleaseDC(hdccontrol,txthdc); SIZE a={textrect.right-textrect.left, textrect.bottom-textrect.top}; return a; } the 1st string size isn't correct. then i get the correct one. so why i get, sometimes, the wrong size? something to …

Member Avatar for cambalinho
0
396
Member Avatar for cambalinho

the GetDesktopWindow() give me the desktop HWND, but how can i get the desktop toolbar HWND? i belive that theres 1 function for get the toolbar on windows, but i don't know how :(

Member Avatar for cambalinho
0
157
Member Avatar for cambalinho

my CPU can be 50% or even 100% with online videos(i'm using firefox, but i notice on chrome too). maybe i have the Hadware\Video Acellerator Activated or something. can anyone advice me? - audio seems playing normaly; - video can freezes some frames :(

Member Avatar for y0f4n
0
219
Member Avatar for cambalinho

(i'm using win7) i can use the Region functions for get the transparent control. but, in some cases, i can get bad resoltes(. i have read that i can use brushes for get the transparent control. can anyone explain better?

Member Avatar for triumphost
0
956
Member Avatar for Dave Sinkula

heres a nice books for start and more: C : http://www.tutorialspoint.com/cprogramming/index.htm C variadic functions: http://en.cppreference.com/w/cpp/utility/variadic C++ : http://www.tutorialspoint.com/cplusplus/index.htm (these tutorials can be download from there too) C++ properties: http://www.daniweb.com/software-development/cpp/threads/462365/how-can-i-create-properties C++ events: http://www.astahost.com/info/fttcmp-basic-event-handler-class-familiar-handlers-mimic.html (isn't 100%, but maybe can help someone.. or see my topics) C++ 11 Variadic functions: http://nerdparadise.com/forum/openmic/5712/ not C++11: …

Member Avatar for shahidali6
11
10K
Member Avatar for cambalinho

i have these function for create the tooltip: HWND CreateToolTip(HWND hwndTool, string text) { /*INITCOMMONCONTROLSEX icc; icc.dwSize = sizeof(INITCOMMONCONTROLSEX); icc.dwICC = ICC_BAR_CLASSES | ICC_TAB_CLASSES | ICC_WIN95_CLASSES; InitCommonControlsEx(&icc);*/ if (text=="") { return FALSE; } // Get the window of the tool. //HWND hwndTool = GetDlgItem(hDlg, toolID); // Create the tooltip. g_hInst …

Member Avatar for cambalinho
0
794
Member Avatar for cambalinho

i did several ways and nothing work correctly. i have 2 controls: 1 - label: with an animation; 2 - the tooltip is showed on top until the label is re-painted. so is there another way for put the control, always, on top?

Member Avatar for cambalinho
0
227
Member Avatar for cambalinho

see my property constructor: template <typename T> class property { private: T PropertyValue; std::function<T(void)> getf; std::function<void(T)> setf; public: property(const T &value) { getf=nullptr; setf=nullptr; PropertyValue=value; } property(const property &value) : PropertyValue(value.PropertyValue) , getf(value.getf) { } property(std::function<T(void)> GetFunction=nullptr,std::function<void(T)> SetFunction=nullptr) { setf=SetFunction; getf=GetFunction; } inside a class i have 2 functions: void …

Member Avatar for cambalinho
0
192
Member Avatar for cambalinho

i have 1 pen drive, that is my network. how can i disable, these pen(but not all pens) or program been automatic executed? (the windows connect to network automatic, so i don't need the program been executed)

Member Avatar for Kelly Burby
0
354
Member Avatar for cambalinho

from MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/dd145213%28v=vs.85%29.aspx "An application returns zero if it processes this message." see these code on my label control: case WM_PAINT: { PAINTSTRUCT test; BeginPaint(inst->hwnd, &test); image imglabel(inst->imgtest.width(),inst->imgtest.height()); brush brshbackcolor(inst->clrBackColor); imglabel.Backcolor=inst->clrBackColor; brush brshTransparent; FillRect(imglabel,&test.rcPaint,brshbackcolor); if(inst->imgtest.haveimage()) DrawHICONtoHDC(imglabel, inst->imgtest); imglabel.DrawText(inst->strCaption); pen penColor(1,2,RGB(0,255,0)); penColor.ToDC(imglabel); imglabel.DrawRectangle(10,10,10,10); pen penColor2(1,2,RGB(255,0,0)); penColor2.ToDC(imglabel); imglabel.DrawLine(0,0,20,20); pen penColor3(1,2,RGB(0,0,255)); penColor3.ToDC(imglabel); //brshTransparent.ToDC(imglabel); …

Member Avatar for BeautyBeast
0
335
Member Avatar for cambalinho

i belive that my brother found a virus\spyware. i even formated the laptop and continues there :( my problem is: the help window is allways opening. i have problems using the laptop :( ca anyone help me?

Member Avatar for cambalinho
0
217
Member Avatar for William_10
Member Avatar for cambalinho

my Region bitmap way uses the CreateRectRgn() and CombineRgn() functions. my question is: is more faster use the CreatePolygonRgn() with POINT array object?

0
61
Member Avatar for cambalinho
Member Avatar for cambalinho
0
111
Member Avatar for cambalinho

why WS_CLIPCHILDREN style don't let the child control been clear? the WS_CLIPCHILDREN style avoid the flickers. but don't let clear the control :( why i can't clear the control(before WM_PAINT message)?

0
70
Member Avatar for cambalinho

i have notice that using the joyGetPosEx() function, when the joystick isn't connected, that the memory, that the application uses, is increasing. so is there another way just for see if 1 joystick is connected to pc?

Member Avatar for cambalinho
0
580
Member Avatar for cambalinho

how send a message with WM_DRAWITEM message? heres my actual code on parent window: case WM_DRAWITEM: { DRAWITEMSTRUCT *test=(DRAWITEMSTRUCT*) lParam; /*if(test->CtlType==ODT_MENU) { MENUITEMINFO menuInfo; menuInfo.cbSize = sizeof(MENUITEMINFO); menuInfo.fMask=MIIM_DATA; if(GetMenuItemInfo((HMENU)test->hwndItem,(UINT) test->itemID, TRUE, &menuInfo )!=0) { Menu *mMenu = (Menu *) menuInfo.dwItemData; if(mMenu!=NULL) if(mMenu->DrawItem!=NULL) //mMenu->DrawItem(); else { } } } else { …

Member Avatar for cambalinho
0
402
Member Avatar for cambalinho

think in these way: the eyes have the blue color, the backcolor is blue. so how can i change the backcolor without change the image\eye? (these is just an exemple for trying explain)

Member Avatar for cambalinho
0
153
Member Avatar for cambalinho

heres my image class: class image { private: ULONG_PTR m_gdiplusToken; Gdiplus::GdiplusStartupInput gdiplusStartupInput; HDC hdcimage=CreateCompatibleDC(NULL); HGDIOBJ obj=NULL; HBITMAP btBitmap=NULL; Image *img; bool isimgused=false; int imageheight=0; int imageweight=0; int framecount=0; int intSelectFrame=0; int framedelay=0; string strfilename=""; Gdiplus::Color clrBackColor=Gdiplus::Color::Transparent; HDC hdcwindow; bool blnTransparent=true; HICON HICONFromHBITMAP(HBITMAP bitmap) { BITMAP bmp; GetObject(bitmap, sizeof(BITMAP), &bmp); HBITMAP …

Member Avatar for Schol-R-LEA
0
299
Member Avatar for cambalinho

i have advertisement problem. please see these image: https://onedrive.live.com/?cid=C3EF456E15C8DEB6&id=C3EF456E15C8DEB6!1268&v=3 how can i write if the advertisements are on front of little code window? thanks for all

Member Avatar for Dani
0
176
Member Avatar for cambalinho

finally i have the static control transparent: //creating the form: hwnd = CreateWindowEx(0, classname, strCaption.c_str(),WS_OVERLAPPEDWINDOW | WS_TABSTOP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, mod, this); //sending a message for subclassing: case WM_CTLCOLORSTATIC: { return DefWindowProc(HandleWindow, msg, wParam, lParam); } break; //heres how i create a static control with ownerdraw style: …

Member Avatar for cambalinho
0
756
Member Avatar for cambalinho

heres my image class: class image { private: ULONG_PTR m_gdiplusToken; Gdiplus::GdiplusStartupInput gdiplusStartupInput; HDC hdcimage=CreateCompatibleDC(NULL); HGDIOBJ obj=NULL; HBITMAP btBitmap=NULL; Image *img; bool isimgused=false; int imageheight=0; int imageweight=0; int framecount=0; int intSelectFrame=0; int framedelay=0; string strfilename=""; Gdiplus::Color clrBackColor=Gdiplus::Color::Transparent; HDC hdcwindow; bool blnTransparent=true; HICON HICONFromHBITMAP(HBITMAP bitmap) { BITMAP bmp; GetObject(bitmap, sizeof(BITMAP), &bmp); HBITMAP …

Member Avatar for cambalinho
0
302
Member Avatar for cambalinho

the control have the WS_TRANSPARENT style. and: case WM_ERASEBKGND: { return TRUE; } break; case WM_CTLCOLORSTATIC: { return (LRESULT)GetStockObject(NULL_BRUSH); } break; case WM_DRAWITEM: { DRAWITEMSTRUCT *test=(DRAWITEMSTRUCT*) lParam; image imglabel(test->rcItem.right-test->rcItem.left,test->rcItem.bottom-test->rcItem.top); if(inst->blnTransparent!=true) FillRect(test->hDC,&test->rcItem, CreateSolidBrush(inst->clrBackColor)); else FillRect(test->hDC,&test->rcItem,(HBRUSH) GetStockObject(NULL_BRUSH)); FillRect(imglabel,&test->rcItem,CreateSolidBrush(inst->clrBackColor)); if(inst->imgtest.haveimage()) DrawHICONtoHDC(imglabel, inst->imgtest,1,1); SetBkMode(imglabel,TRANSPARENT); char *text=(char*)inst->strCaption.c_str(); SetTextColor(imglabel,inst->clrTextColor ); DrawTextEx(imglabel,text,-1,&test->rcItem,DT_LEFT,NULL); if(inst->blnBorder==true) DrawEdge(imglabel, &test->rcItem,BDR_SUNKENINNER | BDR_RAISEDOUTER,BF_RECT); …

0
105
Member Avatar for cambalinho

when the form is activated: case WM_ACTIVATE: { if (wParam==WA_INACTIVE) { SetWindowText(inst->hwnd,"unactivated"); FormActivated = NULL; } else { SetWindowText(inst->hwnd,"activated"); FormActivated = inst->hwnd; } return 0; } break; when i create the timer: case WM_CREATE: { if(WindowMain == NULL || WindowMain ==GetDesktopWindow()) { WindowMain = HandleWindow; } SetTimer(inst->hwnd,JoystickTimer,150,NULL); SetTimer(inst->hwnd,KeyBoardTimer,150,NULL); SendMessage((HWND)lParam , …

Member Avatar for cambalinho
0
146
Member Avatar for cambalinho

the RegisterHotKey() is limited? everytime that i create a button control the RegisterHotKey() id isn't the same. //on constructor: ++ButtonCount; altmessage=ButtonCount; now the hotkey message: case WM_HOTKEY: { if (wParam==inst->altmessage) { SendMessage(inst->hwnd,WM_COMMAND,BN_CLICKED,lParam); } } break; and now how i regist the hot key: case WM_DRAWITEM: { DRAWITEMSTRUCT *test=(DRAWITEMSTRUCT*) lParam; UnregisterHotKey(inst->hwnd,inst->altmessage); …

Member Avatar for cambalinho
0
295
Member Avatar for cambalinho

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 &other) const { return !(*this == other); } what i'm doing wrong?

Member Avatar for cambalinho
0
289
Member Avatar for cambalinho

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 the rectangle with image size: if(textrect.bottom<inst->imgtest.height()) inst->intHeight=inst->imgtest.height(); if(textrect.right<inst->imgtest.width()) inst->intWidth=inst->imgtest.width(); 3 - change the control size: SetWindowPos(inst->hwnd, 0, 0, 0, inst->intWidth, …

Member Avatar for cambalinho
0
203
Member Avatar for cambalinho

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 button face color FillRect(test->hDC, &test->rcItem,(HBRUSH) GetSysColor(COLOR_BTNFACE)); if ( test->itemState & ODS_SELECTED) // If it is pressed { DrawEdge(test->hDC,&test->rcItem,EDGE_SUNKEN,BF_RECT); // Draw …

Member Avatar for cambalinho
0
1K
Member Avatar for cambalinho

i have 1 class Timer. the class works fine, but when the windows loses the focus, the timer stops... why these happens?

Member Avatar for cambalinho
0
292
Member Avatar for cambalinho

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 = WM_USER + 1; NID.hWnd = a; NID.uID = 01; NID.uVersion=4; NID.uTimeout=500; NID.dwInfoFlags = NIIF_INFO; strcpy(NID.szInfoTitle, "Test Title"); //NID.hBalloonIcon=(HICON)test2;//no member strcpy(NID.szTip, …

Member Avatar for cambalinho
0
834
Member Avatar for cambalinho

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 have tryied the DrawMenuBar() and SetMenu() without sucess. the image is, only, updated when i move the mouse from 1 …

Member Avatar for cambalinho
0
217
Member Avatar for cambalinho

can i change the HBITMAP structure for be transparent? because the gif's files are show me a black background color.

Member Avatar for triumphost
0
2K
Member Avatar for cambalinho

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, WM_NULL, 0, 0); } } break; the menu is showed normaly, but why the click message isn't working? heres the …

Member Avatar for cambalinho
0
206
Member Avatar for cambalinho

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?

Member Avatar for cambalinho
0
3K
Member Avatar for cambalinho

i did these function for uppercase: string Upper(string text) { string result; result.resize(text.size()); for(int i=0; i<text.size(); i++) { if(text[i]>96 && text[i]<123) result[i]= text[i]-32; result[i]=text[i]; } return result; } but i'm getting the wrong results :( what i'm doing wrong?

Member Avatar for sneekula
0
343
Member Avatar for cambalinho

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?

Member Avatar for cambalinho
0
415
Member Avatar for cambalinho
Member Avatar for cambalinho

i'm using the HiliteMenuItem() for test if the mouse is above the menu item: int i=0; for(i=0; i<GetMenuItemCount(menuhandle); i++) { if(HiliteMenuItem(HandleWindow,menuhandle,i,MF_BYPOSITION) == true) { menuposition=(UINT)i; break; } } but i always get the number 0. heres how i detect the menu handle: case WM_INITMENUPOPUP: { menuhandle=(HMENU)wParam; return 0; } break; …

Member Avatar for cambalinho
0
538
Member Avatar for cambalinho

i'm haviing problems with my windows 7. i do some downloads and they stop before been finished :( even the microsoft essencials isn't updated :( what is going on with my OS? what isn't right?

Member Avatar for RobertHDD
0
126
Member Avatar for cambalinho

i did 1 code for give me the menu position. but i'm getting problems compare the LPSTR or LPCSTR with string :( int GetMenuPosition(HMENU menu, string caption) { int i=0; for(i=0; i<GetMenuItemCount(menu)-1;i++) { MENUITEMINFO s= {0}; s.cbSize=sizeof(MENUITEMINFO ); s.fMask=MIIM_STRING; s.cch=strlen(strCaption.c_str()); //s.dwTypeData=(LPSTR)strCaption.c_str(); GetMenuItemInfo (menu,i, true, &s); string b=static_cast<char*>(s.dwTypeData); if(b==caption) break; } …

Member Avatar for cambalinho
0
864
Member Avatar for cambalinho

i did these menu class: class Menu { private: static int intID; int ID=0; bool primeiromenu=false; HMENU MenuHandle=NULL; HMENU hMenu=NULL; int menuposition=0; string strCaption=""; public: Menu(string caption="&Menu",HMENU subtmenu=NULL, HWND MainHWND=WindowMain) { intID=intID+1; ID=intID; if(caption!="-") caption=(string)caption + " " + to_string(ID); strCaption=caption; if(GetMenu(MainHWND)==NULL) hMenu = CreateMenu(); else hMenu =GetMenu(MainHWND); if (subtmenu==NULL) …

Member Avatar for cambalinho
0
676
Member Avatar for cambalinho
Member Avatar for cambalinho
1
216
Member Avatar for cambalinho

i did the Get macro and works fine: #define Get(x) [this]()->x (like you see it's a lambda function header) but i see 1 problem(sample): Get(int) like you see the type is inside of the macro function :( but i need it: int Get() can anyone advice me for do these …

Member Avatar for cambalinho
0
137

The End.