202 Posted Topics

Member Avatar for abousetta

http://www.cplusplus.com/forum/windows/39170/ but learn more about [recursive functions](http://www.danzig.us/cpp/recursion.html) don't forget the recursive functions are functions that call them selfs, never forget put an if for close them or it can takes several memory or even more problems

Member Avatar for rubberman
0
149
Member Avatar for girmanigatu
Member Avatar for Slavi
0
139
Member Avatar for cambalinho

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

Member Avatar for cambalinho
0
209
Member Avatar for cambalinho

can i create 1 template that i use inside the class and not when i create the class object?

Member Avatar for mike_2000_17
0
157
Member Avatar for cambalinho

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

Member Avatar for cambalinho
0
5K
Member Avatar for cambalinho

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 …

Member Avatar for cambalinho
0
127
Member Avatar for cambalinho

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) { …

Member Avatar for cambalinho
0
236
Member Avatar for cambalinho

//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, …

Member Avatar for cambalinho
0
199
Member Avatar for cambalinho

the function is a std::function<void(string a) write; ok.... it's void.... but why the error about it??? what means these error?

Member Avatar for richieking
0
142
Member Avatar for cambalinho

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) ; …

Member Avatar for Ancient Dragon
0
224
Member Avatar for cambalinho

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?

Member Avatar for Ancient Dragon
0
246
Member Avatar for cambalinho

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?

Member Avatar for cambalinho
0
815
Member Avatar for cambalinho

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 …

Member Avatar for cambalinho
0
153
Member Avatar for cambalinho

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)

Member Avatar for cambalinho
0
292
Member Avatar for cambalinho

hello. my name is joaquim. and i'm new here. thanks for these forum.

Member Avatar for cambalinho
0
187
Member Avatar for cambalinho

see my windows procedure: LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { bool blnMouseEnter=false; switch(msg) { case WM_CLOSE: DestroyWindow(hwnd); break; case WM_KEYUP: if (wParam ==VK_ESCAPE) DestroyWindow(hwnd); else { char strDataToSend[32]; sprintf(strDataToSend, "%c", wParam); MessageBox(NULL,strDataToSend, "keyselected",MB_OK); } break; case WM_MOUSEMOVE: SetWindowText(hwnd,"hi"); break; case WM_MOUSELEAVE://is ignored :( SetWindowText(hwnd,"bye"); break; …

Member Avatar for cambalinho
0
3K
Member Avatar for cambalinho

i'm building a class with std::function for recive several parameters or none: class event2 { public: typedef std::function<void(...)> OnSomethingHandler; void operator() (...) { eventwithoutarg (...); } event & operator = (OnSomethingHandler Handler(...)) { eventwithoutarg(...) = Handler(...); return *this; } private: OnSomethingHandler eventwithoutarg(...); }; what i'm doing wrong with '...'?

Member Avatar for Ancient Dragon
0
7K
Member Avatar for cambalinho

see these sample: template <typename a> class test { test(a argument) { cout << argument; } }; //declare it: int main() { test<string> a("hello"); } how can i do it: test a("hello");

Member Avatar for cambalinho
0
388
Member Avatar for cambalinho
Member Avatar for cambalinho

template <typename a, typename ... b> class events { public: typedef std::function<void( a arg, b ... argx)> OnSomethingHandler; events(OnSomethingHandler Handler) { handlers_.push_back(Handler); } void operator ()() { for(auto i = handlers_.begin(); i != handlers_.end(); ++i) (*i)(); } private: std::vector<OnSomethingHandler> handlers_; void AddHandler(OnSomethingHandler Handler) { handlers_.push_back(Handler); } void TriggerEvents() { for(auto …

Member Avatar for cambalinho
0
794
Member Avatar for cambalinho

the csbi.wAttributes are combinations of '|' operators,... DWORD textcolor = csbi.wAttributes & 0xff0f; DWORD backcolor = (csbi.wAttributes & 0xfff0) >> 4; i understand the 0xff0f is a hexadecimal value(i don't know in decimal), but why these number and not other? can anyone explain to me these 2 calculations? (they are …

Member Avatar for cambalinho
0
176
Member Avatar for cambalinho

i have these code for clear the screen: //clear the Console void Clear(int BackColor=0) { // home for the cursor COORD coordScreen = {0, 0}; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwConSize; // Get the number of character cells in the current buffer if(!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi)) return; dwConSize = csbi.dwSize.X * csbi.dwSize.Y; …

Member Avatar for cambalinho
0
220
Member Avatar for cambalinho

the prototype function is: BOOL WINAPI WriteConsoleOutputAttribute( _In_ HANDLE hConsoleOutput, _In_ const WORD *lpAttribute, _In_ DWORD nLength, _In_ COORD dwWriteCoord, _Out_ LPDWORD lpNumberOfAttrsWritten ); i'm trying use it for the 1st time... what means: "lpNumberOfAttrsWritten [out] A pointer to a variable that receives the number of attributes actually written to …

Member Avatar for cambalinho
0
2K
Member Avatar for cambalinho
Member Avatar for cambalinho

i know use SetConsoleTextAttribute(): SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), ForgC|(BackC<<4) ); (too be honest: i don't have sure if i can avoid the '<<4') i need ask these: can i add it more data and then use it? like: Blink=128 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), ForgC|(BackC<<4) | Blink); and then test if these value is there?

Member Avatar for cambalinho
0
247
Member Avatar for cambalinho

by some reason the TextOut() function don't show me the text:( but see these code: #include <iostream> #include <string.h> #include <windows.h> using namespace std; int main() { HDC a=GetDC(GetForegroundWindow()); cout << GetLastError();//i get 0(no errors) Rectangle(a,3,4,3+80,4+20);//the rectangule is showed TextOut(a,10,10,"hello world",strlen("hello world")); cout << GetLastError();//i get 0(no errors) cin.get(); } …

Member Avatar for cambalinho
0
346
Member Avatar for cambalinho

i have 1 class Multithread, but seems that i have some errors:( #include <process.h> #include <string> using namespace std; class MultiThread { private: void * b; public: void ParameterList(void *c) { b=c; } void Thread(unsigned (__stdcall*) (void *) ) { _beginthreadex(NULL, 0, (__stdcall*) (void *) , b, 0, NULL); } …

Member Avatar for cambalinho
0
466
Member Avatar for cambalinho

can anyone explain to me what is: 'T', 'L', 'wchar_t', 'LPCWSTR' and 'LPCTSTR'? how can i convert strings\char* to these types? (i understand these isn't a tutorial, but i realy need these introdution) or you can give me just a nice link.

Member Avatar for cambalinho
0
146
Member Avatar for cambalinho

imagine these line: cout << "glória vitória"; //glory vitory why instead print 'ó', prints '3/4'(the ascii char)??? changing the console font name, can resolve it?

Member Avatar for cambalinho
0
105
Member Avatar for cambalinho

if C++ isn't a real OOPL, what left? with another words i want study(theory\concepts) the real OOPL. can you give me a link with these information?

Member Avatar for cambalinho
0
390
Member Avatar for cambalinho

on my last topic i didn't recive mails notifications(when someone answer me). how i have sure that i will recive a mail notification on topic?

Member Avatar for cambalinho
0
336
Member Avatar for cambalinho

when i enter on windows, i see the button user name... until here, fine. but when i click it, i get 1 error about user profile. can anyone help me fix it, please?

Member Avatar for cambalinho
0
121
Member Avatar for cambalinho

is there any function(API or something) for get 1ms of precision? i have 1 timer, but i only get 10ms of max.

Member Avatar for cambalinho
0
419
Member Avatar for intelharsh

just for test these: #ifndef DUMMY_H #define DUMMY_H #include <iostream> #include <Magick++.h> #include <zbar.h> #include <highgui.h> #include <cv.h> using namespace std; using namespace zbar; using namespace cv; class dummy{ public: dummy(); }; #endif // DUMMY_H tell me if you don't get any errors

Member Avatar for intelharsh
0
603
Member Avatar for princess.ferolino.1
Member Avatar for kdevesh
Member Avatar for cambalinho
0
231
Member Avatar for Shabazz120

cout print something on console screen. in these case will print '5', because 5.0/2 will be 2.5(because the 1st number will be considered float\double), and multiply by 2 will be 5. anotherthing: the '()' is more important on math than '*'. it's the operations order sequency like math. i hope …

Member Avatar for cambalinho
0
79
Member Avatar for cambalinho
Member Avatar for cambalinho
0
255
Member Avatar for cambalinho

see these class: class test { public: void virtual Created(){} void test() { Created(); } }; class test1 : public test { void Created(); void test1(): test { Created(); } } test1; void test1::Created() { cout << "created test1"; } (these code wasn't tested, but you get the point) can …

Member Avatar for cambalinho
0
196
Member Avatar for cambalinho

class test { virtual void created(){}; //i must do these. //or when i call the function the compiler give me an error test() { void created(); } }test; void test::created() { cout << "hello world"; } these code have 1 error. but how can overrride the created function?

Member Avatar for cambalinho
0
410
Member Avatar for cambalinho

i want build 1 const with std::endl but by some reason isn't accepted:( #define NewLine std::endl i understand the '#define' isn't adviced to be used, but in these case i belive that i can't use the 'const':( what isn't right with that line? error message: "C:\Users\Joaquim\Documents\CodeBlocks\My Class\console.h|170|note: void Console::write(A, B …

Member Avatar for cambalinho
0
249
Member Avatar for cambalinho

i have 1 class: class class1 { void Created(); calss1() { Created(); } } class1; void class1::Created() { cout << "hello"; } imagine that i don't write: void class1::Created() { cout << "hello"; } i get an error. i try these too: class class1 { void Created() { //do nothing …

Member Avatar for cambalinho
0
199
Member Avatar for cambalinho

i build these code. it's very cool: in test.h: class test { private: bool blVisible; int x=0,y=0; public: void Show(); bool Visible() { return blVisible; } void Visible(bool value) { blVisible=value; if (value==true) Show();//call the event } }; in main.cpp: include <iostream> #include "test.h" using namespace std; test a; void …

Member Avatar for cambalinho
0
234
Member Avatar for cambalinho
Member Avatar for cambalinho

the Visual Studio 2010 have 1 way for build properties, in class's. but isn't a portable code:( i'm using GNU\GCC\G++. so don't belive that isn't possible do it in C++;) so anyone can advice me? i was testing these code, but i get problems with char* and i can't use …

Member Avatar for cambalinho
0
334
Member Avatar for k88joshi

i have 1 question: for use dynamic arrays, can i use normal variables instead pointers?

Member Avatar for cambalinho
0
744
Member Avatar for gneisler

because in line 31 you never used an 'if';) do { cout<<"How many days?"<<endl; cin>>days; if (days<0) cout<<"You enter a negative number,please try again."<<endl; }while (days < 0); i hope help you

Member Avatar for cambalinho
0
143
Member Avatar for cambalinho

i'm trying doing a static clas, but i, always get errors... now i have head pain:( class Pessoa2 { private: static string strnome; public: Pessoa2() { strnome="ana"; } void setnome(string value) { strnome=value; } static string getnome() { return strnome; } }; just seen these static class, what i'm doing …

Member Avatar for cambalinho
0
214
Member Avatar for cambalinho

i read several time about Bitwise Right Shift Operator (>>\<<) but i continue without understand them:( can anyone explain to me? i don't undertand what will be the next results:( Half = 25 >> 1; Half = 25 << 1;

Member Avatar for cambalinho
0
391
Member Avatar for cambalinho

//arr is the array int length;//for recive the array size length=sizeof(arr);//recive the array size cout <<length; length=length/sizeof(typeid(arr));//calculate the number of elements cout << sizeof(typeid(arr)); i'm using these code for calculate the number of elements in array. sizeof(typeid(arr)) these line is for give the type size, but isn't correct can anyone …

Member Avatar for cambalinho
0
799

The End.