462 Posted Topics

Member Avatar for cyther
Member Avatar for triumphost

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

Member Avatar for Ancient Dragon
0
209
Member Avatar for ravenous

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 …

Member Avatar for santakdalai90
0
308
Member Avatar for triumphost

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.

Member Avatar for triumphost
0
416
Member Avatar for triumphost

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 …

Member Avatar for NormR1
0
82
Member Avatar for pjh-10

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

Member Avatar for BobS0327
0
491
Member Avatar for Griff0527

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.

Member Avatar for Lerner
0
2K
Member Avatar for Valiantangel

cout<< "Name your favourite soccer team in uppercase\n"; cin>>s; if (isupper(s)) cout<<toupper(s[0]); else cout<<s;

Member Avatar for triumphost
0
95
Member Avatar for benclifford

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. …

Member Avatar for triumphost
0
560
Member Avatar for FraidaL

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 …

Member Avatar for triumphost
0
163
Member Avatar for James19142

Double backslash in strings is equivalent to a single forward slash if your talking about paths.

Member Avatar for triumphost
0
1K
Member Avatar for triumphost

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 …

Member Avatar for triumphost
0
225
Member Avatar for triumphost

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 …

Member Avatar for deceptikon
0
84
Member Avatar for triumphost

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 …

0
83
Member Avatar for triumphost

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

0
75
Member Avatar for triumphost

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

0
192
Member Avatar for triumphost

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. …

Member Avatar for mike_2000_17
0
308
Member Avatar for triumphost

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 …

Member Avatar for m4ster_r0shi
0
2K
Member Avatar for Rasool Ahmed

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 …

Member Avatar for Nick Evan
0
2K
Member Avatar for triumphost

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 …

Member Avatar for MandrewP
0
151
Member Avatar for triumphost

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 …

Member Avatar for thines01
0
293
Member Avatar for triumphost

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 …

Member Avatar for Banfa
0
1K
Member Avatar for triumphost

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 …

0
67
Member Avatar for qwerty__

Do you not have any code to show? We are not allowed to do homework FOR you.. we can help but not do it.

Member Avatar for WaltP
0
524
Member Avatar for triumphost

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: …

0
95
Member Avatar for triumphost

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 …

Member Avatar for Huston
0
106
Member Avatar for SAM2012

[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]

Member Avatar for WaltP
0
177
Member Avatar for jonnyboy12
Member Avatar for mike_2000_17
0
118
Member Avatar for Despairy

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 …

Member Avatar for mike_2000_17
0
95
Member Avatar for poolet

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.

Member Avatar for poolet
0
143
Member Avatar for JOSheaIV

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 …

Member Avatar for JOSheaIV
0
3K
Member Avatar for akshayinbox

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

Member Avatar for BobS0327
0
336
Member Avatar for Rasool Ahmed

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.

Member Avatar for mitrmkar
0
704
Member Avatar for infogirl

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 …

Member Avatar for triumphost
0
233
Member Avatar for triumphost

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 …

Member Avatar for histrungalot
0
699
Member Avatar for TheNewKid

[url]http://cplusplus.com/doc/tutorial/[/url] <--- Console/Basics/Everything Tutorials. [url]http://www.winprog.org/tutorial/[/url] <--- Win32 API Tuts.

Member Avatar for TheNewKid
0
93
Member Avatar for Crashley2010

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 …

Member Avatar for Crashley2010
0
571
Member Avatar for NinjaTwinkie13

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.

Member Avatar for NinjaTwinkie13
0
156
Member Avatar for HWK1982

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 …

Member Avatar for triumphost
0
669
Member Avatar for triumphost

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

Member Avatar for mike_2000_17
0
617
Member Avatar for triumphost

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 …

Member Avatar for triumphost
0
250
Member Avatar for TheFearful

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]

Member Avatar for triumphost
0
230
Member Avatar for pseudorandom21

[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..

Member Avatar for pseudorandom21
0
1K
Member Avatar for pseudorandom21

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 …

Member Avatar for pseudorandom21
0
771
Member Avatar for triumphost

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 …

Member Avatar for triumphost
0
150
Member Avatar for Prisms

[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.. …

Member Avatar for Prisms
0
213
Member Avatar for triumphost

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 …

Member Avatar for mazzica1
0
181
Member Avatar for ilearnz001
Member Avatar for ilearnz001
0
235
Member Avatar for triumphost

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 …

Member Avatar for ravenous
0
95
Member Avatar for PrimePackster
Member Avatar for Ancient Dragon
0
182

The End.