Posts
 
Reputation
Joined
Last Seen
Ranked #256
Strength to Increase Rep
+10
Strength to Decrease Rep
-2
86% Quality Score
Upvotes Received
79
Posts with Upvotes
74
Upvoting Members
41
Downvotes Received
11
Posts with Downvotes
8
Downvoting Members
10
33 Commented Posts
~384.34K People Reached
Favorite Tags
Member Avatar for cambalinho

@AncientDragon, that event greek looking code is a lambda. It's just a function that will be run when an event occurs. @OP.. WIN32/WINAPI code others are posting would be correct if they took into consideration that Labels (the control you want to paint) is a static control (no insult to …

Member Avatar for pmmarc
0
3K
Member Avatar for adoleh

[CODE] #include <iostream> #include <windows.h> #include <math.h> #include <cmath> #include <string> #include <sstream> using namespace std; int num; int ones_digit; int tens_digit; int main() { cout<<"Enter 1 or 2 digits\n\n"; cin>> num; cin.ignore(); string num2; stringstream out; out << num; num2 = out.str(); num2.length(); ones_digit = num%10; tens_digit = num/10; …

Member Avatar for emsmary
0
16K
Member Avatar for kshahnazari

#include <vector> #include <fstream> #include <cstring> #include <windows.h> bool HDCToFile(const char* FilePath, HDC Context, RECT Area, uint16_t BitsPerPixel = 24) { uint32_t Width = Area.right - Area.left; uint32_t Height = Area.bottom - Area.top; BITMAPINFO Info; BITMAPFILEHEADER Header; memset(&Info, 0, sizeof(Info)); memset(&Header, 0, sizeof(Header)); Info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); Info.bmiHeader.biWidth = Width; Info.bmiHeader.biHeight …

Member Avatar for Tajuddin_1
0
5K
Member Avatar for cambalinho

#include <iostream> #include <windows.h> using namespace std; int main() { //Get Program Files Location. char buffer[256]; ExpandEnvironmentStrings("%ProgramFiles(x86)%", buffer, 256); std::cout<<buffer<<"\n"; //Get Current Executable Location. GetCurrentDirectory(256, buffer); std::cout<<buffer<<"\n"; return 0; }

Member Avatar for cambalinho
0
1K
Member Avatar for Curious Gorge

WinAPI is a nightmare. Boost is also a nightmare of a library. It's super large! Most of the time you don't want certain parts of boost. Secondly, most of boost is actually in C++11, C++14, C++17. I haven't found a use for boost since.. Unless dealing with shared memory and …

Member Avatar for triumphost
0
388
Member Avatar for CreatorZeus

`cout` cannot "replace" `printf` because `printf` has formatting flags.. `cout` does not. You would have to use a modifier or `sprintf` to a buffer then print the buffer using `cout`. Modifiers such as `std::setprecision` would suffice. If you are sure you only want to print 19 characters max, then `std::cout.write(time_buff, …

Member Avatar for triumphost
0
2K
Member Avatar for cambalinho

You cannot write an std::string to a file like that. You also cannot write the image structure to a file like that unless it is a POD structure. std::strings are allocated on the heap internally (usually) and contain constructors and all sorts of internal book keeping. You also cannot READ …

Member Avatar for Herry_1
0
422
Member Avatar for booglaoogla

You have your signs wrong. You also don't use the `and` (`&&`) operator.. You're also missing an `if` statement to make it an `else if`. Other than that, your code would have been fine with Labdabeta's correction. #include <iostream> #include <iomanip> using namespace std; int main() { //variable declarations double …

Member Avatar for triumphost
0
354
Member Avatar for wannas

The below code compiles.. gives only one warning which I cba to fix.. its basically fopen to fopen_s.. u can fix that easily.. its just a compiler warning though. [CODE] // File.cpp #include "header.h" #include <iostream> using namespace std; /* open raw socket, set promiscuous mode */ void init_net() { …

Member Avatar for Mahesh_14
0
5K
Member Avatar for cambalinho

Your copy constructor is missing. Your bitmap is destroyed when assigned. Why? Because you're making a shallow copy by doing `Bitmap& operator = (const Bitmap& bmp);` and when bmp dies, all its resources dies. Thus your bitmap that was passed in is now destroyed or has invalid resources. Secondly, `HICONFromHBITMAP` …

Member Avatar for triumphost
0
657
Member Avatar for cambalinho

You are leaking by calling `GetDC(hwnd)` and not releasing it. DOCINFO di = {sizeof(DOCINFO), "Bitmap Printing"}; HDC pDC = GetPrinterDC(hwnd); int w = GetDeviceCaps(pDC, HORZRES); int h = GetDeviceCaps(pDC, VERTRES); HDC hdcMem = CreateCompatibleDC(pDC); HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, hBitmap); StartDoc(pDC, &di); StartPage(pDC); SetMapMode(pDC, MM_ISOTROPIC); SetWindowExtEx(pDC, w,h, nullptr); SetViewportExtEx(pDC, w, h, …

Member Avatar for cambalinho
0
444
Member Avatar for GeorgiosMeNTUA

@Galperin the above code is horrible. It will also only work for 32-bit bitmaps. It does not handle 24-bit bitmaps which have padding. For that reason, you're going to get a deformed image. The below code will work: #include <iostream> #include <fstream> typedef struct { uint8_t r, g, b, a; …

Member Avatar for triumphost
0
7K
Member Avatar for cambalinho

You need to either double buffer the window/painting OR use a Real-Time-Message-Loop (this option is usually used in OpenGL & Direct-X in combination with a double buffer. It can also be used with a single buffer just fine).. while(true) { while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if(msg.message …

Member Avatar for cambalinho
0
716
Member Avatar for cambalinho

const GUID CLSID_TaskbarList = {0x56FDF344, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90}}; const GUID IID_ITaskbarList = {0x56FDF342, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90}}; const GUID IID_ITaskbarList2 = {0x602D4995, 0xB13A, 0x429b, {0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17}}; const GUID IID_ITaskList3 = {0xEA1AFB91, …

Member Avatar for ipswitch
0
270
Member Avatar for cambalinho

Undefined behaviour. 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; //ADDRESS OF LOCAL VARIABLE! cf.rgbColors = RGB(0,0,0); cf.lpLogFont->lfStrikeOut=FALSE; cf.lpLogFont->lfUnderline=FALSE; cf.lpLogFont->lfHeight=-MulDiv(12, GetDeviceCaps(GetDC(hwnd), LOGPIXELSY), 72); _tcscpy(cf.lpLogFont->lfFaceName, "Arial" ); if(ChooseFont(&cf)) { HFONT hf = CreateFontIndirect(&lf); //HF is unused …

Member Avatar for cambalinho
0
1K
Member Avatar for cambalinho
Member Avatar for jamesjohnson25

If using C++11, there's an `std::to_string` function in the `<string>` header. #include <iostream> #include <string> int main() { std::string occult = "666"; for (int i = 0, n = 2; ; ++i) { if (std::to_string(i).find("666") != std::string::npos) { if (n == 1) { std::cout<<i<<"\n"; } n -= 1; } } …

Member Avatar for vijayan121
0
516
Member Avatar for cambalinho

What do you mean transparent controls? Are you trying to make a button 100% transparent? If that's the case, just hide the control. Are you trying to round a button (transparent corners)? Are you trying to make the button semi-transparent?

Member Avatar for triumphost
0
942
Member Avatar for cambalinho
Member Avatar for rose_2

Question is confusing.. What do you mean "make swapping"? There are many ways to swap two variables.. std::swap(variable_a, variable_b); //OR template<class T> void do_swap(T& a, T& b) { T temp = std::move(a); a = std::move(b); b = std::move(temp); } //OR template<typename T> void do_swap(T& a, T& b) { T temp …

Member Avatar for rose_2
0
226
Member Avatar for cambalinho

**FloodFill** is the algorithm you are looking for. The idea is simple. As long as there is a border around the iris of the eye, you can floodfill the background and it will not affec the iris. However, if there is no border around the iris, then this will fail …

Member Avatar for cambalinho
0
151
Member Avatar for cambalinho

You're invoking the copy assignment operator on a half initialised class. You've never initialised some of the variables in the other constructors that you have. By default they would be 0 or undefined. If you call "Picture" using any one of the constructors that do NOT load a "gif", you …

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

I don't understand the problem at all. What is working and what isn't working? The label seems to be drawn fine in that image.. Give more details on what is wrong with it.

Member Avatar for cambalinho
0
740
Member Avatar for cambalinho

Off-topic: `SendMessage((HWND)lParam , WM_CREATE, wParam, lParam);` WHAT?!.. are you trying to accomplish here?

Member Avatar for cambalinho
0
144
Member Avatar for Mahbeezzy

You "could" use `std::accumulate` (if permitted by your homework assignment) with 1 to 100 and pass it a function tell if it's even or not.

Member Avatar for TObannion
0
188
Member Avatar for amila.dulanjana

What have you tried? Also, this is the C++ section but we can still help.

Member Avatar for amila.dulanjana
-2
94
Member Avatar for cambalinho

Why are you unregistering and registering the hotkey everytime the button is drawn? This looks like an owner drawn button but the question stands..

Member Avatar for cambalinho
0
293
Member Avatar for Search_not

Be VERY careful when using WinAPI's wrapper functions.. Many gcc/g++ implementations define `SendMessage` as `SendMessageA` if `_UNICODE` and `UNICODE` is NOT defined. Otherwise it is defined as `SendMessageW`. You need to either define those for your project OR explicitly use the WideCharacter version of the functions as shown below: //Use …

Member Avatar for Search_not
0
180
Member Avatar for guru.charan.77377

The term you are looking for is called "[OCR](http://en.wikipedia.org/wiki/Optical_character_recognition)".. Optical Character Recognition. A library that may help, would be [OpenCV](http://opencv.org/) (an image recognition library).

Member Avatar for vieru.dorincristian
0
130
Member Avatar for cambalinho

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 therefore an illegal cast. What makes you think you can just cast a `const char*` to a `const wchar_t*`? If …

Member Avatar for cambalinho
0
1K