1,118 Posted Topics

Member Avatar for toolmanx

If I understand you correctly, you need to look in your documentation at [b]SetWindowPos[/b]() for the SWP_FOO flags. Hope this helps.

Member Avatar for toolmanx
0
301
Member Avatar for tortoiseman

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

Member Avatar for pr2008
0
125
Member Avatar for waldchr

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 …

Member Avatar for Duoas
0
90
Member Avatar for monar

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 …

Member Avatar for Duoas
0
82
Member Avatar for Kadence
Member Avatar for conan19870619

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 …

Member Avatar for Radical Edward
0
190
Member Avatar for Wiki_Tiki

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 …

Member Avatar for William Hemsworth
0
176
Member Avatar for Motapa

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 …

Member Avatar for Duoas
0
173
Member Avatar for Wiki_Tiki

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 …

Member Avatar for mitrmkar
0
270
Member Avatar for dmlandrum

You have to define the destructor. Change line 15 to [inlinecode]~Exception() throw() { }[/inlinecode] Hope this helps.

Member Avatar for dmlandrum
0
834
Member Avatar for mahlerfive

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 …

Member Avatar for Duoas
0
135
Member Avatar for huyfamily

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 …

Member Avatar for Duoas
0
92
Member Avatar for Clockowl

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 …

Member Avatar for Clockowl
0
210
Member Avatar for pipisumthin

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

Member Avatar for WaltP
0
257
Member Avatar for tlc30

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

Member Avatar for Duoas
0
106
Member Avatar for robertmacedonia

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

Member Avatar for William Hemsworth
0
256
Member Avatar for Manutebecker

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 …

Member Avatar for JaR
0
116
Member Avatar for HolyEnd

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 …

Member Avatar for HolyEnd
0
133
Member Avatar for JaR

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 …

Member Avatar for JaR
0
2K
Member Avatar for phillipeharris

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 …

Member Avatar for phillipeharris
0
285
Member Avatar for ++C LOVER

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 …

Member Avatar for Alex Edwards
0
579
Member Avatar for conan19870619

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 …

Member Avatar for Duoas
0
743
Member Avatar for CPPRULZ

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

Member Avatar for CPPRULZ
0
177
Member Avatar for coveredinflies

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 …

Member Avatar for Duoas
0
119
Member Avatar for sahmedsa

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

Member Avatar for Duoas
0
71
Member Avatar for Corum

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 …

Member Avatar for Corum
0
133
Member Avatar for NickyU

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 …

Member Avatar for NickyU
0
114
Member Avatar for NickyU

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

Member Avatar for NickyU
0
249
Member Avatar for crioto

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!

Member Avatar for Duoas
0
91
Member Avatar for zourlas

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

Member Avatar for zourlas
0
150
Member Avatar for Hummy

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 …

Member Avatar for Duoas
0
110
Member Avatar for Spartan552

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 …

Member Avatar for Duoas
0
242
Member Avatar for williamnz

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 …

Member Avatar for williamnz
0
2K
Member Avatar for np2100

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

Member Avatar for yap.nice
0
133
Member Avatar for kanga85

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 …

Member Avatar for kanga85
0
115
Member Avatar for ee_girl

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 …

Member Avatar for Salem
0
105
Member Avatar for r.ranu1

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.

Member Avatar for Duoas
1
145
Member Avatar for farhan386

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

Member Avatar for farhan386
0
406
Member Avatar for phelaphant

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

Member Avatar for Duoas
0
212
Member Avatar for Icebone1000

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! :)

Member Avatar for Duoas
0
95
Member Avatar for BradenMurphy

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.

Member Avatar for BradenMurphy
0
189
Member Avatar for nemoo
Member Avatar for hyperdyne

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.

Member Avatar for hyperdyne
0
101
Member Avatar for tootypegs

Isn't there a [b]Files[/b] property (which should be a TStringList or somesuch)?

Member Avatar for Duoas
0
58
Member Avatar for henpecked1

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

Member Avatar for ArkM
0
2K
Member Avatar for gispe

Olvidaste poner conullas al seis. [inlinecode]while (producto != '6')[/inlinecode] :$ Hope this helps.

Member Avatar for gispe
0
73
Member Avatar for sickle

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.

Member Avatar for sickle
0
412
Member Avatar for Wiki_Tiki

If you are using the Express edition, you can't. If you purchased VS, then call the MS support and ask. Sorry.

Member Avatar for Wiki_Tiki
0
134
Member Avatar for karlw

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 …

Member Avatar for karlw
0
941
Member Avatar for Hannahlv

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

Member Avatar for Hannahlv
0
3K

The End.