179 Topics
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? | |
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 | |
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 … | |
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 … | |
when we overloading a function: what matters is only the argument list(inclued the types) or the return type too? i'm overloading the assigment operator, but seems that i can't use with diferent return types:( please someone explain to me | |
can i create 1 template that i use inside the class and not when i create the class object? | |
cout << *static_cast<int*>(test); test is a void pointer pointed to an int variable. if i use: cout << *static_cast<char*>(test); i get just 1 character. so how can i print the value directly to string? if i use the string i get an memory error | |
i know: - &varname is the adress of varname; - *varname is the value of adressed variable. but: void *Vvariant=NULL; friend ostream& operator <<(ostream &os,const variant2 &obj) { os << obj.Vvariant; //how can i get the value of adressed variable? return os; } how can i get the value of … | |
heres my variant class: // *** ADDED BY HEADER FIXUP *** #include <cstdlib> #include <iostream> #include <string> // *** END *** #ifndef VARIANT_H_INCLUDED #define VARIANT_H_INCLUDED class variant { string a=""; public: variant (string value="") { a=value; } variant (double value) { a=to_string(value); } friend istream& operator >>(istream &is,variant &obj) { … | |
//write void write() { setlocale(LC_ALL, "en_US.UTF-8"); cout <<""; } template <typename A, typename ...B> void write(string argHead, B... argTail) { setlocale(LC_ALL, "en_US.UTF-8"); if (blnBlink==true) { CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); string a; a=argHead; TextBlink(a, csbi.dwCursorPosition.X, csbi.dwCursorPosition.Y,csbi.wAttributes); COORD Position; Position.X=csbi.dwCursorPosition.X+strlen(a.c_str()); Position.Y=csbi.dwCursorPosition.Y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),Position); } else cout << argHead; write(argTail...); } template <typename A, … | |
the function is a std::function<void(string a) write; ok.... it's void.... but why the error about it??? what means these error? | |
i understand that the macro is a code that is changed before compile it. so i did these macro with these code: #define (events2((y),(x))) (class events3 : public ( y ) { events3(); ~events3(); }(x) ; ) //#define (events2((y),(x))) (class events3 : public ( y ) { events3(); }(x) ; … | |
see these class: class test { public: void Created(){}; test() { Created(); } }; now we can create objects from it. ok. but can i overloading the scope-resolution ('::') for the object accept and change the Created() function? | |
when we create the window, we can choose some styles. but i see 2 problems: - how can i hide the border?(i have seen the msdn styles, but theres no const for that) - how can i change the styles after create the window? | |
i'm learning win32 from: http://www.winprog.org/tutorial/start.html but tell me(because i ear several persons) is these function correct? LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; } the DefWindowProc() is … | |
how can i test if the wheel move was negative or positive? i belive these detect the mouse position: xPos = GET_X_LPARAM(lParam); yPos = GET_Y_LPARAM(lParam); but how can i test if any key(like alt\control\shift) was pressed? (i'm talking in same message) | |
The End.