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
~388.77K People Reached
Favorite Tags

462 Posted Topics

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
392
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
458
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
357
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
661
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
451
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
723
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
272
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
520
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
956
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
229
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
153
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
299
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
756
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
146
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
192
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
97
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
295
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
183
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
132
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
Member Avatar for cambalinho

[Notifications and the Notifications Area](https://msdn.microsoft.com/en-us/library/windows/desktop/ee330740(v=vs.85).aspx#notification) It also contains a Sample near the end that you can download and run.

Member Avatar for cambalinho
0
834
Member Avatar for malcolmsand

I don't understand what problem you are having doing this.. What have you tried :S The solution is below: //Get the text from box 1. int len = GetWindowTextLength(TextBox) + 1; char* text = new char[len]; GetWindowText(TextBox, &text[0], len); //Append the text to box 2. SendMessage(TextField, EM_SETSEL, -1, -1); SendMessage(TextField, …

Member Avatar for triumphost
0
9K
Member Avatar for cambalinho

The first thing you need to do is select the `HBITMAP` into a `MemoryDC`. Then you cna use the `AlphaBlend` function to draw it to the `WindowDC`. If the `MemoryDC` is NOT compatible with the `WindowDC`, this will fail! In that case, you can use `CreateCompatibleBitmap(WindowDC, width, height)`, copy the …

Member Avatar for triumphost
0
2K
Member Avatar for cambalinho

Have you tested your code? The way I do it is: HBITMAP hBmp = reinterpret_cast<HBITMAP>(GetCurrentObject(DC, OBJ_BITMAP));

Member Avatar for cambalinho
0
3K
Member Avatar for cambalinho

There's multiple ways to do it.. First the manual way: 1: union KeyState { LPARAM lparam; struct { unsigned nRepeatCount : 16; unsigned nScanCode : 8; unsigned nExtended : 1; unsigned nReserved : 4; unsigned nContext : 1; unsigned nPrev : 1; unsigned nTrans : 1; }; }; LRESULT CALLBACK …

Member Avatar for triumphost
0
780
Member Avatar for cambalinho

After you do the `WM_MENUITEMPOPUP`, go through that menu and check with GetMenuState: http://msdn.microsoft.com/en-us/library/windows/desktop/ms647982(v=vs.85).aspx If it returns: `MF_HILITE`, the mouse is over that item.

Member Avatar for cambalinho
0
538
Member Avatar for senergy

You need to create a Real-Time-Message-Loop as done in Direct-X. See: http://www.directxtutorial.com/Lesson.aspx?lessonid=9-1-4 while(true) { while(PeekMessage(&messages, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&messages); DispatchMessage(&messages); } if (messages.message == WM_QUIT) break; //Do Drawing Here instead of WM_PAINT.. }

Member Avatar for triumphost
0
621
Member Avatar for juliocesar.schincariolfilho

/* Creates a "Bitmap" on the heap so you can explicitly delete it before shutting down. Otherwise you must wait until it goes out of scope before shutting down. */ HBITMAP loadBitmap(const wchar_t* path) { HBITMAP tBmp = NULL; ULONG_PTR token = 0; Gdiplus::GdiplusStartupInput input = NULL; Gdiplus::GdiplusStartup(&token, &input, NULL); …

Member Avatar for triumphost
0
2K
Member Avatar for harinath_2007

This would depend on the kind of video... A flash video? HTML 5?? What Codecs?? AVI? WMV? MP4? What kind.. There is no specific code to play every single type of video that exists..

Member Avatar for 良红
0
9K
Member Avatar for cambalinho

Is this Visual Studio C++? C++/CLI? I ask because you have "property" and "get, set" syntax which matches that of C#..

Member Avatar for cambalinho
0
676
Member Avatar for cambalinho

[sendinput](http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx) [mouse_event](http://msdn.microsoft.com/en-us/library/windows/desktop/ms646260(v=vs.85).aspx) Use SendInput or mouse_event for Windows.

Member Avatar for cambalinho
1
216
Member Avatar for musab.hussain.7

If you know the resource ID, you can extract them with WinAPI. I don't know about extracting them using QT.

Member Avatar for triumphost
0
35
Member Avatar for amin_1
Member Avatar for cambalinho

Bad code here? SetProp(hwnd, formpropname, (HANDLE)FormClass.lpfnWndProc); hwnd = CreateWindowEx(0, classname, "The title of my window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, parent, NULL, mod, (LPVOID) this); HWND isn't assigned when you call `SetProp`. You probably want to create the window before calling `SetProp`. The real way to implement what you're looking …

Member Avatar for cambalinho
0
615
Member Avatar for cambalinho
Member Avatar for cambalinho

The only way to skin and draw child controls is to use the `BS_OWNERDRAW` flag and draw the control yourself.

Member Avatar for cambalinho
0
178
Member Avatar for BibhutiAlmighty

If using Windows: `PlaySound("MyFile.wav", NULL, SND_FILENAME);` //or: `PlaySound("MyFile.wav", NULL, SND_FILENAME | SND_ASYNC);` For linux you can play files by opening `/dev/dsp` and writing the file to it. You could also use `system` and call `aplay` to play it.

Member Avatar for Moschops
0
195
Member Avatar for kshahnazari

I think this is the guy from stack overflow that told me he could not change his code when I offered him code that reads a bitmap and finds it on screen :l Again, you are missing the padding at the end of each bitmap scan line. Here is how …

Member Avatar for triumphost
0
7K
Member Avatar for cambalinho

> **WS_EX_TRANSPARENT** - Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated. [MSDN](http://msdn.microsoft.com/en-us/library/aa251511(v=vs.60).aspx) …

Member Avatar for cambalinho
0
6K
Member Avatar for Gimper

^ Ummm wth? are u trying to get your post count up?? sstream is stringstream... you could easily have searched that up.. and you do know c++ and c are somewhat interchangeable right? U can import and export functions between them... It doesnt matter if it isnt pure/native c++

Member Avatar for rela
-2
3K

The End.