Solved

how to code GetCurrentProcessId under Borland 5.02

Posted on 2003-11-25
3
385 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
[X]
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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Console based application in Linux 1 100
Using ANSI C how to Read a .csv file 10 114
Super Scope, DHCP 5 95
Test the speeds on my PC Drives 12 71
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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.

733 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