1,118 Posted Topics
Re: If I understand you correctly, you need to look in your documentation at [b]SetWindowPos[/b]() for the SWP_FOO flags. Hope this helps. | |
Re: Nice start. The main cause of problems is one of types on lines 14 and 15 in main(). A template type is an [i]incomplete[/i] type. It cannot be instantiated into an actual variable type without further information: the template arguments. Hence, you cannot declare a variable as [inlinecode]vector <T> v;[/inlinecode], … | |
Re: If you are not on windows, or you just want something more cross-platform, you'll need to use a GUI toolkit. The universal favorites are (in no particular order): [URL="http://trolltech.com/"]Trolltech Qt[/URL] [URL="http://www.gtk.org/"]GTK+[/URL] (and a nice C++ wrapper: [URL="http://sourceforge.net/projects/gtkpp/"]GTK++[/URL]) [URL="http://www.wxwidgets.org/"]wxWidgets[/URL] [URL="http://www.fltk.org/"]FLTK[/URL] [URL="http://www.fox-toolkit.org/"]FOX Toolkit[/URL] You may also want to take a look through … | |
Re: Dynamic or static linkage? You should probably spend some time looking through your Delphi documentation's "Components and Packages" section. Your package must register the component (the Frame) when it is loaded, and deregister it when unloaded. You must also specify the package unit's name in the [b]uses[/b] clause. If it … | |
Re: Right. The va_args don't work with object-types. | |
Re: Use the STL [code=C++] #include <algorithm> #include <fstream> #include <iostream> #include <iterator> using namespace std; int main( int argc, char** argv ) { if (argc < 2) { cout << "usage:\n countlines FILENAME\n"; return 0; } ifstream file( argv[ 1 ] ); if (!file) { cerr << "Could not open … | |
Re: Argh... sometimes I'm dismayed that Borland's C++ version of a control is wimpier than the Delphi version. [edit] I just re-read your post and realized that you said [b][i]Visual[/i] C++[/b]... Alas. What follows assumes the Borland TRichEdit control. I don't know what it is in VC++, but the main functionality … | |
Re: Use a commercial library. It is worth the $$. There are also some good free ones. [URL="http://www.dtksoft.com/barreader.php"]DTK Software[/URL] [URL="http://zebra.sourceforge.net/api/files.html"]Zebra Barcode Library[/URL] (sourceforge) [URL="http://www.vclcomponents.com/catalog/Barcode_Scanner"]VCL Components Delphi Barcode Scanners page[/URL] You can google around for more if you like. Be aware that not all scanners are equal. Know what equipment you intend … | |
Re: The Win32 GDI abstracts a DC over the printer, so using the printer is very much like drawing a form. Here's the [URL="http://msdn.microsoft.com/en-us/library/ms535673%28VS.85%29.aspx"]MSDN Printing and Print Spooler reference[/URL]. It includes all the information you need to know about the printer GDI and provides a number of good examples. Hope this … | |
Re: You have to define the destructor. Change line 15 to [inlinecode]~Exception() throw() { }[/inlinecode] Hope this helps. | |
Re: The best way to solve it is to provide a custom allocator for your [b]_memory_map[/b] object that would use [B]malloc[/B]() and [B]free[/B]() directly and skip the overloaded [B]new[/B] and [B]delete[/B] operators. If you aren't worried about thread safety, you can also just add a flag that the overloaded [b]new[/b] and … | |
Re: Use a [B]stringstream[/B] to get stuff out of a string. [code=C++] #include <fstream> #include <sstream> #include <string> ... ifstream inf( "fooey.txt" ); string line; while (getline( inf, line )) { // if the line is blank, ignore it if (line.find_first_not_of( " \t" ) == line.end()) continue; // get the first … | |
Re: With just a very quick glance, that [b]notOptimized[/b]() function needs some help. A bitvector (or [inlinecode]vector<bool>[/inlinecode]) is not a good choice in such a function. Sad, but it was optimized for space, not speed. If each point of a quad is always optimized or unoptimized, you can reduce it to … | |
Re: STL fun: [code=C++] #include <algorithm> #include <fstream> #include <iterator> #include <string> bool file_compare( const std::string& filenameA, const std::string& filenameB, bool is_binary ) { std::ios::openmode mode = is_binary ? std::ios::binary : std::ios::in; std::ifstream fileA( filenameA.c_str(), mode ); std::ifstream fileB( filenameB.c_str(), mode ); if (!fileA or !fileB) return false; if (is_binary) { … | |
Re: Don't use Word to write your programs. Use a plain-text editor, or the Pascal IDE. If you are using Turbo Pascal, it has a very nice IDE. Next, make your program compile before you post asking questions. To use random numbers, somewhere at the beginning of your program say: [inlinecode]randomize;[/inlinecode] … | |
Re: [B][U]semicolons[/U][/B] A semicolon by itself is considered a null statement, and has no meaning. Modern compilers will typically complain about them unless they explicitly terminate a statement. For example [inlinecode]int number_of_lightbulbs_to_change; [COLOR="Red"];[/COLOR][/inlinecode] That second semicolon, while probably not an error, is also not useful, so the compiler will complain. It … | |
Re: The [b]rand[/b]() function does not return a pointer to an int. It just returns the int. ([URL="http://www.cppreference.com/stdother/rand.html"]reference[/URL]) So attempting to [b]delete[/b] it is causing your error. Also, while % does precede + in precedence, the way you have it written looks scary to me. Personally, I always tend to use … | |
Re: What object is [b]getpixel[/b] part of? Also, if you mean the (X, Y) under the cursor, you'll have to use the [b]MouseDown[/b] event. Are you trying to get the color of a pixel in an image [i]you[/i] loaded in [i]your[/i] program? Or are you trying to get the color of … | |
Re: There isn't really any clean solution. Remember, a template class is an [i]incomplete type[/i]. It is only when you parameterize it that it becomes a complete, concrete, usable, valid type. So [inlinecode]vector <> * pvec_of_anything;[/inlinecode] just can't work. Such a type doesn't exist. However, [inlinecode]vector <int> * pvec_of_int;[/inlinecode] is a … | |
Re: Without even looking at your code, I will make a wild stab in the dark and say that you are using a Windows console to run your program? If you are, right-click the icon on the console's title bar and select "properties" from the drop-down menu. Click the "Layout" tab … | |
Re: You know, I thought I had responded to this thread yesterday, but now I remember I was called away before I could finish typing. 'Bitfields', in the sense of using individual bits in an integer value, are [i]very[/i] useful. 'Bitfields', in the sense of the C++ [inlinecode]foo:1;[/inlinecode] syntax, have a … | |
Re: How is your dictionary stored? If, like [b]iamthwee[/b] suggests, it is a file with words in it, you can just search the file for the given word. You can even use the STL for that: [code=C++] #include <algorithm> #include <fstream> #include <iterator> #include <string> // findword() // Determine whether or … | |
Re: You are confounding c-style strings and stl strings. An old c-style string: [code=C] #include <cstring> #include <iostream> using namespace std; int main() { char name[ 100 ]; // this is an array of characters cout << "Please enter your name> "; cin.getline( name, 100 ); cout << "Hello " << … | |
Re: I've used '\r' plenty of times to implement a little timer or progress indicator. The '\b' unfortunately doesn't always work... but it should on all modern terminals and emulators. The formfeed and vertical tab are carryovers from line printers. They used to be used a bit more with plain-text documents … | |
Re: [b]this[/b] is a special pointer that points to the active object. For example: [code=C++] #include <iostream> #include <string> using namespace std; class WhoAmI { string name; public: WhoAmI( const string& name ): name( name ) { } void print( const WhoAmI& other ) { cout << "I am " << … | |
Re: You have [i]three[/i] [b]c[/b]s there: line 51 line 55 line 59 Your loop will never terminate because every [b]c[/b] is always == [b]first[/b] (so no matter which of the three the compiler chooses to use you've got an infinite loop). Make sure to use just [i]one[/i] [b]c[/b]. Also, watch how … | |
Re: Windows can do that for you with the [URL="http://msdn.microsoft.com/en-us/library/ms648045(VS.85).aspx"][b]LoadImage[/b]()[/URL] function, and that returns a windows HANDLE to the image resource, which you must select into a compatible DC to display or access its pixel data (as usual). If you want to access the image differently (for example, if you have … | |
Re: Don't test against [b]true[/b]. Test against [b]false[/b]. That is the danger in defining values for [B]true[/B] and [B]false[/B]. Just remember, [i]always[/i] (and this [i]is[/i] one of 'those' rules...) explicitly test against [b]false[/b]. Only [i]implicitly[/i] test for true: [code] if (x != false) yah(); if (x) yah(); if (x == false) … | |
Re: I hope you know a lot of math. Writing a compression schemata is [i]not[/i] a trivial task. You could just use a standard compression library (like zlib) and store the resulting data in a different file format than normal. Good luck! | |
Re: [code=C++] #include <iomanip> #include <iostream> using namespace std; int main() { for (int n = 1; n < 6; n++) cout << n; cout << setw( 5 ) << right << (167) << "mm\n"; return 0; } [/code] Hope this helps. | |
Re: What OS are you using? If you are using a GUI, what GUI toolkit are you using? If you are on Win32 console, you should check out Microsoft's Console Function reference. [url="http://msdn.microsoft.com/en-us/library/ms685035(VS.85).aspx"]Here is an example[/url]. If you are on Linux console, you should check out NCurses, which can do [URL="http://invisible-island.net/ncurses/ncurses-intro.html#mouse"]mouse … | |
Re: The main problem is that iostreams cannot be copied. Consider for a moment the horrors that can occur if you have three copies of an object that manipulates a file sitting around. You must pass them by [i]reference[/i]. So, if you want your class to have a fstream, you should … | |
Re: You should also be very careful about [b]const[/b]-correctness. Insertion operators should generally have the form: [inlinecode]ostream& operator << ( ostream&, [B]const[/B] myobj& )[/inlinecode] and extraction operators should generally have the form: [inlinecode]istream& operator >> ( istream&, myobj& )[/inlinecode] There are, of course, exceptions, but you don't need to worry about … | |
Re: Yes... such applications are still made. And no, the syntax doesn't change. The [i]paradigm[/i] may change... All GUI programs (well... all [i]good[/i] ones ;) ) are event-driven. Console programs tend to be imperative (though many good ones are also event-driven). The goal is to learn to properly use the language. … | |
Re: Wrong forum. GWBASIC doesn't have a recursive KILL command. You'll have to write a subroutine that does it yourself. [list=1] [*]Use FILES to get all the file names in the target directory. [*]For each filename: [list] [*]if it is a directory (name is followed by "<DIR>", for example "C:\FOO\MYSUB<DIR>") then … | |
![]() | Re: Use [URL="http://www.cppreference.com/stdio/sprintf.html"][b]sprintf[/b]()[/URL] or a [URL="http://www.cppreference.com/cppsstream/index.html"][b]std::ostringstream[/b][/URL] to convert the date to a string, then use [b]outtextxy[/b]() to print the string. [code=C] char buf[ 20 ]; sprintf( buf, "%d/", d.da_day ); outtextxy( 200, 100, buf ); [/code] [code=C++] // I'm pretty sure that Turbo C++ uses a different header name // for … |
Re: If you are stuck with ancient 16-bit tools, look in the documentation for "overlays". However, I wholly endorse [b]Salem[/b]'s recommendation to git yerself a mo-dern compost piler. | |
Re: I don't use Word, so I can't help... but what you are doing is unlikely to work well anyway because the window class names can change between versions of Word... But I think you should be looking for a RichEdit class... I think you ought to look at OLE automation. … | |
Re: You do realize that this thread is over three years old? ...And that using [b]goto[/b] for this instead of a loop is Wrong... ...And that this is the [b]Pascal and Delphi[/b] forum... (But at least you didn't call [inlinecode]main();[/inlinecode] ;) ) | |
Re: NCurses. [URL="http://pdcurses.sourceforge.net/"]Win32 (PDCurses)[/URL] [URL="http://www.gnu.org/software/ncurses/"]Unix (NCurses)[/URL] You can also use the [URL="http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx"]Win32 Console API[/URL] directly. Have fun! :) | |
Re: You'll also need to [inlinecode]#include <iterator>[/inlinecode] if you want to use those [b]back_inserter[/b]s properly. The [URL="http://www.cplusplus.com/reference/algorithm/lexicographical_compare.html"][b]lexicographical_compare[/b]()[/URL] algorithm optionally takes a fifth argument: a boolean predicate. You can make your custom predicate do a case-insensitive comparison by converting both arguments [b]toupper[/b]() before returning whether a < b. Hope this helps. | |
Re: x86: CMP, Jxx, JMP MIPS: b, bne, etc. | |
Re: No such thing exists. The Lazarus IDE itself has an 'import project' item. You might want to look through the [url=http://wiki.lazarus.freepascal.org/Lazarus_For_Delphi_Users]FPC Lazarus For Delphi Users[/url] page. Hope this helps. | |
Re: Isn't there a [b]Files[/b] property (which should be a TStringList or somesuch)? | |
Re: What you have written is a data class, and either your professor will have you extend it or will have you write a templated linked-list class and use Contributor in a linked list. I've really only barely glanced at it, and most everything seems to be in order but one: … | |
Re: Olvidaste poner conullas al seis. [inlinecode]while (producto != '6')[/inlinecode] :$ Hope this helps. | |
Re: You have to hook external objects using global hooks (those residing in a DLL). Process hooks can only be used with your own application's processes. | |
Re: If you are using the Express edition, you can't. If you purchased VS, then call the MS support and ask. Sorry. | |
Re: That's the way it is supposed to work. PChar is #0 terminated. I would have to look it up to be sure, but I don't know if Delphi is smart enough to return a string the way you are doing it. The PChar you get from the DLL should be … | |
Re: I've answered this question (on another forum ... :sweat: ) with a little class to do this kind of thing. You can look through it to see how it works (or just use it as-is --whatever you like). It is POSIX compliant (meaning it will work on any POSIX platform) … |
The End.