183 Archived Topics

Remove Filter
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 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 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 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 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
616
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 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 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 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 triumphost

Hey guys I'm having an extremely hard time splitting or combining values into binary.. [CODE] #define Chr(n) ((char)(n)) #define Ord(c) ((int)(unsigned char)(c)) int DecToBin(int Num) { int Bin = 0, Pos = 1; while (Num > 0) { Bin += (Num % 2) * Pos; Num /= 2; Pos *= …

Member Avatar for histrungalot
0
206
Member Avatar for triumphost

How can I make my DLL constantly check for hotkeys but without affecting other functions in it? If I put a loop, it will not be able to get any other calls to functions.. Do I create a thread and pass my functions to the thread upon attachment? My silly …

Member Avatar for LdaXy
0
248
Member Avatar for triumphost

I'm trying to convert this (Pascal) to C++.. My attempt is below this.. [CODE] function CompressString(const Str: string): string; var Destlen:longword; begin result := ''; Destlen :=BufferLen; if length(str) < 1 then exit; if compress(BufferString,destlen,PChar(Str),length(str)) = Z_OK then begin setlength(result,Destlen + SizeOf(Integer)); PInteger(@result[1])^ := Length(str); Move(bufferstring[0],result[5],Destlen); end; end; [/CODE] [CODE] …

0
82
Member Avatar for triumphost

My code is: [CODE] #include <windows.h> #include <iostream> using namespace std; struct ReplacementFlags { public: bool rfReplaceAll, rfIgnoreCase; ReplacementFlags(bool ReplaceAll = false, bool IgnoreCase = false) : rfReplaceAll(ReplaceAll), rfIgnoreCase(IgnoreCase) {} ~ReplacementFlags() {} ReplacementFlags& operator ()(bool ReplaceAll = false, bool IgnoreCase = false) { if((rfReplaceAll != ReplaceAll) && (rfIgnoreCase != IgnoreCase)) …

Member Avatar for triumphost
0
208
Member Avatar for triumphost

When do I really need to use Delete in Destructors? if I do Point P = new Point(); I've been told every time I use new, it stays in memory even when out of scope and that I should use delete to remove it.. so do i need to do …

Member Avatar for triumphost
0
762
Member Avatar for triumphost

I did not know WHERE to ask this as there is no "General" section on the site this site that I know of. Lets say I found code online but it's under the GPL 3 License.. I read it but it doesn't say that I cannot translate it from Pascal …

Member Avatar for mike_2000_17
0
103
Member Avatar for triumphost

Am I wrong that the answer is 2?? Teacher refuses and says that it's 3 because the compiler spits out 3 for ans.. but if I do it manually with pen an paper or with the cout<<v2%v1++, it spits out 2 which is what I get on paper.. [CODE] #include …

Member Avatar for mike_2000_17
0
319
Member Avatar for triumphost

How can I check if a template's parameter is empty? Or of a "certain type"? I'd prefer to check if it's empty or not rather than the type because if the wrong type is entered, it'd throw an error anyway.. But I definitely need to know if the parameter passed …

Member Avatar for mrnutty
0
4K
Member Avatar for triumphost

I'll get straight to the point as it's very difficult to do since I haven't found the answer on google or anywhere else. [CODE] Class ArrayOfTypes { vector<MyType> P; &MyType operator [](int I) = (MyType& PT) { if (P[I] != PT) { P[I] = PT; } return P[I]; } } …

Member Avatar for Banfa
0
261
Member Avatar for triumphost

Is it Dangerous to Derive from STD? Specifically std::string. Why I'm asking? I want to write a class that extends the functionality of std::string and a couple other std structs/classes.. So that when I do something like: String M = ""; M.Explode(........) it'll do the functionality in my class below. …

Member Avatar for mike_2000_17
0
102
Member Avatar for triumphost

How can I get a variable amount of arguments in a function without providing how many arguments will be passed? For example, when you use a VA List, the first parameter must be the amount of arguments passed.. I don't want that. I want to just start passing any amount …

Member Avatar for deceptikon
0
524
Member Avatar for triumphost

I have: [CODE] private: Void GoBtn_Click(Object^ sender, EventArgs^ e) { ((WebBrowser)MultiTab->SelectedTab->Controls[0]).Navigate(SearchBar->Text); } [/CODE] But it keeps giving me an error at Controls[0] and telling me that no operator [] matches.. Control::Collection^ [int] <--- No clue what that line means.. Next it tells me that I cannot cast TabControl to (WebBrowser) …

Member Avatar for therockon7throw
0
103
Member Avatar for triumphost

How can I do the following? I read up on Variable Arguments last time I asked this question (Mike pointed me in the right direction).. but it still does not let me define any number of them.. I Do not want to specify the first parameter and if I do, …

Member Avatar for triumphost
0
213
Member Avatar for triumphost

Is there any C++ .Net IDE's around? I mean visual studio is ok.. it just isn't as good as SharpDevelop which only does C#, VB and a few others. It doesn't do C++ that's why I'm looking for a C++ version of SharpDevelop. Any Ideas? SharpDevelop [url]http://www.icsharpcode.net/opensource/sd/[/url]

Member Avatar for thines01
0
447
Member Avatar for triumphost

I have: [CODE] class ANew { private: vector<CustomType> ArrayOfTypes; public: ANew() : ArrayOfTypes(0) {} ~ANew() {} ANew& operator ()(int I) { return ArrayOfTypes[I]; } operator const ANew* () const { return ArrayOfTypes; } }; [/CODE] But it gives me these errors: [ICODE]C++\Types.h|12|error: invalid initialization of reference of type 'ANew&' from …

Member Avatar for mike_2000_17
0
165
Member Avatar for triumphost

Someone please tell me the difference between 0 and '\0' and NULL. I thought I knew it! 0 and NULL is the same thing "Essentially".. '\0' is a null terminator for a string.. It's just sometimes when I convert a string to char array and do some encryption on it, …

Member Avatar for mrnutty
0
234
Member Avatar for triumphost

I read a LOT of tutorials on bitmaps. I learned that RGBQuad is for 32 bit bitmaps and RGBTripple is for 24 bit bitmaps.. I'm planning on getting pixel information from a bitmap that can be of 3 types. 24bit, 32bit, 32bit with alpha (Transparent). Thing is, I don't know …

Member Avatar for triumphost
0
201
Member Avatar for triumphost

Sorry for using Inception in the title but it's the only way I think I can describe it.. Take this for example: Definition.H [CODE] struct XY { string info; string name; string tag; string attrib; }; //is it better to create an object here inorder to make the array? struct …

Member Avatar for triumphost
0
142
Member Avatar for triumphost

The below code is what I have.. It's a custom type I made called Points that stores co-ordinates on the screen.. The problem is in the PointsArray Struct. When I declare one like so: [CODE] PointArray P; Point A(10, 5); for (int I = 0; I < 5; I++) { …

Member Avatar for triumphost
0
291
Member Avatar for triumphost

How can I forward declare a struct/custom type in my include? I'm trying to write an include but it keeps telling me incomplete type or type not declared.. I do not have a .CPP to go with it.. I wrote everything in here as I have never written an include …

Member Avatar for mike_2000_17
0
8K
Member Avatar for triumphost

In pascal, you can have something like the following: [CODE] type TPoint = record X, Y: Integer; end; TPointArray = array of TPoint; T2DPointArray = array of TPointArray; [/CODE] In C++ I tried to replicate this and failed miserably. [CODE] struct Point { X: Integer; Y: Integer; }; struct PointArray …

Member Avatar for triumphost
0
7K
Member Avatar for triumphost

Why does it load my DLL but the pointer to the Proc returns 0? It loads the DLL and says "DLL Loaded" but it just won't say "Function Found." Help me please :)? [CODE] #include <windows.h> #include <iostream> //DLL Function: void DLL_EXPORT Theading(HANDLE hThread, DWORD ThreadID, void* FunctionToPass); typedef void …

Member Avatar for triumphost
0
2K
Member Avatar for triumphost

Hey all, I'm trying to make a DLL that can be used in Pascal to enable multi-threading. I've decided I want to export Threads in C++ to a DLL. Before I make DLL's I usually write the program first to test everything then I convert it to a DLL. [CODE] …

Member Avatar for nezachem
0
163
Member Avatar for triumphost

How do interpreters do it? I've seen bots for games that encrypt files then decrypt them at runtime and run what's in them.. Well How? How can I do this in C++? I plan to do this in another language but I decided to ask in C++ section because this …

Member Avatar for VernonDozier
0
170
Member Avatar for triumphost

I have an idea for a program but I don't know if its possible. I want to write a program that can read commands from a file.. For example, I've seen bots that can parse and read javascript for games and execute whatever is in the .java file.. How can …

Member Avatar for triumphost
0
179
Member Avatar for triumphost

My problem is at line 54 and line 124.. Not sure how to fix it at all.. I basically just want to store all the values of NameIdx to the vector and print the values of the vector. But instead if shows random/AltKeyCode characters and crashes. I know its probably …

Member Avatar for nezachem
0
143
Member Avatar for triumphost

I have an iframe that loads a page inside it.. when a link is clicked on the page in the iframe, resize the body of the parent aka the document that has the iframe's body.. Example: [CODE]Body <------------------------ Iframe | Page | Link... Upon Click, resize --[/CODE] How do I …

Member Avatar for triumphost
0
146
Member Avatar for triumphost

Can someone explain why my function is not working? Description: ToggleFrame(TagID, FrameID).. Given those two, get the two elements.. If the iframe is showing, hide the tagID element.. if the tagID element is showing, hide the iframe.. My attempt & failure: [CODE] function ToggleFrame(ID, FrameID){ //Given the tag, show/hide it.. …

0
72
Member Avatar for triumphost

Trying to re-write a php function to C++ using boost.. I have NOT seen code for this anywhere on the net. I thought it was useful and I need it for C++ but I need help.. definition of the function in c++ [CODE] void preg(string pattern, string subject, string &matches, …

Member Avatar for vijayan121
0
225
Member Avatar for triumphost

I have a file that has the layout: [CODE] 0 0 0 1 1 0 1 1 [/CODE] I want to read it into a multidimensional array and use the values. The thing is I don't know how to read it in.. I can read the amount of columns and …

Member Avatar for triumphost
0
244
Member Avatar for triumphost

Hey all. I'll make this quick. I want to search for a pattern and replace it with an empty string using the boost/curl libraries OR strictly c++.. No DotNet. The below code I have, removes HTML Tags from a file/string: [CODE] static string StripTags(string source) { int iSize = (int)source.length(); …

Member Avatar for vijayan121
0
309
Member Avatar for triumphost

Hey guys I'm here again with another problem. I want to search in a string for a string with quotes in it. Example: [CODE]String to search = {' </a></div></div></div><div class="clearfix"><table cellspacing="0" class="wsod_quoteData"><tr><td class="wsod_last wsod_lastIndex" nowrap="nowrap" '} What to search for = {' <table cellspacing="0" class="wsod_quoteData"> '} Then if found, from …

Member Avatar for triumphost
0
173
Member Avatar for triumphost

Hi guys. I have a php script that reads some values off a website and prints to a file every second.. The thing is, the script is always ran in my browser and I don't like that. I want to write a c++ program that can run that script within …

Member Avatar for thines01
0
361
Member Avatar for triumphost

I have an iFrame that is 1024px X 700px. I removed the scrollbars using Scrolling="No" because the scrollbars don't look very pleasing to my eyes. I use javascript to scroll the iFrame but for the life of me, I cannot figure out how to detect if I'm already at the …

Member Avatar for triumphost
0
882
Member Avatar for triumphost

[IMG]http://i.imgur.com/DGegu.png[/IMG] I have that page above.. But the thing is the entire website was made using an iFrame that loads another page.. Each page has one of those at the bottom. Thing is when the main page loads the second page, there are duplicates of those at the bottom. I …

Member Avatar for Amr87
0
228
Member Avatar for triumphost

I have a game client that has a button to allow input and when toggled on it will block input.. Thing is sometimes even when u toggle it off, it still blocks user input.. Other times there is an extremely HUGE delay before it accepts input.. I was thinking if …

Member Avatar for ret801
0
224
Member Avatar for triumphost

I've been programming in C++ for quite some time now and I know all functions must return a value.. but can someone tell me WHY we return 0? I mean it compiles even when I don't put return 0.. and the program executes fine.. I can see in some functions …

Member Avatar for SnowFall
0
273
Member Avatar for triumphost

How do I call the function in the button section?? I tried doing target(); and got when the program ran, it gave me some exception thing.. [CODE] package smart; import java.applet.Applet; import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.Point; import java.awt.event.ActionEvent; import …

Member Avatar for triumphost
0
301

The End.