Solved

argv[0] For Winmain?

Posted on 1998-11-25
3
731 Views
Last Modified: 2013-12-03
Is it possible to obtain argv[0] information (program full path and name) using a win32 compiler such as Borland c++ 5?
Winmain's lpCmdParam argument does not contain this info.

Thanks.
0
Comment
Question by:1agallen
3 Comments
 
LVL 1

Accepted Solution

by:
papirus earned 50 total points
ID: 1416344
Use Win32API Function :

GetModuleFileName()
//if you have problem getting HMODULE - use GetModuleHandle() with NULL as the first parameter
0
 
LVL 3

Expert Comment

by:BudVVeezer
ID: 1416345
If you want to get all of the arguments, you can use GetCommandLine()  This returns a string, which is the full command line, path, file and args included.

~Aaron
0
 
LVL 15

Expert Comment

by:NickRepin
ID: 1416346
The easiest way for Borland compiler is to use _argc and _argv global variables. They are fully identical main(int argc,char* argv[]). They are work for GUI and console.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
learning a new language quickly and efficiently 9 58
How Does Quick Books store date / time? 3 93
Dir function fails on mapped drives 28 123
Need to create an object factory 2 44
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

16 Experts available now in Live!

Get 1:1 Help Now