202 Posted Topics
i have the last update of java, but i'm getting some problems with it :( sometimes works other times don't. only in internet explorer works more or less but not on chrome. can anyone explian to me how can i fix the problem? | |
by several reasons, i must create the static with it's paint message: case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(inst->hwnd, &ps); if(inst->Paint==NULL) { RECT f; GetClientRect(hwnd,&f); HBRUSH s=CreateSolidBrush(inst->clrBackColor); SelectObject(hdc,(HBRUSH)s); if (inst->clrBackColor==-1) { //hide, copy the parent control and show the control again ShowWindow(inst->hwnd,SW_HIDE); BitBlt(hdc,0,0,f.right-f.left,f.bottom-f.top,GetDC(GetParent(inst->hwnd)),inst->intLeft,inst->intTop,SRCCOPY); ShowWindow(inst->hwnd,SW_SHOW); } else FillRect(hdc,&f,s); SetBkMode(hdc,TRANSPARENT); … | |
from reading these site: http://www.catch22.net/tuts/flicker-free-drawing i understand that i must avoid the pixel been changed more than once and a double-buffer: //how avoid the pixel be changed more than once: case WM_ERASEBKGND: return 1; //for other controls, we must use another messsage(see the child control messages) and heres how we … | |
i continue with problems for use a callback function in a class member :( class Timer { private: typedef std::function<void(void)> timerprocedure; timerprocedure tmrprocedure;//can't be static int MilliSecondsTimer; bool blnDestroyed; UINT TimerId; HANDLE Timer1; static void CALLBACK MyTimerProc( HWND hwnd, UINT message, UINT idTimer, DWORD dwTime) { tmrprocedure();//call the lambda timer … | |
i'm very confused and the others forums make me more confused :( i'm using string, so i need convert string to WCHAR*: const size_t len = filename.length() + 1; wchar_t wcstring[len]; swprintf(wcstring, len, L"%s", filename.c_str()); Gdiplus::Image img2(wcstring); the img2 read the file normaly, but i'm creating another Image variable in … | |
i'm trying building a BITMAP from memory, but isn't easy :( //create the button HandleButton=CreateWindowEx (0,"button", "hello\t\tHI", WS_CHILD | WS_VISIBLE | BS_TEXT | BS_BOTTOM |BS_BITMAP, 100, 100,500, 200,hwnd, (HMENU)4000,hInstance, 0) ; //create a dc and bitmap in memory HDC memoryDC =CreateCompatibleDC(GetDC(hwnd)); HBITMAP bitmap=CreateCompatibleBitmap(GetDC(hwnd),500,200); SelectObject(memoryDC, bitmap); //get the icon HandleIcon=(HICON)LoadImage(hInstance,"C:\\acrobat.ico",IMAGE_ICON,SM_CXICON,SM_CYICON,LR_LOADFROMFILE | … | |
how can i build a typedef with variadic operator? what i mean is that i need build these: typedef std::function<void(void)> Event;//works fine, but for any parameters typedef std::function<void(...)> Event; //no errors Event test(int x, int y)=[](int x, int y) { int a=x+y; string b=tostring(a); MessageBox(NULL,b.c_str(),"hello",MB_OK); }; in these sample i … | |
i'm buiding an image class, but i need some information... the C\C++ teach how read binary\text files... but not how the files are build like JPEG, PNG, GIF and others :( i can't find a page for give me the file struture and when i found it, i only see … | |
i'm trying to understand some joystick structure: http://msdn.microsoft.com/en-us/library/windows/desktop/dd757112%28v=vs.85%29.aspx but isn't easy. at least these image help me more(joystick layout): https://onedrive.live.com/?cid=C3EF456E15C8DEB6&id=C3EF456E15C8DEB6!1259&v=3 but i need ask more: 1 - the Hat and X and Y coordenates are the same or they can be programmed in separed ways? 2 - i can't find … | |
i'm creating the form class. the form us showed and the window procedure works. the problem is that some messages(like WM_CREATE) aren't working. so how can i connect, correctly the form to window procedure? | |
i'm build a function for do the combination of keys(like the kombat games: we do some combination keys for do an actions): bool CombineKeys(std::vector<int> const keys) { static bool PreviousKeyPressed; static DWORD StartTimer = GetTickCount(); static int i=0; if((GetAsyncKeyState(keys[0]) & 0x8000) and PreviousKeyPressed==false) { i=0; SetWindowText(a,"hello"); PreviousKeyPressed=true; i++; } else … | |
i'm build a completed new code for properties: #include <iostream> #include <functional> using namespace std; template <typename T> class property { private: T PropertyValue; //i think these is ok, but something seems not std::function<T(void)> getf; std::function<void(T)> setf; public: property() { getf=NULL; setf=NULL; }; property(T value) { PropertyValue=value; }; property(std::function<void(void)> GetFunction=NULL,std::function<T(void)> … | |
my mobile batery is BL-5F: - 950mAh; - 3,7V; - 3,5Wh. the BL-6F: - 1200mAh; - 3,7V; - 4,4Wh. the have the connection in same place. the 6F give me much more time with mobile.. and the Volts are the same. but i'm confused with Wh. it's bad give more … | |
i put an image on form with WM_PAINT message. but the image is, only, showed after resize(for example) the form. why is that? did i forget any style\extended style? | |
heres a nice tutorial about regions: http://www.flipcode.com/archives/Win32_Window_Skinning.shtml like you see, these tutorial is for forms.. so how we can do with child controls!?! we can: add the WS_CLIPCHILDREN or WS_CLIPSIBLINGS style, when we create a button\other control: hwnd = CreateWindowEx( 0, TEXT("CBUTTON"), strCaption.c_str(), WS_CHILD | WS_VISIBLE | BS_TEXT | WS_TABSTOP … | |
heres the code that i use for put the form transparent: LONG style= GetWindowLong(hwnd, GWL_EXSTYLE); style=style | WS_EX_LAYERED; SetWindowLong(hwnd, GWL_EXSTYLE, style); SetLayeredWindowAttributes(hwnd, clrBackColor, NULL, LWA_COLORKEY); but i see problems :( the form and the controls are showed, but the mouse events are ignored. if i click on button or form, … | |
can i declare functions private in header files? imagine that you use a function declared outside the class and you only want be used only by that class... how can i private that function? | |
i'm trying create a class for getting the child controls from it's parent, but without sucess :( class ChildControls { private: vector<HWND> childcontrols; UINT childcontrolsindex; HWND windowparent; public: ChildControls(const HWND parent) { windowparent=parent; //EnumChildWindows(parent, EnumChildProc, 0); } UINT childcontrolscount() { return childcontrolsindex; } HWND GetHWND(UINT index) { EnumChildWindows( windowparent, [this]( … | |
RegisterHotKey is for we use the combined keys and the WM_HOTKEY message. i use these function for use the alt combination... but i need ask: can i re-regist the combination keys? | |
i'm trying call the WM_DRAWITEM message from WM_KEYUP message without sucess :( bool KeyPressed(int a) { if(GetAsyncKeyState(a)) { return true; } else { return false; } } //in WM_KEYUP message if(KeyPressed(VK_MENU)==true) SendMessage(hButton, WM_DRAWITEM,NULL,NULL); what i'm doing wrong with SendMessage? | |
i'm reading these page: http://msdn.microsoft.com/en-us/library/windows/desktop/bb775951%28v=vs.85%29.aspx but see the Remarks section: Remarks For illustrations of the principal button styles such as BS_CHECKBOX and BS_GROUPBOX, see Button Types. The appearance of text or an icon or both on a button control depends on the BS_ICON and BS_BITMAP styles, and whether the BM_SETIMAGE … | |
when we create child controls, what is the style for accept text formats? (i mean: '\t', '\n' and others) | |
using the WM_KEYUP message: how can i combine the keys? if(wParam== VK_CONTROL & 'a') MessageBox(NULL,"hi", "hi",MB_OK); if i click on control key, the message is showed.... but my combination key is ctrl+a.... so how can i combine the keys? :( | |
maybe i'm the 1st seen these problem, maybe i'm not... i noticed before and i didn't make case, but now i'm horry about it... i'm logined from 1h(maybe more) and everytime that answer me, i never recive a mail notification, because i'm logined. i can tested more about it, but … | |
when i use the ownerdraw message, with button(for exemple), do i lose the button face or only the text? (i need show a text and image, without lose the button face) | |
i continue with 1 problem with emails notifications and i have the option selected :( - if i'm log out/off, i recive the mails notifications normaly(new posts and private message); - if i'm log in, i only recive the mails notifications about the private messages :( for see that someone … | |
- the GetWindowRect() give me the window size and position; - the GetClientRect() give me the window size without inclued the scrollbars\menus\borders\others; so when 1 image is more big than client size, what size i can use? DC size? and if a child window position is more big than client … | |
by the book, i read that with WM_SIZE message i can get the client size instead use the GetClientRect() function: case WM_SIZE: GetClientRect (hwnd, &rect) ; VerticalScrollSize=rect.bottom; si.cbSize = sizeof(si); si.fMask = SIF_ALL; GetScrollInfo (hwnd, SB_VERT, &si); si.nMin = 0; si.nPos = VerticalScroll; si.nMax = VerticalScrollSize-2; si.nPage=2; SetScrollInfo (hwnd, SB_VERT, … | |
i'm testing the win32 scrollbars, but i'm with 1 problem: when i use the SB_THUMBPOSITION message, why the window isn't repainted( the WM_PAINT message isn't used)? case WM_VSCROLL: switch (LOWORD (wParam)) { case SB_LINEUP: VerticalScroll-=1; break; case SB_LINEDOWN: VerticalScroll+=1; break; case SB_THUMBPOSITION: VerticalScroll=HIWORD (wParam); break; case SB_PAGEDOWN: VerticalScroll+=10; break; case … | |
"MFC is not a language; it is a native (unmanaged) class library which is a thin wrapper around the Win32 API." now see these header function: void CMyAxUICtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& /*rcInvalid*/) i belive the CMyAxUICtrl is the instance\object name but it's used outside of main function: … | |
the WindowClass.hbrBackground=(HBRUSH) CreateSolidBrush(RGB(0,255,0)); change the all windows backcolor, registed with these class(WindowClasss). and for change the DC\window backcolor we need use WM_ERASEBKGND or other messages for do it(i don't remember how). but the SetDCBrushColor() do the job, right? but seems be ignored :( i'm using it in WM_PAINT messages. can … | |
the DrawText() function is for draw text with a rectangle size. but if the DT_VCENTER is used with DT_SINGLELINE, how can i use the "\n" and "\t" strings formats? | |
i'm learning win32 from Programming Windows Fifth Edition book, but i need ask something about these code: /*−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− SCRNSIZE.C −− Displays screen size in a message box (c) Charles Petzold, 1998 −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−*/ #include <windows.h> #include <tchar.h> #include <stdio.h> int CDECL MessageBoxPrintf (TCHAR * szCaption, TCHAR * szFormat, ...) { TCHAR … | |
i'm using the data control with mask edit box control. when i click on next button, the mask edit box isn't updated. but why show us the 1st element from data? | |
Re: int multi(int a, int b) { return (a*b); } int main() { int a=0; a=multi(20,30); cout <<a; cin.get(); } i hope these help you more;) | |
i have 1 class that have members dependents of the class pointers. when i do the Copy Construtor with assignment operator, how can i use the instance class this, instead copy from 1 instance to another? i don't want 1 instance member be pointed to another instance | |
![]() | Re: 1 - for use getch(), i must include the conio.h ; 2 - you did some mistakes when you inicializade the c-style string: char str[]="Hello World!!"; heres your code correted: #include<stdio.h> #include<conio.h> int main() { char str[]="Hello World!!"; puts(str); printf("\nEnter a new string: "); gets(str); // Is this right ? … |
Re: easy: If e.KeyCode = Keys.Return And e.Alt = False Then e.SuppressKeyPress = True Me.SelectNextControl(Me.ActiveControl, True, True, True, True) End If why i use the Alt key teste? imagine that you need put a new line in textbox ;) anotherthing: use the key down instead keypress... or you can't use some … | |
Re: but you can create instances\objects of structurs, enums, types(int, double...) and others | |
Re: anotherthing: don't forget the compiler read everything by order from top to bottom(inclued that header files). for exemple: if you use 1 function before been created, you will get an error that don't exists or something. "So why shouldn't I put everything in PCHs?" you can make your own headers … | |
using API functions, can i get the text rectangule? | |
i'm learning, by work, how use win32 forms applications. but i'm geting a problem: the label(STATIC class) is give me flickers :( i had tryied use the WS_EX_COMPOSITED but give me problems with WM_MOUSEMOVE message :( someone tell me something about double-buffering, but i only knows use it for images … | |
Re: for now, i have seen several errors: 1 - cout is from std namespace, so after #includes use: using namespace std; 2 - you use a function before create it: DisplayStack(), put these function before is used. i know what you mean, but C\C++ do these by order. 3 - … | |
i did an Empty project(bored... only problems :( ). but can i add a manifest file to exe or the project? | |
i know use the some functions for put an image on window: void setImage(string FileName) { HBITMAP hImage =(HBITMAP) LoadImage(NULL,FileName.c_str(),IMAGE_BITMAP,20,20,LR_LOADFROMFILE); HDC image = CreateCompatibleDC(NULL); SelectObject(image,hImage); BITMAP bitmap; GetObject(hImage,sizeof(BITMAP),&bitmap); BitBlt(GetDC(this->hwnd),0,0,bitmap.bmWidth,bitmap.bmHeight,image,0,0,SRCCOPY); } but i get 2 problems: 1 - the image isn't showed with original size :( ; 2 - after 2 … | |
i'm building a data base.. heres what i did: 1 - create the forms and put the controls; 2 - create the Service-base DataBase(add New Item); 3 - a toolbox, on left, is showed and then i create a new table; 4 - using the mouse right button, i select(on … | |
from VB6, i build these code for transparent: void Transparent() { SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes (hwnd, clrBackColor, 0, LWA_COLORKEY); const char *text; text=to_string( GetLastError()).c_str(); MessageBox(NULL,text,"erro",MB_OK); } but i get 1 error from messagebox: 87:ERROR_INVALID_PARAMETER - The parameter is incorrect. can anyone advice me? | |
how can i get the font of a control? for i change what i need and then select it | |
i'm building the label1 class, but i'm getting bad results... so i ask: how can i use the SetWindowLongPtr() for use a window procedure? (i can show the label and change it's properties... but i'm getting problems for active it's own window procedure :( ) see the entire code\class: #include … |
The End.