He didn't misunderstand.
There are two ways to look at "inline":
1. the OP wants to avoid using function call syntax
2. AD's code actually avoids calling a function
Either way the best solution takes multiple lines of code, as posted.
He didn't misunderstand.
There are two ways to look at "inline":
1. the OP wants to avoid using function call syntax
2. AD's code actually avoids calling a function
Either way the best solution takes multiple lines of code, as posted.
Actually, it might be possible to some degree. VB uses a lot of bytecode and, if I remember right, Microsoft and others have VB decompilers. You'll never get back the absolute original, but if you can find the right decompiler (and can front the cash for it), you should be able to get enough back that you can reconstruct the rest.
You might be better off just writing it over again...
Alas.
You've misread Narue's code. You can't do this with a standalone function. It must be a member of a class.
In the first example, Amethod() was made virtual in the base class (Bird) and overloaded in the descendant class (Pidgeon). Since it is virtual (or dynamic) when you say p->Amethod()
the Pidgeon's Amethod() gets called if p is a Pidgeon; and the Bird's Amethod() gets called if p is a Bird.
In the second example, Amethod() is static (or not dynamic), so even if you give Pidgeon an Amethod() member function, since p is listed as a "pointer to Bird" the Bird's Amethod() is always called. That is the reason why Narue didn't bother to give Pidgeon an Amethod() method (member function).
This is the difference between Object Oriented (the dynamic way) and Object Based (the static way).
Hope this helps.
Ah, well, then you've got yourself in a ball of mud.
One of the primary functions of the OS is to load and execute a program. How this happens is typically and entirely dependent on the OS.
For example, Win32 cannot execute a Mac program. As far as old DOS and Win16 programs, Win32 was specifically engineered to support legacy applications, but the next generation will scrub the old DOS subsystem anyway...
If you intend to execute PE32 (Win32) programs, then you'll have to do some serious reading over at MSDN and around the net.
Otherwise, you'll have to roll your own exe format, or borrow one from another OS, and write your own loader.
Good luck.
In assembly? You can (maybe) but is it worth the effort you'll need to write the loader?
The OS exists to make complicated things simple. Just use the OS functions.
1)When i writeing program in other language can i use dll or not?
Yes, you can use a DLL in any language. The trick is only to match the correct "calling convention". Google it and read more about it. Most Windows DLLs have "stdcall" calling convention.
2)It is his mistake or MSND ... Because he call this EXPLICITE and but msdn not.
Both are correct. The difference between explicit and implicit linking is just whether or not the compiler links for you. For example, when writing windows programs, if you include <windows.h> then you can use all kinds of functions found in Windows DLLs without having to explicitly say which DLLs you want to use.
3)MSND call load-time dyna... EXPLICIT is it mind that run-time dyna... IMPLICIT?
This is non-sequitur. If you use LoadLibrary() then that is run-time loading. Otherwise it is load-time loading. This is a fairly simple, but technical issue. You shouldn't need worry about it.
The main interest for the programmer is that if a load-time DLL is not found, your program will not run. However, a run-time DLL (loaded with LoadLibrary()) allows you to choose whether to continue execution or not.
4)When i use load-time is it mind when i load first time i do not need anymore dll?
I don't understand your question.
5)Can i use any windows XP dll's?
Sure, why not?
6)What i need to do to attach another dll with this …
It appears that you are trying to do ASCII graphics. Is that right?
Overloading only works when there is a function taking arguments of the exact same type as the things you are trying to operate on.
Since L + p1;
is saying "add a Point (the type of p1) to a Linea (the type of L)" you must have an overloaded function specifically for handling these two things. For example: Linea &Linea::operator + ( Point &p )
That is, it is a function which overloads adding a Point to a Line.
I am wondering, do you mean to be adding a point to a Linea, or to a PointCollection? A Linea only has two points ("begin" and "end"), so adding a Point to it doesn't seem to make much sense. What exactly are you trying to do?
No, you didn't overload it. L
is type Linea
. p1
is type Point
.
Neither of these classes overload the "+" operator.
By the way, L + p1;
is read as "sum L and p1 and throw away the result."
It should be something like: L = L + p1;
or: L += p1;
Hope this helps.
So what you want to do is create your own DLL which your application can use to do something?
What programming environment are you using (compiler/IDE)?
A DLL is not very different than an EXE. (Both are PE32 files.) The primary difference is how they are expected to be used. (That is by no means the only significant difference, so you can't just rename your DLLs to EXEs and expect them to work...)
You might start out by checking out what MSDN has to say.
If by "get into a dll file" you mean that you want a list of its import and/or export tables, then google "pe32 import export table" to get started. There are system APIs to help here.
Hope this helps.
Further, depending on your choice of programming language, it is likely you can find free software libraries that will store all your configuration data in a structured text file format, for example: XML or even (gasp!) INI.
Most people have it on their website before you download. Some older packages you must first download and unzip to find it, but you can always learn this information before installing.
"Open Source" has been used by businesses to mean that you can access and use their software, but they retain rights to do as they will.
This is different from "Free Software" which generally has more permissive license terms.
The FSF has a webpage all about software licenses (and whether or not they approve).
Assuming EBX isn't clobbered by the function, then yes, it should work.
Not every possible flavor necessarily compiles using the default build process.
You are trying to link with the regex library that has the following features:
- multithreading support
- using debug versions of the standard and runtime support libraries
If your application doesn't use multithreading, you don't need the -mt- tag in the library name: remove it and use a smaller lib.
Also, there is really no reason you need to link to debug versions of the standard and runtime libraries. That stuff is for people developing the standard and runtime libraries. Otherwise, you can safely assume that the standard and runtime libraries won't cause any errors... Get rid of the -gd- tag. (If you are debugging your own code, you may want to leave the -d- tag in there until you compile the release version of your program.)
Most of the tags you will not need unless you are doing something pretty unusual. The most likely is the -s- tag if you want to statically link with the standard and runtime libraries on *nix systems. (Static linkage is default on Windows.)
Hope this helps.
Implement a simple Turing machine.
You have failed to use the proper directives to organize your code and data. Please read TASM's documentation.
I should note also that you've got some pretty egregious errors there, particularly when calling and not returning.
Hope this helps.
In Qt's case, it means you can't sell your application. Qt is a commercial company, so they want you to buy a developer's license. But they've made it possible for people who do stuff for free (i.e. KDE) to use their stuff without paying anything.
Yeah, I was thinking of Ultimate++ also.
If you don't mind writing "open source" there is also Trolltech's Qt, which I think still comes with a GUI designer. Version 3 had it at least.
And there is GNOME's Glade (GTK+) designer.
There is also the The GUI Toolkit, Framework Page.
Hope this helps.
Destructively or non-destructively?
Why do you have so much indirection?
No. A window must be visibe to be active (i.e. in order to receive user input events).
Even though the window is inactive, your application is still running though, and can receive other events.
You can set a system hook to capture events you are interested in, using SetWindowsHookEx(). System-wide event hooks usually require a DLL.
Hope this helps.
Your code is somewhat verbose, so it is a little difficult to follow...
I got as far as out2. You are shifting bits off the end of AX. I'm still not sure how you are getting your outputs. But, assuming that input_buffer contains four bytes each in the range 0..63:
; re-arrange bits into their proper slots
mov ax, input_buffer[ 0 ] ; al,ah = [0],[1]
shl al, 2
shr ah, 4
add al, ah
mov output_buffer[ 0 ], al
mov ax, input_buffer[ 1 ] ; al,ah = [1],[2]
shl al, 4
shr ah, 2
add al, ah
mov output_buffer[ 1 ], al
mov ax, input_buffer[ 2 ] ; al,ah = [2],[3]
shl al, 6
add al, ah
mov output_buffer[ 2 ], al
Another error is converting '=' into spaces in the output. Don't. Just reduce the number of bytes you actually write to the output.
In other words, you would normally write 3 bytes to output. For each '=' decrement that by one:
; cx <-- number of bytes to write
mov cx, 3
mov ax, input_buffer[ 2 ]
cmp al, '='
jnz ok1
dec cx
ok1: cmp, ah, '='
jnz ok2
dec cx
; write cx bytes to file
ok2: mov ah, 40h
mov bx, output_handle
lea dx, output_pointer
int 21h
The x86 string opcodes are very powerful and very useful.
Here's something along the lines of C's strcmp():
; prereqs:
push ds
pop es
cld
; find index of char_to_find
mov al, char_to_find
mov …
Ah, yes, that works.
Still, I would repeat myself instead of calling FormCreate again.
procedure TForm1.RedoFunctionButton(Sender: TObject);
begin
memo1.Lines.Text := GetNicAddr;
end;
Have fun!
"When the program starts" is actually a little vague.
Which functions/procedures are being called when your program starts?
Are they being called in the main program file's begin..end. block?
Or in some unit's initialization section?
Or in some form's constructor? or FormCreate event?
Well, I've been playing with it and I can't match your exact description. I presume you are using MIME encoding.
To preserve spacing, I'll continue in a code block:
"Man A" should encode as "TWFuIEE="
"Man A" (with three spaces) encodes as "TWFuICAgQQ==".
Both decode for me correctly.
Now, if you are getting the first to encode as the second, then there is an error in your encoding algorithm.
If you are getting the second to decode with only two spaces, then there is an error in your decoding algorithm.
If you haven't figured out what it is yet, please post it and I'll take a look at it.
Hope this helps.
I must have been really tired when last I posted because I thought that the beginning and end of this thread was two separate threads...
As per your original question, whatever you are doing in FormCreate that needs to be done again, just stick it in another, private method.
...
type
TForm1 = class( TForm )
...
private
// Add yourself a method that does what you want
procedure do_something;
end;
...
// Define it
procedure TForm1.do_something;
begin
// does it here
end;
...
procedure TForm1.FormCreate( sender: tObject );
begin
...
do_something; // use it
...
end;
procedure TForm1.fooButtonClick( sender: tObject );
begin
do_something; // use it again
...
end;
Your solution to just call FormCreate again is also OK, so long as FormCreate only does what you need done again. I would prefer to separate it out into a separate method just for logical consistency and to make you life easier should you later want to make FormCreate do something unrelated to clicking the button (as is wont to happen).
Hope this helps.
I don't understand what you mean about spaces. Are you saying that spaces in your original file are producing spaces in your encoded file?
The encoded file will naturally contain spaces, but these are not part of the data, and should be ignored when decoding.
Originally, you had an integer, which we used as an index into a table of ASCII values. Basically, we said: output_char = ascii_values[ input_index ];
Now you want to go the other way --that is, convert the ASCII value into an index into the table. That's where scasb comes in. Put the length of your table in CX, the value you are looking for in AL (I think), and execute REP SCASB. When done, subtract the address of the beginning of the table from DI. Now DI == the original index into the table, or one too large if the character was not found in the table:
DX = DI - OFFSET ascii_values
if DX == 64 then not found
else DX is the original input value
Bit shift DX into the right place in the output and add it in. After four characters are converted into indices, and shifted into the 3-byte array, you can then output it.
Hope this helps.
Well, if you are checking them all for validity at the same time, then sure, just put them together:
if (edit1.text = '')
or (edit2.text = '')
or (edit3.text = '')
then MessageDlg('whatever goes here',mtWarning,[mbOK],0)
But it is better to separate them, so that you can visually indicate which one is in error:
...
type
TForm1 = class( TForm )
...
private
// Add yourself a function that checks for errors
function check_edit_error( sender: tEdit ): boolean;
end;
...
// Define it
function TForm1.check_edit_error( sender: tEdit ): boolean;
begin
// Was there an error?
result := sender.text = '';
// Yes, complain
if result then begin
messageDlg( 'fooey', mtWarning, [mbOK], 0 );
sender.setFocus
end
end;
...
procedure TForm1.fooButtonClick( sender: tObject );
begin
// Check all the edit boxes we need right now for error
if check_edit_error( edit1 )
or check_edit_error( edit3 )
then exit;
...
end;
Don't use mtError except for errors that are fatal or nearly fatal to your application. For something like this I would use mtWarning or mtInformation, since the program is simply explaining to the user that it cannot continue until proper input is given.
Hope this helps.
Just create a utility function to get the number. When your program starts, call the function. When you press the button, an event method (onClick) gets called. Inside Button1Click just call the function again.
Alas, for errors, it is usually simple enough just to write the messageBox( ... )
stuff over again. Borland compilers are very smart about optimizing strings, so you don't have to worry about bloating your code by the repetition.
However, if you know you'll use it the exact same way many, many times, you could just create a little method that calls the messageBox (or whatever the error message dialog function you are using is), then just call your method whenever the user error occurs.
Hope this helps.
Actually, I might have that backwards. Point is, if your system is configured correctly (and most are out of the box) then it won't matter which rich edit DLL you call.
[EDIT]
It is likely that the problem is not with the rich edit control but with the program using it. There is no way to directly set a character index on huge texts with the API. You can only do it relatively.
If the calling code is keeping track of the character index in an int or long or something that is too small, then it will wrap when too much is added to it.
Hope this helps.
The riched20.dll is just a wrapper for riched32.dll.
The rich edit defaults to a limit. Try sending it the following message: SendMessage(hwnd, EM_EXLIMITTEXT, 0, -1);
Thereafter it shouldn't have limits.
Hope this helps.
I'm not sure exactly what problems you are having, but the stuff following B4 has some errors.
First, if you only want to clear the top two bits of AL then shl al, [B]2[/B]
shr al, 2
Or, even simpler: and al, 3Fh
Also, you only add 61 to it instead of 65 as you did in all the others.
You are aware, I presume, that simply adding 'A' doesn't account for three things: punctuation characters between A..Z and a..z, a control character (ASCII 127), and the fact that you exceed the ASCII character range by one character (your domain is 65..128, while ASCII is only defined on 0..127).
You would do better to use a lookup table for ASCII digits and use the xlat instruction to convert AL.
Hope this helps.
For others reading here:
If you know that your register is bit-formatted correctly for the coprocessor, use the mfc1 and mtc1 instructions. They are also in that link.
Glad to be of help.
You need the cvt.s.w and cvt.w.s instructions.
If you don't have a reference, here's a PDF for you: MIPS - Floating Point Instructions.
Hope this helps.
Ah, I have learned something. (Further proof that C99 is weird...)
It's probably in your while (status != EOF || status2 != EOF)
statement.
That ||
should be an &&
.
Oh yeah, don't int main(void)
.
Always use either:
1. int main()
2. int main( int argc, char *argv[] )
Main takes arguments. If you want to ignore them, use form 1 (which says to the compiler: "I don't care about any arguments this function takes.")
Jishnu
"a.out" is the default executable name that compilers produce on *nix systems. On Windows you compile "foo.c" and get "foo.exe". On Unix you compile and get "a.out".
I'll get it to you shortly. I was in the middle of dinking with some stuff in it when I left-off and left it a mess. Once I've cleaned it up better (I should be done by tomorrow) I'll send it to you.
I'm not doing anything more to the syntax highlighter for the moment, and I discourage you using it for any serious stuff (as it is currently broken and slow), but everything else should work fine. (System Tray icon stuff, pop up menus, non-rectangular windows and pop up balloons, application mutex, and a few super-useful utilities I wrote years ago and never stopped using.)
Give me a day...
I didn't think anyone was still looking at this problem. I'll pack up my example code for you. (It isn't finished as far as syntax highlighting is concerned, but it does everything with the system tray that you are trying to do. I'll PM it a little later today.
For the background image, there are two ways I can think to do it.
1. Put your image component on the form, and before saving and compiling your project make sure it is at the bottom of the Z-order with all the other components on the form.
2. (More robust). Overwrite the Paint method of the form. The docs should have an example of this...
Hope this helps.
Please use code tags.
Think about why that messes up and you'll be able to fix it easily. You are on the right track.
Also, there is a special case for the very first line.
You need to count how many lines there are.
Every time you read '\n' from the file, increment your current line number and print it to the file.
Hope this helps.
I've never heard of an INI file that isn't ASCII encoded. Too bad they don't all just die... (that is, seems odd to me people still use them, because for all their supposed simplicity they can sure give you headaches)...
Alas.
It is easy enough to write something that works with std::string.
std::string GetFileTitle( std::string filename ) {
std::string result;
short len = GetFileTitle( filename.c_str(), NULL, 0 );
if (len < 0) throw 1;
result.resize( len -1, '\0' );
if (!GetFileTitle(
filename.c_str(),
const_cast<char *>( result.c_str() ),
len
))
throw 1;
return result;
}
There are several ways to deal with errors. In this example I just throw an int exception. You may want to adjust it to throw something else or return an empty string or whatever strikes your fancy.
Enjoy.
[EDIT] Oh yeah, an example of use: string FullPath = "c:\fooey\quux.txt";
string filename = GetFileTitle( FullPath );
Not that I know of, but you could probably roll your own pretty easily. I know there are a lot of libraries people wrote on Google as well...
How complex is the INI file you want to read? (Does it stick to the simple [this is a section header]
this=is a value
format?)
I'm sure I came across a nice library about a year ago that is pretty advanced. If I can remember what it is I'll post back.
You'll need two separate loops. One to display the heading, then a nested loop to display the rest of the information.
Please try the graph paper approach. It will help you figure out exactly how to format your output.
Yes, you can do it in a loop. The trick is making things line up nicely.
For this kind of exercise, I usually find it best to get out a piece of graph paper and decide where each character in the output should be. I notice you are using the setw() manipulator. Good job. You'll also want to output some strategically places spaces and the like to make your header line up.
Good luck.
Heh, nice job. Sorry I goofed in my example and left the ptMaxSize part out: ((LPMINMAXINFO)lParam)->ptMaxSize.x
Good job on picking that up! Glad you got it working.
OK, according to your problem description I have a few comments to help...
But FIRST, please take the time to be careful about how you "format" your code. You've made some indentation errors (that is, because of the way you have indented your code you have made some errors!)
text file
OK, if the input file is a text file, why are you opening it in binary mode? Don't. std::ifstream in( "clients.txt" );
That's all you need.
Clearing the array should not be dependent on the file.
input
You cannot force input. According to the problem description, your input is guaranteed only to have the following form:
M|F 1 2 3 4 5 6 7 8 9 10 name ...
That is, the letter 'M' or 'F', followed by ten numbers, followed by one or more names. I would suggest that you don't need to care whether the client has both a first and last name, but you can always separate them later.
This input has a nice characteristic: all the fields at the beginning of the line are definite, while the last field is a free-form string. This means you can mix >> and getline() with impunity.
So input for each line (or client) might look something like this (needs more work):
// get the letter 'M' or 'F'.
std::cin >> sex;
// get the answers
for (i = 0; i < 10; i++) std::cin >> a[ i ];
// …
Just cast it the usual way:
LRESULT CALLBACK MyWndProc(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
) {
if (uMsg == WM_GETMINMAXINFO) {
cout << "Max Window Size is ("
<< ((LPMINMAXINFO)lParam)->x << ", "
<< ((LPMINMAXINFO)lParam)->y << ")"
<< endl;
}
return DefWindowProc( hWnd, uMsg, wParam, lParam );
}
Hope this helps.
You don't have to be a professional. You only need to pay attention. So far you have not.
When writing a post that contains code, place all your code in code blocks:
[[I][/I]code=Pascal[I][/I]]
program fooey;
begin
writeln( 'fooey' )
end.
[[I][/I]/code[I][/I]]
becomes:
program fooey;
begin
writeln( 'fooey' )
end.
Next, don't start a new thread for every post you make. If you are still working on a problem from a previous thread then reply to that thread.
Now, I've asked you several times to explain yourself better. You've not done that either. However, at this point I think I understand:
You have three image components (band1, band2, band3) which you wish to animate together by making one visible, then another, and then another, in succession, where only one is visible at any given time.
You only need one timer component. (Again, the documentation would have given you a very good example of what follows):
TForm1.Timer1Timer( Sender: TObject );
begin
if band1.visible then
begin
band1.visible := false;
band2.visible := true;
//wait 4 sec before displaying band3
timer1.interval := 4000
end
else if band2.visible then
begin
band2.visible := false;
band3.visible := true;
//wait 6 sec before displaying band1
timer1.interval := 6000
end
else // band3 is visible
begin
band3.visible := false;
band1.visible := true;
//wait 2 sec before displaying band2
timer1.interval := 2000
end
end;
Initially band1, band2, and band3 are all not visible, and Timer1.enabled = false. To start your animation:
…