462 Posted Topics
Re: std::cout<<student[x].name<< " " <<student[x].num; | |
What is the difference between these two and why does one compile fine compared to the other :S //MyFile.h #include<iostream> using namespace std; inline std::ostream& operator << (std::ostream& Str, const RGB &Rgb) { Str<<"R: "<<(int)Rgb.R<<" G: "<<(int)Rgb.G<<" B: "<<(int)Rgb.B; return Str; } //Main.cpp #include <iostream> #include "MyFile.h" using namespace std; … | |
Re: I would assume these slight differences would be due to rounding... as we know floats and doubles never ever come out pefectly and is usually rounded. Not sure if machines have anything to do with it though but there is a possibility that it does.. I wouldnt bet my money … | |
I have an application that will be minimized and running in the background. I want this application to have it's own moveable mouse so that it does not use my current mouse. How can I accomplish this? I'm not exactly sure where to start to create a mouse for it. | |
I have an application I'm updating from Java 6 to 7 inorder to get it to run. The code looks like: public Canvas(GraphicsConfiguration config) { this(); graphicsConfig = config; } But when compiled I get: "graphicsConfig is private access" @ line graphicsConfig = config. How can I do the same … | |
Re: FILE *stream ; //Redirect Output from console to a TextFile if((stream = freopen("C:\\Somefile.txt", "w", stdout)) == NULL) stream = freopen("CON", "w", stdout); //Redirect Output to the Screen | |
![]() | Re: Well considering how long of a post it is, most people will skip right over it. Post where the problem is. I don't think anyone wants to read 3 header files to answer one compiler error. |
Re: cout<< "Name your favourite soccer team in uppercase\n"; cin>>s; if (isupper(s)) cout<<toupper(s[0]); else cout<<s; | |
Re: You can't do that.. I cannot remember why but I remember ancient dragon telling me that it's a no-no. Something to do with pointers if I remember correctly.. Instead I was told to make a tracker variable and everytime you add to the array, increment the tracker by that amount. … | |
Re: Here I'm pretty sure you can use these.. I wrote them myself a while ago while writing an include for bitmap finding.. Usually we don't actually give out code but I can see that you tried and plus this code isn't complicated so I'm sure it's ok for me to … | |
Re: Double backslash in strings is equivalent to a single forward slash if your talking about paths. | |
I have a class that just creates a blank bitmap it's quite large so I removed a LOT! of code to make it easier to see my problem. No knowledge of bitmaps required. I declared "Pixels" as an array of RGB but in one function, Pixels is empty whereas in … | |
How can I stop a process cleanly given it's name? I can use TerminateProcess but it says it does not allow the application to clean up and of course I want it to clean up. This application does not have a WM_CLOSE or WM_QUIT.. I tried.. and I cannot send … | |
I have the following code which tracks the mouse movements on a control and if the mouse hovers it will beep. I want it to draw specific images on Hover and when it leaves, draw a different image. How can I accomplish this? I subclassed the buttons to figure out … | |
I have a button created as follows: ~~~ HWND License; HBITMAP MainButtons; Case WM_CREATE: License = CreateWindowEx(WS_EX_TRANSPARENT, L"Button", L"License", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_BITMAP, 26, 77, 75, 23, hwnd, (HMENU)ID_LICENSE, hInst, 0); MainButtons = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAINBUTTONS), IMAGE_BITMAP, 0, 0, LR_SHARED); SendMessage(License, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)MainButtons); break; ~~~ … | |
I'm trying to clip my Button with the following code but it does not work at all.. #pragma comment(linker,"\"/manifestdependency:type='win32' \ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #pragma comment(lib, "Gdiplus.lib") void RegionCloseButton(HWND hwnd) { CloseRegion = GetDC(hwnd); CloseRegionMem = CreateCompatibleDC(CloseRegion); Gdiplus::Graphics graphics(CloseRegion); Gdiplus::FontFamily fontFamily(L"Courier New"); Gdiplus::GraphicsPath path; Gdiplus::PointF Origin(5, 5); path.AddString(L"X", … | |
Hey all, I've been searching Rohitab, CodeProject and various other sites to figure out how to write OPCodes to a file and cannot figure it out. I thought I'd ask here because it's the only site I have an account on and I usually get my answers here or hints. … | |
Does C++ Console apps have a TryParse equivalent.. I mean .Net has it for both C# and C++ but why does C++ Consoles NOT have this! Or am I just wrong and cannot find it? I was thinking of writing my own with templates that can be use for ANY … | |
Re: If My guess is correct, I think you phrase the question wrong because of the way your saying that it reads contents of the file.. I think you mean read the instructions of an EXE file. Such as the OPCodes or I think what you mean by "EXE's have a … | |
How can I have my program modify itself? Example: Size = 1mb ..Run program once.. size = ++1mb On Second Run, check if itself is 1mb Or something of the sort :S. I need to be able to check if my program has ever been ran before.. So.. Is there … | |
void DLL_EXPORT Replace(LPCTSTR OriginalFile, LPCTSTR FileToReplace, LPCTSTR BackupOfFileToReplace) { HGLOBAL LoadResource(HMODULE hModule, HRSRC hResInfo); try { BOOL WINAPI ReplaceFile(OriginalFile, FileToReplace, BackupOfFileToReplace); MessageBox(NULL, "Done", "Alert", 0); } catch (...){} } The above is my code and it gives me errors like: In function 'void Replace(LPCTSTR, LPCTSTR, LPCTSTR)':| warning: '__stdcall__' attribute only … | |
Hey all, Back with another Win32 question. When I paint to my window (create a background image), what happens is that everything is fine until I draw the window off the screen causing it to invalidate everything.. When dragged back onscreen, my background is redrawn but my controls are all … | |
case WM_MOUSEMOVE: if (wParam & MK_LBUTTON) { RECT WindowRect; POINT CursorPos; GetWindowRect(hwnd, &WindowRect); GetCursorPos(&CursorPos); SetWindowPos(hwnd, 0, WindowRect.left - CursorPos.x, WindowRect.top - CursorPos.y, 291, 157, 0); } break; Hey Guys The above code isn't working for me. I'm trying to have the user Drag my borderless window but the thing just … | |
Re: Do you not have any code to show? We are not allowed to do homework FOR you.. we can help but not do it. | |
I have a modified a DLL called UserEnv and I decided to check out reverse engineering and assembly.. When my DLL Loads, it writes and displays a messagebox saying it's loaded.. Sorta like injection into notepad which I learned from: [How To Inject Into Notepad](http://home.inf.fh-rhein-sieg.de/~ikarim2s/how2injectcode/code_inject.html) The DLL Now looks like: … | |
I need someone to check my bitmap class for me. I load a bitmap from a file but I cannot get it to draw to the specified window :S I'm not sure if I'm loading it right or how to get the pixel data for BOTH 32 and 24 bit … | |
Re: [CODE]String Msg = "usa.weather"; message^ m = gcnew message(Msg); unsigned char buffer[Msg.length()]; memcpy(buffer, Msg.data(), Msg.length());[/CODE] OR [CODE]copy(Msg.begin(), Msg.end(), buffer);[/CODE] | |
Re: Thread has no work.. I don't see anything inside the threadproc :S | |
Re: Try this.. Works on integers. Deletes all the ONES if there are an even number of them.. and deletes all but the last one if it's odd. #include <Windows.h> #include <iostream> #include <vector> using namespace std; int main() { vector<int> Meh; Meh.push_back(1); Meh.push_back(2); Meh.push_back(3); int tracker = 0; int LastOne … | |
Re: for(int x=0;x<7;x++) Should be `X < 8 OR X <= 7` for the condition.. 0 counts as the first row of course.. you have 9 columns.. only showing 8. | |
Re: Problem.. you didn't include anything.. Unlike C# where everything is included for you or you add a simple reference.. In C++ we need includes.. Quick Tip.. When you see errors like "error C2678: binary '`[' : no operator found which takes `" well either you're missing an include or it … | |
Re: Sounds like a virus to me.. but programming is programming so it doesn't bother me.. void LockTaskManager(bool Lock, HWND hwnd) //Pass it the handle to itself.. { HMENU hMnu = ::GetSystemMenu(hwnd, FALSE); ::RemoveMenu(hMnu, SC_CLOSE, MF_BYCOMMAND); ::RemoveMenu(hMnu, SC_SIZE, MF_BYCOMMAND); ::RemoveMenu(hMnu, SC_SEPARATOR, MF_BYCOMMAND); ::RemoveMenu(hMnu, SC_STATUS_PROCESS_INFO, MF_BYCOMMAND); ::RemoveMenu(hMnu, SC_MOVE, MF_BYCOMMAND); ::RemoveMenu(hMnu, SC_MAXIMIZE, MF_BYCOMMAND); … | |
Re: I'm not sure what you mean by native program.. Win32? Console? Forms? Also look into RegKeyOpenEx and you can add your app to the key you desire. | |
Re: Stop using Dev-C++ it is out of date.. Download Codeblocks and Mingw.. Your code is fine. I've compiled and ran the program and it terminates with 0.. No segfaults or crashes or anything. Also include the header for strcpy as it was undeclared.. Windows.h fixed that for me. Time to … | |
Why does my delete function crash? I've used the same algorithm for other 2D vectors and it works perfectly fine.. I'm trying to remove an array of vectors from a 2D vector all of the std::string type. [CODE] //Ripped out of a massive class I wrote. vector<vector<string>>& Delete(vector<string> StringArrayToDelete, bool … | |
Re: [url]http://cplusplus.com/doc/tutorial/[/url] <--- Console/Basics/Everything Tutorials. [url]http://www.winprog.org/tutorial/[/url] <--- Win32 API Tuts. | |
Re: Why do you have classes inside main? and why is your bins initial size 30? I though your supposed to add elements to the array initialized with 9? Were you skipping school? if you need a dynamic array of objects and CANNOT use vectors then by all means look into … | |
Re: Not exactly sure why you have that -1 there.. what happens when the vector is already of size one? then what? it'll delete nothing or crash if it's empty. Do some checks and see how it turns out. | |
Re: Uhhh :S Your window isn't even created? Then in the main of the program, your calling vSendFile() which doesn't even have any data to send because the hook is after the SendFile.. Not only that but SendFile loops forever so it never gets to the hook? then you get the … | |
Is there anyway I can specialize JUST the Contains function of the class below? I tried for hours and cannot figure it out as I'm not too good at specialization but I learned templates recently. I want to do something like: [CODE] bool Contains(string ToFind) { //If typeof(T) == typeof(string) … | |
It reads in the whole file.. thing is, it crashes right after it hits the last line in the file.. the file is 115 lines long.. it prints all 115 lines but for some odd reason, it crashes right after :S If I remove the blank line at the end … | |
![]() | Re: Just change your vector to array/char*.. it'll do the same thing. [CODE] class SomeObjectClass { private: vector<char> DataHolder; public: SomeObjectClass(){} ~SomeObjectClass(){} vector<char> SomeFunc(SomeObject &Obj) { return DataHolder; } }; [/CODE] |
Re: [url]http://www.joachim-bauch.de/tutorials/loading-a-dll-from-memory/[/url] Read the article or View the source at end of the article.. | |
Re: Can always use Base64 to encode the image and then transfer the string over a network then decode the string back into an image.. [url]https://github.com/BenLand100/CBAS/blob/master/CBAS_lib/Bitmap.cc[/url] AND used like: [url]https://github.com/BenLand100/CBAS/blob/master/Scripts/Test.cc[/url] Basically BitmapToString then transfer.. then StringToBitmap and do whatever else.. If u understand pascal then I can give u the source … | |
I'm trying to help someone with homework.. So you do not have to give me direct answers if you don't want to.. it is not my homework. [CODE] class Types { //No default constructor.. Types(int Param1, int Param2); }; class Objects { public: Types* Original; Objects(); ~Objects(); }; //The problem … | |
Re: [CODE] bool StringsEqual(string Str1, string Str2) { if (Str1.size() != Str2.size()) //If the sizes of the strings are different.. then they are of course not the same.. return false; for (unsigned I = 0; I < Str1.size(); I++) //We established they are the same size if we got this far.. … | |
I need help changing my return type from int to vector<string>.. I don't want to have to pass the vector as a pointer to the function but rather I just want to return the vector itself as I no longer need to check the return type. If it fails, it'd … | |
Re: LibCurl is an amazing library when it comes to this stuff. Check it out. | |
K so atm, I'm having problems understanding ENDIF and IFDEF preprocessor stuff.. I want to Use a specific method if a file is included.. If not, use a different method.. Since toupper is defined in CCType I tried to check if that file was included.. if it was, use toupper … | |
Re: Can't.. VS2010 doesn't support it.. Try VS2008 OR VS2011 beta. |
The End.