#### Archived

This topic is now archived and is closed to further replies.

# problem call winapi functions from delphi5

This topic is 6898 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hi,

The problem (I think) is that while you include the header mmsystem.h to use the function, its body is actually located in winmm.dll, not mmsystem.dll. I believe mmsystem.dll was the 16bit version and winmm.dll is the 32bit version (which may be the cause of the "corrupt" message).

See if that helps...I had the opportunity to play with Delphi for a bit back with version 2.0? Anyway, you should be able to call any WIN32 function you want...you just need to know which .dll it resides in.

HTH,

-mordell

ps..
ok, so timegettime is also in mmsystem.dll, but I still think that is the 16bit version.

[This message has been edited by mordell (edited December 29, 1999).]

##### Share on other sites
Add "mmsystem" to your "uses" and you'll be able to call timeGetTime().

------------------
DavidRM
Samu Games

##### Share on other sites
Thanks for the help.
I didnt know you could put a dll's name in the uses clause.
Any other things that may help me?
The help files don't have any thing on that or what i could find.

##### Share on other sites
Looking at the units provided i see there is a mmsystem unit. So you cant put a units name in the uses clause. But there is no documentation on this unit. I dont know very much on the winapi so can you tell me what this unit is for?

##### Share on other sites
The mmsystem unit should contain declarations of all the functions in the mmsystem (or winmm, I guess) DLLs. So you should be able to put
code:
uses  mmsystem;

and you should be able to call any functions from that dll. There might be a winmm unit, I don't know. Also, I don't know if in Delphi you need to put a reference in the project options to link in the winmm import library, or if that's automatic when you use the unit, but if you need to, you should get some sort of "unresolved external" error.

------------------
http://qoy.tripod.com

##### Share on other sites
As the topic indicatesi'm programing in delphi, this is the source of my problem.
First I just got delphi this christmas so I havent totally learned all the features, the main area that I havent got around to looking at are the objects provided. I have the standard verion of delphi so it doesnt have a printed manual!
Ok back to my problem.
To my knowledge delphi does not provide any way of direct using the winapi via include files like C or C++. But delphi does provide a wraper around some winapi functions.
The function i'm trying to get at is timtgettime. I need to know which dll it is in and i need some one to tell me why this doesnt work.
function timeGetTime : longword; stdcall; external 'mmsystem.dll';
The error it produces when I try and compile it is :
The C:\WINDOWS\SYSTEM\MMSYSTEM.DLL file
appears to be corrupt.
Reinstall the file, and then try again.

I know a copy of timegettime is in mmsystem.dll as I used quickview on it and found it in the export table. But am I going about this in the right way? And how can i fix this problem?
I'm running win98 but it also does this to me on my other computer which is running win95.

##### Share on other sites
About the only thing I use the MMSystem unit for is to call timeGetTime. I'm sure it has other uses.

------------------
DavidRM
Samu Games

1. 1
Rutin
41
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 14
• 14
• 9
• ### Forum Statistics

• Total Topics
633379
• Total Posts
3011568
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!