Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

how to code GetCurrentProcessId under Borland 5.02

Posted on 2003-11-25
3
383 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:Kent Olsen
Kent Olsen 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ vs C compilers 13 160
Setting nameservers after res_init fails doing res_query 2 109
Computer slow / BSOD 10 64
Why is compiler in oracle server ? 9 75
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

856 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