Solved

how to code GetCurrentProcessId under Borland 5.02

Posted on 2003-11-25
3
374 Views
Last Modified: 2006-11-17
How do you code for GetCurrentProcessId under Borland 5.02 without having to ship the whole Borland application to the target Win2000 machine?

Initially included windows.h and winbase.h, but application refuses to use owl50f.lib and insists on using owl50f.dll !

If the running current process Id of the (self) running progran can be gotten any other way, would like to use that.
0
Comment
Question by:mornao
3 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9817841
GetCurrentProcessId

Windows NT/2000 or later: Requires Windows NT 3.1 or later.
Windows 95/98/Me: Requires Windows 95 or later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.

Should work in any platform, this is very basic function. What error messages do you have?
0
 
LVL 45

Assisted Solution

by:Kdo
Kdo earned 50 total points
ID: 9818247

Hi mornao,

You're dealing with a linking error, not an API error.

I don't have access to my C compiler from here so I can't walk you to the exact location, but in the build options you should be able to select how you want the object linked.

You should check the link options and make sure that you're building a "statically linked" module.  No packages, no dlls.


Kent
0
 
LVL 86

Accepted Solution

by:
jkr earned 450 total points
ID: 9818972
As a workaround, you could load it dynamically:

typedef DWORD (*PFN_GetCurrentProcessId)(VOID);

DWORD dwPID;

PFN_GetCurrentProcessId pGetCurrentProcessId = (PFN_GetCurrentProcessId) GetProcAddress ( GetModuleHandle ( kernel32.dll"), "GetCurrentProcessId");

dwPID = pGetCurrentProcessId ();
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now