Solved

how to code GetCurrentProcessId under Borland 5.02

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
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.

809 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