Solved

argv[0] For Winmain?

Posted on 1998-11-25
3
737 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
[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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

762 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