I downloaded some buttons, is that something I could add to Win programs whenever I get to the point
where I understand it more.

I know a console app runs from a DOS prompt.

Some of the ones I have seen flub up if you accidentally run it from windows.

Is there code that can be added that just displays a message so it doesn't make you reboot.

Thanks.
Posted on 2004-02-18 18:30:16 by skywalker
Hmmm, I didn't make too much sense out of that...
Anyway, console apps don't "run from a dos prompt" - they pop up a console though (or use an existing one). On Win9x, you can start "command.com" (16bit dos app) and run console apps from there, on NT you can run "cmd.exe" (fullblown win32 console app) and run from there. Also, on 9x, you can set the default properties for console mode apps to not close the console when done.

In my experience, it's sorta okay that console mode apps close after running, when invoked from the windows user interface. After all, they're intended for cmd-line tools that takes parameters. If you don't want your own apps to close immediately, you could make them show a MessageBox or wait for some key, I guess.

As for the main question (I guess?), "I downloaded some buttons, is that something I could add to Win programs" - what do you mean? Have you downloaded some graphics files? Yes, those can be used for buttons... you'll have to do owner-drawn or a custom button though, which takes a little bit of code - but it's not too bad, when you've got the swing of win32.
Posted on 2004-02-18 19:08:13 by f0dder

Hmmm, I didn't make too much sense out of that...
Anyway, console apps don't "run from a dos prompt" - they pop up a console though (or use an existing one). On Win9x, you can start "command.com" (16bit dos app) and run console apps from there, on NT you can run "cmd.exe" (fullblown win32 console app) and run from there. Also, on 9x, you can set the default properties for console mode apps to not close the console when done.


; to ASSEMBLE
; ml /c /coff password.bat
; link /subsystem:console password.obj
; del password.obj

.686
.MODEL FLAT, STDCALL
OPTION CASEMAP:NONE

The console word above threw me as it isn't in other Win 32 source code.


In my experience, it's sorta okay that console mode apps close after running, when invoked from the windows user interface. After all, they're intended for cmd-line tools that takes parameters. If you don't want your own apps to close immediately, you could make them show a MessageBox or wait for some key, I guess.

As for the main question (I guess?), "I downloaded some buttons, is that something I could add to Win programs" - what do you mean? Have you downloaded some graphics files? Yes, those can be used for buttons... you'll have to do owner-drawn or a custom button though, which takes a little bit of code - but it's not too bad, when you've got the swing of win32.


The buttons may be for use in a webpage, but I thought maybe they could be used for a Win app.

To get just a tad off topic. This isn't working and I don't know why.
It's supposed to be a way to time routines.



Thanks.

xor eax, eax ; start the timer
cpuid
rdtsc
;mov edi, eax ; save lower 32 bits in edi
mov firstime,eax
;push eax
int 3
jmp exit
xor eax, eax
cpuid


; Insert timed code here



xor eax, eax
cpuid
rdtsc
pop edi
sub edi, eax
xor eax, eax
sub eax, edi ; eax = result

exit:
MOV AX,4C00h
INT 21h
Posted on 2004-02-19 06:54:01 by skywalker

The console word above threw me as it isn't in other Win 32 source code.

Well, that's because there's basically two forms of win32 executables: GUI and CONSOLE. The only difference is a bit in the PE header flags, so it's no big deal - GUI apps can create consoles, and console apps can do GUI calls. The main difference is that the CONSOLE bitflag means the executable will start with a console - a gui app will have to allocate it's own console with an API call.

(And well, apart from console/gui, on NT there's also stuff like POSIX and NATIVE executables, because NT supports multiple subsystems - but there's a good chance you won't ever see any of those executables).


The buttons may be for use in a webpage, but I thought maybe they could be used for a Win app.

Well, they can, but you'll need some ownerdrawn button code, or custom button control. It's not too bad, and there's a lot of people here who can help you - but you might want to start with the basic basics first :)

Humm, your timing code looks like a mix of 16 and 32bit stuff (well, because of the int 21h termination - if you're doing win32 you should call ExitProcess instead).

The code looks a bit funny - int3 (debugger break) and "jmp exit"? No code will be timed at all that way :). Also commented out lines, but still a pop for the uncommented push? The code looks somewhat junky. If you want to decently time code, search the board for 'profile', unless the threads have been auto-cleaned, there should be some rather fancy discussions and profiling code available.
Posted on 2004-02-19 09:22:23 by f0dder