Solved

how to code GetCurrentProcessId under Borland 5.02

Posted on 2003-11-25
3
377 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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Statment to match two tables in c# 6 77
Linux context switch  - loop takes long time to process 6 109
Need example 5 107
Problem to scan all sheets 3 95
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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 how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

895 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

14 Experts available now in Live!

Get 1:1 Help Now